NetBSD on a first gen

Found at: sdf.org:70/users/jzp/phlog/2016-05-01-netbsd-7-on-a-first-gen-ppc-mac-mini.txt

NetBSD 7 on a first gen PPC Mac Mini

Published on Sunday, May 1st, 2016

I bought myself a first generation Mac Mini a while back, figuring I
could do something neat with it. Since I messed around with NetBSD on
SPARC-machines close to a decade ago, I decided that the neat thing
would be to install that on it and make it do some light server work.

It turned out easier said than done.

The first order of business was to access the Open Firmware prompt
during power on. I hit the Command + Option + O + F, and nothing happens.
I try again. Nothing. Another keyboard? No luck. Apparently, from what I
can gather from observation and pure guesswork, is that this machine
revision extremely picky with what it accepts as a keyboard during start.
This isn't really a problem 99% of the time, since the OS provides
capable USB drivers, but that doesn't help me. (Actually, I later found
out that you can disable auto-boot from within OS X by using the `nvram`
utility (`nvram auto-boot\\? false`) so that you are dropped into Open
Firmware without the key combination. I'm not sure the keyboard will
magically be accepted, but it could always be worth a try.)
So off I went to source an older Apple USB keyboard.

Once I got the keyboard, I finally got to the OF prompt and turn off
auto-boot. Great. Now what? Boot medium, that's what. A minimal disk
image burned onto a good old CD-rom and I'm feeling right at home
circa 2002. Punching in `boot cd:,\\ofwboot.xcf netbsd.macppc` and I'm
soon greeted with a shell. Excellent!

What I did at this point is best summarized by Kamil Rytarowski's
[excellent walkthrough](https://mail-index.netbsd.org/port-macppc/2013/09/27/msg002002.html) posted in the port-macppc
mailing-list. There are a few caveats I'd like to add to step 6:

 * When dealing with internet access, I never managed to get `dhclient`
   or `dhcpclient` to work, and I ended up configuring the interface
   (`gem0` in my case) manually:
   `ifconfig gem0 netmask` and
   `route add default`.
 * I had trouble understanding what "fetch pkgsrc" actually entailed
   until I stumbled over [this article](https://www.netbsd.org/docs/pkgsrc/getting.html).
 * Either mount the CD and copy `ofwboot.xcf` onto the HFS partition
   or download it from the [FTP](ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/macppc/installation/).
   Bootloaders from earlier releases can be found under [NetBSD-archive](ftp://ftp.netbsd.org/pub/NetBSD-archive/).

Now the system is technically working, but you still need to punch in
`boot hd:,\\ofwboot.xcf hd:4,/netbsd` everytime you power on.
I did the following in the OF prompt:

    0 > setenv boot-device hd:,\\ofwboot.xcf
    0 > setenv boot-file hd:4,/netbsd
    0 > reset-all

...which makes the `boot` word do the right thing.

Well, except for the fact that it appears that OF doesn't hand off a
proper display mode for some reason. It's super strange, since I had
no problem when booting from CD. So right now, I get a [black screen](ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/macppc/INSTALL.html#Black screen)
whenever I boot from HD. It doesn't bother me, since I'm only accessing
the machine through SSH, but it's still weird. Also, I didn't manage to
get auto-boot to work correctly either, which may or may not be an
error on my side.

Regardless the quirks, I now have a first gen Mac Mini living happily
ever after on my desk. :)

*Update a few months after*: It stopped answering my SSH calls and
started to smell like burning electronics, so I promptly shut it down
and declared it dead.

<3 jzp