Monday, January 11, 2010

Installing NetBSD/macppc on a Mac Mini G4

Yesterday, I spent a while installing NetBSD/macppc 5.0.1 on a Mac Mini G4. The process wasn't easy, as it involved the following steps. I'm omitting many details, as they are "common knowledge" to Mac users (or otherwise can be easily found on the net):
  • After booting the installer from the CD image, drop into the shell.
  • Use pdisk to create an Apple_HFS partition for the boot loader and two Apple_UNIX_SVR2 partitions, one for the root file system and another for swap.
  • Run sysinst and install the system. When asked to repartition the disk, just say Use existing partition sizes.
  • Once the system is installed, drop again into the shell before rebooting.
  • Mount your hard disk into /mnt and chroot into it.
  • Fetch a copy of pkgsrc.
  • Install the sysutils/hfsutils package.
  • Use hformat to create a new HFS file system in the Apple_HFS partition we created.
  • Mount the installation CD.
  • Copy, using hcopy, the ofwboot.xcf file from the CD to the boot partition.
  • Reboot.
  • Drop into the OpenFirmware setup (Command+Option+P+R).
  • Set boot-device to hd:,\ofwboot.xcf.
  • Set boot-file to netbsd.
  • And here is the tricky thing to get the machine to auto-boot: Set boot-command to ." hello" cr " screen" output boot, not mac-boot.
I found the last command somewhere on the Internet (dunno where now), but, supposedly, a regular mac-boot should have worked. In fact, it works if you call this command from the prompt, but not during automatic boot. (It turns out to be a problem with the version of OpenFirmware I have.)

Just writing down the steps in case I need them later on. Installing Debian stable was much, much easier, but the installer for testing crashes every day with a different error, so I gave up.

(Oh, by the way, I did the same installation into an old PowerMac G3 and that was really painful. The machine refused to boot from any of the CDs I tried and the prebuilt kernels hang during initialization due to a bogus driver. In the end: netbooting and using custom kernels.)