So, let's back up a bit. GRUB2 is the next generation of the GRUB boot loader. (The original is now called "GRUB Legacy.") GRUB2 is still officially in beta, but I've been using it on my multi-boot laptop for a while (currently SUSE Linux 11.0, OS X 10.5.6, and Windows 7 RC). GRUB2 is designed to be more modular than GRUB Legacy, it's multi-platform, and it's got various other enhancements. Two of these are limited EFI emulation support and support for loading XNU kernels.
I'm going to assume in the following that you know a bit about Linux, software compilation, and GRUB or GRUB2 installation and configuration. If you don't, try Googling on these topics to find some tutorials.
My initial tests, using a GRUB2 RPM intended for Fedora 10 systems, were less than successful. To get OS X booting, I had to download the grub-1.97~beta3.tar.gz source code tarball from the GRUB Web site and compile it locally. (I compiled under Linux. A quick attempt under OS X failed, but it's conceivable this problem could be overcome.)
If you're familiar with GRUB but not GRUB2, you should be aware that the configuration file name and syntax have changed. The new filename is /boot/grub/grub.cfg. Some of the configuration file changes will be obvious below, but note that GRUB2 numbers partitions differently. What was (hd0,0) in GRUB Legacy is (hd0,1) in GRUB2, with corresponding changes to other partition numbers. Below are the three entries I'm using to boot Linux, Windows, and Mac OS X:
menuentry "openSUSE 11.0 - 2.6.25.20-0.5" {
set root=(hd0,3)
linux /boot/vmlinuz-2.6.25.20-0.5-default root=/dev/sda3 showopts
initrd /boot/initrd-2.6.25.20-0.5-default
}
menuentry "Windows 7 RC" {
set root=(hd0,7)
chainloader +1
}
menuentry "Mac OS X" {
set root=(hd0,6)
insmod video
insmod vbe
gfxmode="1280x800x32"
xnu_kernel /mach_kernel rd=disk0s6
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
xnu_mkext /System/Library/Extensions.mkext
else
xnu_kextdir /System/Library/Extensions
fi
}If you try something similar, pay careful attention to system-specific items, such as the disk and partition identifiers and the video mode. After setting this up, typing "/usr/local/sbin/grub-install /dev/sda" installed it for me, including copying a boatload of files to the /boot/grub directory. The explicit path to /usr/local/sbin ensures that I installed my locally-compiled GRUB2 rather than the distribution's standard GRUB. The new files in /boot/grub hold the modular GRUB2 components, such as filesystem drivers, the EFI emulation code, etc.
A few random comments:
- The system boots in verbose mode, similar to passing the "-v" parameter via Chameleon or some other traditional OSx86 boot loader. I haven't yet figured out if it's possible to get a more GUI boot out of GRUB2.
- My test system is running a Voodoo kernel. I know of no reason other kernels wouldn't work, but I've also not tested them.
- My system has a hybrid MBR, which GRUB sees as GPT. I haven't tried this on an MBR-only system. I have no reason to think it wouldn't work, but I thought I'd point out this detail.
- On GPT disks, GRUB2 likes to have a small (a few tens or hundreds of KB) partition of type "BIOS boot partition" in which it can install its second-stage boot loader. It will work without this partition, but such a partition is recommended.
- I haven't yet investigated ways to pass additional parameters to the system (-f, -x, etc.).
- GRUB2 allows you to edit its entries on the fly, so you can make boot-time changes. IIRC, you press the 'e' key when the menu comes up and you can edit the menu item.
- I've reconfigured my system to use an HFS+ /boot partition (in Linux) so that I can edit the grub.cfg file in either OS. This seems fine so far, but it's only been set up this way for a short time. FAT might also work, but my experience is that some GRUB and GRUB2 configurations rely on symbolic links, which aren't supported in FAT. Oddly, the OS X Disk Utility deleted my EFI System partition and reverted my hybrid MBR to a plain GPT setup when I used it to format the /boot partition. Both problems were easily rectified, but annoying.
- GRUB2 is not yet common on emergency disks. GRUB-2 includes a grub-mkrescue command that I believe creates emergency boot disks (USB flash drives, CD-ROMs, etc.), but I've not yet tested this.
- So far I've tested this on only one system. I've got another multi-boot system with which I might test this configuration, but I haven't gotten around to it yet.
Overall, I wouldn't recommend that everybody ditch Chameleon, Boot Think, etc. in favor of GRUB2. It might be worth considering such a configuration if you dual-boot with Linux or some other OS that relies upon GRUB or GRUB2, though. This will give you one boot loader configuration file and a reduced risk of problems from one boot loader stepping on another's feet, as it were. If possible, I recommend keeping a second boot path option available -- in other words, a GRUB2 option to boot via Chameleon, Boot Think, PC-EFI, or whatever. This might be handy if GRUB2 suddenly stops liking your XNU kernel or something.



Sign In
Create Account









