Tuesday, January 12, 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.)

5 comments:

ggm said...

the recipe looks like a simplified take on the PPC NetBSD install doco (which says up front 'read me entirely before you begin, then go take an asprin, then read me again, then decide to do something else because this is complicated' but more tersely)

Do you think this would work on an iBook G4? I'm noticing that it really crawls under Leopard. I think the fat binaries cost it bigtime. Its so under-used, it might as well be a netbsd box to play with.

Julio Merino said...

Install docs are there to NOT be read, you know ;)

Anyway, seriously, I did take a look at the docs but they didn't solve me all the problems (specially not on the PowerMac G3). I don't recall that weird boot command described in them.

As regards NetBSD vs. Leopard. I installed Leopard first and attempted to bootstrap pkgsrc, but it felt extremely slow. With NetBSD, I have been able to build many different applications (including monotone, a C++ beast) and it has been pretty snappy. I'm about to place an order for a RAM upgrade to 1GB :-)

However, yours is an iBook... I don't know how fast graphical applications will be if you install any. A Fedora 12 with a Gnome desktop felt pretty slow on this machine. So I'm leaving it as a server.

schmonz said...

Here's how I did it when my PowerPC mini was alive.

drio said...

Thanks Julio,

Can you please post here your X config file?

-drd

Julio Merino said...

drio: I don't use X in this machine.