Since I maintain a Darwin partition on my system, I use GRUB legacy to choose which OS I want to play with. But, then, due some of my tweaking, it stopped working. Ouch. Even if I selected it, it wouldn't boot and would return to GRUB's menu. Irritating, to say the least.

Being disappointed with that, I eventually, RTFM of GRUB and learned a bit more about something that seems to give hackintosh users some headaches: the partition bootloader being foobared.

The solutions presented there are bizantine from a Unix P-o-V. The necessary steps to fix it are just to:

  1. Make sure that the hard disk bootloader (that is, the MBR of your HD) contains GRUB's stage 1 loader. Warning: don't just dd it to your HD's file, so that your system can "forget" the partitions that you have.
  2. Make sure that the partition bootloader (something that is peculiar to the x86 arches and which, I as a user of other platforms, didn't know that existed) is set to Apple's boot1h. This time, you can just dd it to the first sector of the partition where Darwin/MacOS X resides.
  3. Teach GRUB to set its snippet to run Darwin with root (hd0,0) (or whatever partition contains Darwin), tell it to make the partition active with makeactive, and tell it to load the partition bootloader with chainloader +1.
  4. (Optional) Edit /Library/Preferences/SystemConfiguration/com.apple.Boot.plist to contain the elements <key>Kernel</key> <string>mach_kernel.foo</string> to point to whatever is your kernel of choice.
  5. (Optional) If you make changes under Linux, with the hfsplus module, it is highly recommended that you unmount your filesystem and run the fsck.hfsplus from the hfsplus package that I maintain in Debian (and which is mirrored by Ubuntu, but Debian's is more up-to-date, as I have uploads rights there).
  6. (Optional) Test it with QEMU, to see if it will work.

This was a nice learning exercise, to be honest.

blog comments powered by Disqus