How to test GRUB 2 on EFI
For now, the EFI port is tested only on Intel Mac Mini.
Build GRUB
Obtain the latest from the SVN repository. Then, compile GRUB like this:
./configure --with-platform=efi make
Note that you need to use something else but MacOSX for the compilation, because the gcc shipped with MacOSX is broken by Apple.
Install GRUB
If you like an adventure, you can install GRUB onto current boot media. If not, try a USB disk. On Mac OS X, create a folder (note that 'something' must be replaced with the Volume name of the USB disk):
sudo mkdir -p /Volumes/something/efi/grub
Then, create an EFI application for GRUB and copy it and the other modules:
./grub-mkimage -d . -o grub.efi gpt hfsplus fat ext2 normal chain boot configfile sudo cp grub.efi *.mod fs.lst command.lst /Volumes/something/efi/grub
Then, bless the GRUB:
sudo bless --folder=/Volumes/something --file=/Volumes/something/efi/grub/grub.efi --setBoot
Configuring GRUB
You can put a config file in the same directory:
sudo vi /Volumes/something/efi/grub/grub.cfg
The contents can be like this:
timeout=10
menuentry "MacOSX" {
# Set the root device for Mac OS X's loader.
root=(hd0,2)
# Load the loader.
chainloader /usr/standalone/i386/boot.efi
}
menuentry "GNU/Linux" {
# Set the root device for GNU/Linux.
search --set /boot/vmlinuz
# Load the kernel and initrd.
linux /boot/vmlinuz video=vesafb agp=off acpi=force libata.atapi_enabled=1 init=/linuxrc root=/dev/ram0 pcboot=cdrom gpt
initrd /boot/initrd
}
Note that the Linux kernel must be compiled with EFI support. Legacy boot is not supported yet. Use kernel 2.6.25 or higher.
Boot a CDROM
CDROM booting is not thoroughly tested yet. You can press Alt when booting instead, to use the builtin selector. Booting from a Grub CDROM seems to disrupt boot settings. Rebooting from Mac Install CD or rEFIt CD restores settings.
Boot from a network
I still do not understand how BSDP (the protocol used by Mac) works. If you know how to use it, let me know. When I tested it, the DHCP client just repeated the same request.
Boot Legacy OS
Legacy Booting is not supported yet. Use the standard selector at the moment.
Install GRUB as a legacy loader
Theoretically, it should be possible to use GRUB as a legacy loader with the latest firmware release. But this is not tested at all. If you can afford a test environment, please test it, and report the result to me.
Known problems
I have already reported some bugs to Apple, but I get no response from them yet. Even if you see these problems, please do not send a report, because I already know these problems.
- TAB requires pushing three times (this looks like a bug in the usb keyboard driver)
- Control-Something does not work (this is a bug (or feature) in EFI)
- The menu border is not drawn (the firmware seems to lack those fonts)
- The top line shows something (this is for debugging the keyboard problems)
For the first two problems, I guess I should write my own keyboard driver for EFI and replace the standard buggy driver. Also, I am considering some ugly hack, such as using function keys instead of control keys.
For the third problem, I will implement the video support in EFI some day, then this problem will disappear.
For the last problem, I will remove this debugging output, once I solve the two keyboard issues.
See also TestingOnMacbook CategoryDocumentation