💾 Archived View for ecs.d2evs.net › posts › 2020-01-13-PowerBook-G4-OpenBSD.gmi captured on 2022-07-16 at 13:38:32. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
TL;DR:
dd if=openbsd.iso of=/dev/sdb
boot hd:,\ofwboot /6.6/macppc/bsd.rd
I recently found an old computer lying around in my house -- an old 17" PowerBook G4 (A1085, or 5,5). It had stopped working years ago, but with a new charger, I got it to boot to OS X. However, I wanted to run an open-source OS on it.
32-bit PowerPC is old enough that practically no-one still supports it. I ended up choosing OpenBSD, because I managed to boot it before I managed to boot NetBSD or FreeBSD, and I didn't want to have to deal with Gentoo's compilation hell on a computer that old.
I downloaded the OpenBSD install ISO, and got to work. The first challenge was booting to it. The CD drive wasn't working, so I couldn't boot from there, and for whatever reason, OpenFirmware would hang whenever I tried to boot from a USB.
So I booted to MacOS (which could read the USB) and used it to copy the contents of the ISO onto the HFS partition.
It worked... almost. I realized my mistake as soon as I had repartitioned the hard drive. The sets (gzipped tarballs that are untarred over the new root) were on the now-destroyed HFS partition. In addition, I had completely messed up `/dev` earlier (by running `sh /dev/MAKEDEV all` and running out of space on the ramdisk), so I wasn't able to copy over sets from my USB. I ended up accidentally killing my shell without a `/dev/console`, leading to a wedged system.
However, I still had the OpenBSD kernel running, so I was hoping that maybe, just maybe, if I hot-swapped the hard drive...
So I pulled out a stick of RAM, unplugged the internal keyboard, and it must have touched some circuit because there was a flash and magic smoke was leaking out of the logic board. I quickly unplugged it and removed the battery (thank God for easily removable batteries!).
Note to future self: DO NOT try to take apart a computer while it is running!
When I turned it on, it no longer chimed on boot, but was otherwise unharmed.
However, I still had a bit of a problem. I needed to boot to OpenBSD, but I had no way of booting a CD or USB, and the hard drive was wiped.
Thankfully, a quick `dd if=openbsd.iso of=/dev/sdb` after plugging the hard drive into my computer worked, and the installer booted just fine from there:
boot hd:,\ofwboot /6.6/macppc/bsd.rd
This time, I made sure that I could access the sets before I partitioned the hard drive. After putting the ISO in the first partition of an MBR, I was able to mount `/dev/sd0i`. Success! Now I just had to finish the installer, and reboot.
Not so fast. The install didn't work, and I wasn't able to debug because I wasn't able to mount the OpenBSD partition on Linux. So I re-installed the installer (by this point, I was quite proficient at taking the PowerBook apart), reinstalled OpenBSD, and got a shell after the install process, in order to see what was going on.
It went fine, but my custom partitioning had put the kernel in the second partition (with the first partition being swap), which apparently confused the bootloader. Once I fixed that, it worked!