How to netboot and install NetBSD/sparc

Preface

I've got a Sun SparcStation IPX which I want to install NetBSD on. This old machine has neither a cdrom nor an USB connector (USB was invented several years after these machines hit market). You could hook up an external SCSI cdrom or a tape drive, but I have neither of them. Thus netbooting the installer remains the only choice. The steps described below work out for NetBSD 6.0.1, 5.2, 4.0.1, and 3.1.1. My IPX has quite an old OpenBootProm (OBP, the "bios" of Sparc machines) which boots neither 4.0.1, 5.2, nor 6.0.1 from disk. Netbooting these releases works fine, though. That's why I had to stick to 3.1.1.
The installer of NetBSD (sysinst) has an option to update an already installed system. This howto describes the steps which are neccessary to netboot the installer. Following these steps you should also be able to update your system.

Requirements

Steps

  1. If you downloaded the iso, mount it:
    mount -t iso9660 -o ro,loop /path/to/NetBSD-6.0.1-sparc.iso /mnt
  2. Create a directory that will serve as tftp area:
    mkdir /tftproot
  3. Copy boot.net to /tftproot/:
    cp -iv /path/to/boot.net /tftproot/
  4. Check whether your Sparc box has a SUN4M or a SUN4C based architecture. For this, you might visit http://www.netbsd.org/ports/sparc/. For instance, an IPX is a SUN4C while a JavaStation is a SUN4M
  5. Calculate the hexadecimal representation of your Sun's ip address, e.g. my IPX uses 192.168.0.22 which is C0A80016 in hex. You can use this command:
    printf %02X%02X%02X%02X 192 168 0 22
  6. In /tftproot, create a symlink like this:
    ln -s boot.net C0A80016.SUN4C
    Of course you should replace that hex ip address and architecture to match yours.
  7. Start rarpd manually as there isn't an RC script for this on Gentoo:
    rarpd -e -v -b /tftproot eth0
    Depending on your bootserver's hardware, you might replace eth0 by the appropriate interface
  8. Start atftpd:
    /etc/init.d/atftp start
  9. Edit /etc/dhcp/dhcpd.conf. At the bare minimum it should contain something like this:
    subnet 192.168.0.0 netmask 255.255.255.0 {
      range 192.168.0.100 192.168.0.110;
    }
    host ipx {
      hardware ethernet 08:00:20:C0:FF:EE;
      fixed-address 192.168.0.22;
      next-server 192.168.0.10;
      option root-path "/data/netbsd";
    }
    
  10. Start dhcpd:
    /etc/init.d/dhcpd start
  11. Create the directory that will serve as the netbooted kernel's root directory:
    mkdir /data/netbsd
  12. Copy netbsd-GENERIC.gz (the NetBSD kernel) to that directory:
    cp /path/to/netbsd-GENERIC.gz /data/netbsd/
  13. Create a symlink called netbsd so that the network bootloader will pick up the kernel:
    ln -s netbsd-GENERIC.gz /data/netbsd/netbsd
  14. Extract the root filesystem (the --numeric-owner switch is important!):
    tar -C /data/netbsd --numeric-owner -xvpSf /path/to/rootfs.tgz
  15. Make the install sets available underneath the root directory:
    cp -aiv /path/to/binary/sets /data/netbsd/
  16. Export the root directory with NFS. Add to /etc/exports:
    /data/netbsd	192.168.0.22(rw,no_root_squash,no_subtree_check)
    
  17. Start NFS:
    /etc/init.d/nfs start
  18. Connect a keyboard and a monitor to your Sparc box, or use a serial connection
  19. After powering on, press Stop+A (Ctrl+A+F in minicom) to escape to the OBP prompt
  20. At the prompt, type boot net
  21. When the kernel and sysinst have been loaded, you can install NetBSD to disk
  22. During the installation, choose Local directory as source media to install from. As base directory enter /, whereas the set directory should be /sets.