Saturday, April 16, 2011

HOWTO: Chainload Grub2 into Chameleon

I recently started playing with OSx86 again on my laptop that also runs Bodhi Linux. OSx86 uses the Chameleon boot loader to boot into the OSX kernel and handle easily passing on boot arguments at startup. If you are a Linux user like myself, odds are you prefer the Grub boot loader, which supports just about every operating system you can think of.

While I like grub, it does not do a good of a job of passing boot arguments to the OSX kernel. Beyond this some of the EFI strings Chameleon has happen at boot don't work properly with grub. The solution is to have Grub simply chainload into Chameleon instead of booting directly into the OSX kernel (which it does by default).

Doing this is fairly simple, first boot into your Linux operating system that is responsible for grub2, then open your favorite terminal and run the following:

sudo mkdir /boot/chameleon
cd /boot/chameleon
wget http://downloads.bodhilinux.com/jeff91/misc/boot0


Or if you don't trust a file provided by myself, the boot0 file is part of the chameleon boot loader, search for it on your own hard drive and move the file over.

Next, open your grub.cfg, as root, located at /boot/grub/grub.cfg with your favorite text editor and paste in the following chunk of code just below the last menu entry:

menuentry "Mac OS X Boot Loader" {
insmod hfsplus
set root='(hd0,1)'
search --no-floppy --fs-uuid --set ca2159244a8b0fc3
parttool (hd0,1) boot+
chainloader (hd0,5)/boot/chameleon/boot0
}

Note in the above chunk of code you will need to change hdX,Y to match your particular hard drive layout. On my system OSx86 is installed to sda1 (which equates to hd0,1) and Bodhi, which manages Grub2, is installed to sda5 (which equates to hd0,5). Also be sure you make the uuid match that of your OSX drive (you can copy it from the grub2 entry for booting directly into the OSX kernel).

Have any questions feel free to drop a comment below and I will lend a hand.

Cheers,
~Jeff Hoogland

0 comments:

Post a Comment