OpenBSD on a G4 Cube

I just finished installing OpenBSD on my Power Mac G4 Cube and wanted to write down my steps to success in case anybody else out there ever runs into the same issues I had. For the tl;dr version, skip down to the “NFS Success” section.

First, some back story. I’ve had my Cube for several years now, though I did not buy it new. When my Cube first arrived, I ordered it a brand new 200GB IDE hard drive. I found a 200GB Maxtor that was not quite as cheap as I’d been hoping since by that time SATA had taken over and IDE drives were getting a bit difficult to find. On a side-note, I discovered that people are making IDE SSDs
which is just wild. Must. resist. temptation. to. put. SSD. in. my. Cube…

When I began my Cube experience, Apple’s planned obsolescence was well into effect and the latest version of Mac OS X had dropped support several years prior. Happily, the FOSS community continues to support these older machines even now. The first OS I installed on my Cube was Debian Linux. I derive some kind of perverse joy from running current software on a computer that came out in 2000 and whose original vendor has long since discontinued support. It’s just cool — sort of like sticking it to the man. It shows the power of FOSS. Nobody can make a computer obsolete when it’s running an open source operating system. It also shows why Intel has such a vested interest in proprietary software. If some start-up were to arrive on the scene with a new, better CPU, there would be nothing to stop the market from shifting away from Intel if the world ran on FOSS. But I digress.

I had actually not been using the Cube for the past few years. It had crashed (though, I now believe this was a freak, one-off occurrence), and it scared me since the Cube was hosting my production Subversion installation. So, I moved Subversion over to a more modern computer and put the Cube on a shelf. But, then, about a month ago, I saw this: Debian GNU/Linux 9 “Stretch” to Drop Support for the PowerPC (PPC) Architecture
. Well, I couldn’t abide that. My Cube may not have been powered on, but I always knew that, with an internet connection and a couple commands, I could have it back online and updated. So, I began looking into my options.

In the intervening years since I first installed Debian on the Cube, my favorite FOSS operating system has become OpenBSD. I actually ran it on my primary work machine for about 6 months which was a fun challenge. (and the subject of another post some day). Happily, OpenBSD still officially supports PowerPC Macs. Moreover, OpenBSD hasn’t bloated up like Linux has in recent years (… systemd … ), so it figured to actually run reasonably well on the Cube.

The Task at Hand

If you haven’t installed OpenBSD before, it’s normally a very straight-forward process. I wouldn’t recommend it for novices, but if you understand Un*x-like operating systems, disk partitioning, and you read through the awesome OpenBSD documentation, it’s really a cinch. Normally. As I came to discover, my Cube wasn’t going to provide me with a typical OpenBSD install experience.

The first sign that there were going to be bumps along the road was when I stuck the new newly-burned install CD into the Cube’s CD-ROM drive. Sadly, the Cube’s CD-ROM drive has gone up to the big computer part bin in the sky. This is especially sad because the CD-ROM drive was a show-stopper in Steve Jobs’s original G4 Cube keynote address
. But also sad because OpenBSD doesn’t support booting PowerPC Macs from USB thumb drives. According to the documentation, you can boot OpenBSD/macppc in one of the following ways:

  • CD-ROM
  • FFS partition (i.e. an existing OpenBSD installation)
  • HFS partition (i.e. an existing MacOS installation)
  • Remote NFS partition
  • HTTP

That last one is a bit misleading. You can download the install sets from HTTP, but you can’t boot from HTTP. CD-ROM was out. FFS was out since you have to have OpenBSD already running. HFS was out since the machine had been running Linux, not MacOS. So that left me with NFS. And, ominously, the documentation gives this notice to those who wish to use NFS:

NOTE: This method of installation is recommended only for those already familiar with using BSD network configuration and management commands. If you aren’t, this documentation should help, but it is not intended to be all-encompassing.

Gulp…

Not to be deterred, I proceeded on anyway. There is a scant amount of documentation on NFS booting in the install instructions as well as some more in the diskless(8) man page, but the later is not macppc-specific. I was ultimately successful booting NFS, but not before I tried many, many unsuccessful alternatives.

Fail #1

This actually occurred after several failed NFS attempts, but I’m going to take these out of order, like I’m Quentin Tarantino. At my office, there is a room that is basically a PC graveyard with all sorts of defunct hardware. One of the things in there was an old Dell tower — old enough to have an IDE hard drive and, more importantly, an IDE CD-ROM drive. My first idea was to try and attach the Dell’s CD-ROM drive to the Cube’s IDE ribbon cable and try booting from that. After a 24-hour delay for ordering a Torx T10 screwdriver off Amazon, I was in business. Except that it wouldn’t boot. I’m still not sure why. I tried switching the drive’s jumper switch from cable select to slave and that seemed to get the drive to show up in OpenFirmware, but it wouldn’t boot.

Fail #2

My next brilliant idea was to install OpenBSD on the Dell, hook up the Cube’s IDE drive to the Dell, format the drive FFS and copy the PowerPC bootloader and install files to the Cube’s hard drive and try and boot from the internal hard drive. The instructions mention that the installer creates a 1MB DOS partition for the bootloader when a Mac hard drive is single-booting OpenBSD. So, I went and looked at the source code for the OpenBSD/macppc install script and found the line where the partition is created

