An educational Open Firmware story

The Summary: if you have a New World Mac, and are having trouble booting your Linux installation from the CD, find a way to copy over yaboot and a kernel image to the hard drive, and use Open Firmware to boot it.

The Story:

So a couple of years ago I bought a used Blue and White G3 off of craigslist for $100. Seemed like a good deal. However, the seller admitted a problems, the first being it was a Rev A motherboard (with the bad IDE controller, causing data corruption on IDE hard drives). After failing to install Mac OS X.2.4 a couple of times on the IDE drive he provided it with, I managed to find (on craigslist again) an Adaptec 2940U2B SCSI-2 card with a 9GB hard drive. Put that into the G3, and lo and behold, the drive had Mac OS 9 and booted perfectly!

So that was step one. The next was seeing if I could install Mac OS X from there. Booted from the CD just fine, but now instead of random freezes during install (like with the IDE drive)... it said it just could not install on this machine. Bummer. So I moved it over to the Power Macintosh 9500, and installed OS X from there. Put it back in the Blue and White, booted up OS 9, went to the Startup Disk control panel, and success, it boots OS X.

In the meantime, there has been the addition of a G4/500, more RAM, and a second 9GB hard drive. Around the same time, some instability started to develop (random freezes etc). It may be due to bad RAM or motherboard issues that OS X is unable to cope with. So while I waited to scrap together some money to try out Panther, I decided I would try Gentoo Linux to see how that fared for stability. Here's where more fun begins.

First of all, I cannot boot from the Gentoo CD. Or any CD, except the OS X install CD. That's a bummer, for a while I thought it was a lost cause until I saw this post on the Gentoo forums:

But good news, I was playing around in Openfirmware (apparently it does read the keyboard at least for that when the screen is black, I also tried C but still no work) and after lots of web browsing on the subject and tinkering, I manager to get it to boot from the partition where I copied the contents of the Gentoo CD. I just had to change the yaboot.conf file to point to hd:xx (partition number) and it worked!

So on my particular installation, this involved copying the contents from the Gentoo CD to the hard drive and modifying the yaboot.conf file appropriately. This took some poking around in Open Firmware (you need to figure out how your hard drive is referenced). For me, with my disks attached to a PCI card, the device name was something like "bridge/ADPT,2940U2B@4/@0:6". This needs to be correct so yaboot can correctly find the kernel. Also make sure the root device is left as the RAM disk or else things the boot-up will fail.

So I boot into Open Firmware (start up with command+option+O+F) and type in "boot bridge/ADPT,2940U2B@4/@0:6,\boot\yaboot". And lo and behold, I get the Linux kernel/Gentoo Live CD set up. After setting up Gentoo just a couple of things I noticed:

  • If you have an adaptec card, during the live cd setup get into the modules directory and find the aic7xxx module and run insmod
  • When you compile the kernel, make sure you compile aic7xxx support INTO THE KERNEL AND NOT AS A MODULE or else it won't be able to find your root device
  • Linux, at this point, seems much more tolerant of whatever is wrong with my system than OS X is
It's good to make a note of the Open Firmware devices names of your disks once you start messing with yaboot and Open Firmware... if something breaks, you want to be able to drop into OF and get something to boot up. A couple of good commands are:
  • "boot <device name here>" (boots from that device); one example is "boot bridge/ADPT,2940U2B@4/@0:6,\System\Library\CoreServices\BootX" this boots OS X for me... the standard entry of "device,\\:tbxi" doesn't work on my machine (and if you're reading this probably not yours either)
  • "dev / ls"  Prints out the device tree
  • "devalias" prints out a list of known aliases. For instance, "bridge" in the above examples is short for some long name for the PCI bridge

For something more comprehensive head over to Apple Developer Connection's library and do a search for "open firmware"
http://developer.apple.com/technicalnotes/
Other reference:
http://forums.gentoo.org/viewtopic.php?t=171092