Synopsis

Booting NetBSD on macppc systems with OpenFirmware 3 can be cumbersome depending on the particulars of the hardware and usage goals. As it stands, a typical boot on a Mac Mini has the machine boot into the OpenFirmware console, at which point the console operator types boot to get the NetBSD boot process actually started.

If, however, one is looking for a setup where the machine can boot unattended, or where multi-boot is a goal, the basic setup is insufficient. Fortunately, the tools to change this exist within NetBSD.

Multi-Boot

OpenFirmware 3 has multi-boot built-in, however, the basic NetBSD/macppc setup does not play well with it. Also, one often overlooked detail in partitioning and system installation is the type of the partition where ofwboot.xcf (or ofwboot.elf, if one must) resides. While the filesystem of the partition does need to be HFS or HFS+, the type (as seen with pdisk) doesn't need to be Apple_HFS, and changing this can provide a bit of safety on a machine handled by other than experts. In other words, setting the type to Apple_Boot keeps it Out of sight, out of mind.

Using the setup presented here enables having NetBSD show up as a bootable system within OF3's multi-boot. It is, however, currently limited in that it shows up as unlabled and just using the generic icon. Extending this to at least apply the NetBSD logo should be relatively simple though, should anyone know the icon format used.

Full Auto-Boot

With the basic setup, and with auto-boot? set to true, NetBSD on a Mini unfortunately boots with the display off. If X11 is working, it will activate the display as it comes up, but as of 5.99.30, X11 is still a work in progress on macppc.

Enabling the display without booting into the OF console can be done with a line of OF script, but the usual method of storing this in nvram does not necessarily work well with a multi-boot setup. In addition to another OS present possibly rewriting nvram to its own needs, occasionally the system gets into a state where flushing the PRAMs becomes the most practical way forward, and OF settings and nvram scripts then need some work to restore.

Requirements

On NetBSD, applying a solution to all this requires only the installation of sysutils/hfsutils, and working through something like the following process. Although this article does go into some detail to help less experienced readers through the process, it is still written to draw on strong familiarity with the standard NetBSD/macppc installation process, and may require some adjustment to work in a step by step manner.

This process will create a partition image that is:

ofrc is an OpenFirmware script that can be used to perform additional initialization tasks before booting. Screen initialization is a common example. Note that the following example assumes that Apple_Boot is partition four and NetBSD root is partition five. Adjust as necessary for the target system.

ofrc can also contain a section for an icon, but I don't know the format.

Contents of ofrc

<CHRP-BOOT>
<COMPATIBLE>
MacRISC MacRISC3 MacRISC4
</COMPATIBLE>
<DESCRIPTION>
NetBSD/macppc boot initialization
</DESCRIPTION>
<BOOT-SCRIPT>
" screen" output
boot hd:4,\ofwboot.xcf hd:5,/netbsd
</BOOT-SCRIPT>
</CHRP-BOOT>

Process

The sample image built here is 1600 sectors—the same size as a low-density Mac floppy. It doesn't have to be this size, but it does have to match the Apple_Boot partition it will become. It also has to be large enough to contain ofwboot.xcf and ofrc (which may contain an icon). Other names used here, like the name of the file—nbboot—and the volume name are also arbitrary, and readily changable.

Partition Image

  1. dd if=/dev/zero of=nbboot bs=512 count=1600
  2. hformat -l "NetBSD" nbboot
  3. hmount nbboot
  4. hcopy ofrc :
  5. hcopy -r ofwboot.xcf :
  6. hattrib -t tbxi ofrc
  7. hattrib -b :

Note that the key steps in getting this to work with auto-boot are the two hattrib lines. These set ofrc and the directory it's in so that OF3 will find and open it when boot-device is hd:,\\:tbxi (the default) or similar.

Target Disk

Next step is to prepare the disk on the target system. After partitioning with pdisk (ensuring the size of the Apple_Boot partition for NetBSD matches the image), get the partition image available to the target system (on another partition, over the network, etc.) and write the image to the Apple_Boot partition. This is done with dd or similar tools, of which dd is available in the standard installer. Also, double-check the mapping between pdisk partition numbering, and disklabel partition names (wd0a, etc.). E.g., pdisk partition 4 may map to wd0f, in which case installing the image would be done with: dd if=nbboot of=/dev/wd0f

After the image is in place, NetBSD can boot with OF variables set to default, and will work with multi-boot.