echo -n "Creating a 1MB DOS partition and an OpenBSD partition for rest of $_disk..."

dd if=/dev/zero of=/dev/r${_disk}c bs=1m count=1

I ran that command, formatted the partition (newfs -t msdos $wd1i), copied the bootloader over. I then created an OpenBSD disklabel partition, and an FFS partition and copied the kernels and tarball sets across. I then patted myself on my back for being so clever.

Of course, that didn’t work either. The Cube was able to load the bootloader, but I couldn’t get it to find the bsd.rd kernel on the FFS partition. One of the commenters at [email protected] thinks this was because the FFS partition was formatted on a Little Endian (i386) machine and the PowerPC is Big Endian. So, yeah…

NFS Fail

So, back to NFS. NFS was actually the first thing I tried since it is an officially supported installation method. I didn’t (yet) have a second OpenBSD machine to use, so I installed NFS on my laptop which is running Debian. My mistake is that the Debian implementation of NFS didn’t cooperate with OpenFirmware. Might have been user error, but, regardless, setting NFS up in Linux is quite a bit more complex than it is in OpenBSD, especially considering OpenBSD’s great instructions
.

NFS Success

But that’s enough about what didn’t work. I finally stumbled onto a winning formula. First of all, booting NFS on OpenBSD/macppc requires three components. (The documentation doesn’t make this entirely clear, especially if you read through diskless(8).)

  1. DHCP (/BOOTP)
  2. TFTP
  3. NFS

The DHCP server gives the Cube its IP address, it then loads the bootloader (which is a file called ‘ofwboot’) via TFTP. And then it points the bootloader to an NFS share which contains the kernel. I knew DHCP and TFTP were working on my Linux laptop since I was able to get into the bootloader. DHCP and TFTP need to be running on the same server, but NFS can be elsewhere. As soon as I moved my NFS server to my OpenBSD Dell, things started working for me. If I was starting from scratch, I would run everything from an OpenBSD server.

Here is my dhcpd.conf: (/etc/dhcpd.conf) I was running Linux isc-dhcp-server, but the configuration is the same for OpenBSD dhcpd:

allow booting;
allow bootp;
authoritative;

host cube {
    next-server x.x.x.x;
    option subnet-mask 255.255.255.0;
    option routers x.x.x.x;
    option root-path "/srv/obsd62";
    fixed-address x.x.x.x;
    hardware ethernet xx:xx:xx:xx:xx:xx;
}

‘next-server’ is the IP address of the NFS server. ‘routers’ is the IP of your internet gateway (you’ll need this if you want to download anything from the internet during the installation process). ‘root-path’ is the path to the NFS share (should match your share in your exports file). ‘fixed-address’ is the IP you want to assign to the computer running the install. And, finally, ‘hardware ethernet’ is the MAC address of the Mac’s ethernet card (which you can look up in OpenFirmware:

0 > dev enet
0 > .properties
[...]
    local-mac-address ......
[...]

You’ll then need to set up TFTP (which is honestly just as simple as creating a directory (e.g. /tftpboot) and running “tftpd /tftpboot” as root). Copy the bootloader (ofwboot) into your tftp share and everything else from the macppc distribution folder to your NFS share. (As of version 6.2, all of the files in: http://ftp.openbsd.org/pub/OpenBSD/6.2/macppc
)

I should mention before you get started that you should make sure there is only one DHCP server running on your network. In other words, if you network is like almost any network, you should probably disconnect your OpenBSD server and the Mac from the rest of the network until the OpenBSD install kernel is booting so you don’t have competing DHCP servers. Once the kernel is booting, you can shut down the DHCP server (rcctl stop dhcpd) on the server and hook the machines back into the network if you need Internet access during the install.

Once you’ve booted into OpenFirmware (hold down Cmd-Option-O-F after powering on the computer), you just need to type:

0 > boot enet:,ofwboot /bsd.rd

and you’ll be booting. Everything else you need is covered in the excellent INSTALL.macppc instructions.

The OpenBSD/macppc Experience

I’m really happy that I’ve gotten OpenBSD running on my G4 Cube. That said, before you launch into a big project, there are some things you should be aware of. First, not all of the ports that are available for OpenBSD/amd64 or /i386 are available on PowerPC. A couple big ones are missing… Firefox, Thunderbird, GIMP, LibreOffice, Gnumeric. None of those run. Since Chrome’s V8 javascript engine has some x86-specific code, Chome (and Chromium) is out as well. As far as I’m aware, there is no webkit or gecko-based web browsers that run at all on OpenBSD/macppc. The best thing I’ve found so far is Netsurf which has its own rendering engine. Netsurf is a currently-maintained project, but it’s a far cry from webkit and gecko-based browsers.

But, if you’re like me, this is OK because I plan to primarily run the Cube as a server and all of the server programs I’ve looked for are there and functional. If you like hacking on things, be sure to join the [email protected] mailing list and start working on Firefox!

Lobsters稿源:Lobsters (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » OpenBSD on a G4 Cube

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录