Netbooting a SUN SPARCstation - CIF-Rochester/wiki GitHub Wiki
Welcome to the guide on how to diskless Netboot a Sun SPARCstation! This particular procedure was designed around diskless netbooting NetBSD 11 on a SPARCstation 10, for it was what we had on hand. This process should work on neigh all sun4m machines (And, much of this wiki page beyond that scope).
At various points in this document, you may see references to valor or balrog. These are the names of our netboot server, and SPARCstation 10, respectively. Feel free to change those names as you see fit. Consequently, you may see reference to cif.rochester.edu, which is our domain as the Computer Interest Floor.
Time to begin! : )
An Operating System
First things first, you will need to acquire a copy of an OS that will run on 32 bit SPARCstations. Due to the fact that these have not been manufactured in neigh on 30 years, you have limited options. I'd recommend NetBSD, for it is basically the only that still supports sparc32, and is the easiest to work with than many of its alternatives.
A note on Linux...
Linux versions that support 32 bit SPARC are limited (Especially since the Linux Kernel dropped support back in 2023 for the architecture), so you are effectively limited to Debian 4 (Released in 2007, and EOLd in 2010, Aurora SPARC Linux (Which has not had an update since 2007), and Red Hat Linux 6.2 (Not RHEL, and also from 2000).
So, in effect, you are quite limited when it comes to choices in the first place.
Beyond that fact, Linux distributions from this era on this platform make use of the "SILO" bootloader. A marvel of computer science for it's time, to be sure, but very... antiquated. Though technically able to be served via TFTP, there seems to be a little error when it comes to doing this in practice, where it does not request the appropriate silo.conf file (Which was confirmed via tcpdump). Consequently, telling SILO where the kernel is, and how to get it is very much impossible.
Alternatively, you can bypass SILO, if you take the linux kernel, uncompress it, then convert it to an a.out binary for SPARC, then serve that via TFTP, which mostly works, but is missing access to the initrd ramdisk, so won't have access to NFS, and will consequently kernel panic. In theory an application called "piggyback" can resolve this, but it seems to be very antiquated, and has not been tested by us for this purpose.
So, all-in-all, Netbooting Linux is... difficult, and comes with limited benefit. You can try it, if you so desire, however. If it works, please let us know how! (I've spent many moons wrestling with this problem...)
A note on SunOS.
SunOS was the operating system that our SPARCstations likely originally used, as it was the one SUN produced and maintained. Although this is cool, it's a very antiquated operating system, with no modern comforts. It is as bare-bones as one can get when it comes to operating systems, and requires quite a bit of extra setup beyond what NetBSD needs. In particular, since SunOS predates DHCP, it has to use a program called Bootparamd. Unfortunately, a bug exists in Bootparamd (Unless you are on Debian on i686/i386 prior to Debian 9, in which case the bug does not exist), which makes the server not server the proper information. This has not been tested on NetBSD, so it is possible it will work properly there, but a note of caution is warranted when it comes to SunOS.
So, this leaves NetBSD
NetBSD is a great operating system. If you're thinking of having some fun, try it! It supports pretty much everything since the Vax 11/780 was released (Including our humble Sun SPARC), and just kind of... works.
An Operating system... continued!
So, presuming you've chosen NetBSD...
You can download NetBSD for SPARC here: https://wiki.netbsd.org/ports/sparc/.
NetBSD-11.0-sparc.iso is the name of the file you will likely be downloading (Unless NetBSD has updated since this document has been written)
Once you grab that ISO image, you will need to emulate a SPARCstation via QEMU to install it to a hard drive, which we can then, in turn, serve to our real sparcstation. I will presume that you are doing this step on a 64 bit computer, running linux (I know both Arch Linux and Debian support this, since I have done this on both).
This is done in two commands:
The first one creates a new qcow2 drive for you to install NetBSD to.
qemu-img create -f qcow2 netbsd-sparc.qcow2 10G
The second one starts up a new emulated VM, and allows you to install netBSD.
qemu-system-sparc -M SS-10 -m 128 -nographic -drive file=netbsd-sparc.qcow2,if=scsi,bus=0,unit=0,media=disk -drive file=NetBSD-11.0-sparc.iso,format=raw,if=scsi,bus=0,unit=2,media=cdrom,readonly=on -boot d
This will start bring up the NetBSD installer inside of your terminal window. If you prefer, you can get rid of the -nographic tag. Supposedly this works on QEMU now, but it's normally safer to include it for most things, especially given we'll be interacting with our physical SPARCstation almost exclusively via Serial.
Go through the standard installation. For our applications, we can create a new user, add them to wheel, enable ntp and ntpdate, and that's pretty much all that needs to get done!
Once NetBSD has been installed to that qcow2 drive, you'll need to mount it to your computer, so you can access the files on it.
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 netbsd-sparc.qcow2
Then, you'll likely need to look at partitions. I don't remember precisely, but I believe, by default NetBSD installs in two partitions, one for / and one for swap. You will only need the first of these. It will be the larger of the two partitions.
lsblk /dev/nbd0
Then, of course, mount it!
sudo mount /dev/nbd0p1 /mnt
Once here, you will have to tarball the entire drive, so you can move it over to the server.
sudo tar -czvf NetBSD.tar.gz /mnt
You will also need one file from the installation CD.
I'd recomment you unmount the qcow2 drive
sudo umount /mnt
Then, mount the iso to /mnt
sudo mount NetBSD-11.0-sparc.iso /mnt
The file you need will, then, be at /mnt/installation/netboot/boot.net
Pretty cool, isn't it. You will need to move this .tar.gz file over to our netboot server at some point, and the boot.net file. This can be done with either scp, ftp, sftp, a flash drive, or any other method to which you may wish to use.
It's server time, baby!
Netbooting a Sun SPARCstation from a server has very few requirements for that server, namely the ability to run a TFTP server, a DHCP server, a RARP server, and an NFS server. For the sake of ease, NetBSD was used for this. All of these things ship with NetBSD, which makes it nigh on the ideal operating system for this purpose. Good on you NetBSD! : )
We've also had some success with doing this from Debian. Some file names, packages, and other such things may differ from the below sections if you choose to use Debian (or some other POSIX-compliant OS), but the basic procedure is the same.
A Client Operating system within another operating system??!?!?!
Once you have your server set up, you will need to copy over that tarball you made earlier from the emulated SPARCstation. NetBSD supports scp, so that's probably the easiest to utilize. Once it's on your server, make a new directory /sparc and untarball the file into that directory. You will also need the boot.net file from earlier.
tar -xvf NetBSD.tar.gz -C /sparc
RARP
The SPARCstation, once it's turned on (and "boot net" has been called), will want to get an IP address. The way it does this is by making a RARP request. Basically, it's telling everyone what its MAC address is, and waiting for something to broadcast back with an IP it should use. This was pretty common many moons ago, but, as a protocol, has fallen mostly by the wayside.
on NetBSD, you will need to edit the /etc/ethers file, adding a line to it. This links our MAC address to our IP address.
08:00:20:11:3A:08 $$$.$$$.5.101
Then, start rarpd (This is optional, for we'll be editing it so it starts on startup).
/usr/sbin/rarpd -a
TFTP
Once the SPARCstation has an IP, it then tries to pull a file from our netboot server via the Tiny File Transfer Protocol (TFTP), and tries to execute it. This is mainly just a bootloader, with the ability to get information from DHCP, mount things via NFS, and kickstart the next stage of the booting process.
Edit /etc/inetd.conf and remove the # from the following line.
tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot
From here, you will need to take the boot.net file from the NetBSD installation disk and copy it into /tftpboot, with a new name, which corresponds to the IP address in hex, followed by .SUN4M.
For our setup, this will be the following:
C0A80565.SUN4M
You can kill the inetd process to make it re-read that file if you so desire, with the following commands. Of course, note that this is not strictly necessary, since you will be rebooting the computer anyways.
ps -aux | grep inetd
Phere the PID is process,
kill $PROCESS
DHCP
Once this is loaded, we need to configure a DHCP server to give our bootloader information as to what comes next,
Namely, on NetBSD, this can be done by editing the /etc/dhcpd.conf file to include the following:
allow booting;
allow bootp;
allow unknown-clients;
subnet $$$.$$$.5.0 netmask 255.255.255.0 {
option routers $$$.$$$.5.1;
option domain-name-servers ###.###.220.29;
range $$$.$$$.5.10 $$$.$$$.5.100;
}
host balrog {
hardware ethernet 08:00:20:11:3A:08;
fixed-address $$$.$$$.5.101;
next-server $$$.$$$.5.1;
option root-path "/sparc";
}
You can kill dhcpd and restart it as you've done the previous things, but this is not necessary, given how you will be rebooting the machine.
NFS!
Once everything knows where everything is, we can get into the last step, which is the Network File System, or NFS. This allows us to share the / directory to our client machine, so NetBSD can run! : )
Edit /etc/exports and add the following line
/sparc -maproot=root -network $$$.$$$.5 -mask 255.255.255.0
You can restartd nfsd and mountd in similar ways as before, but this is not strictly needed.
NPF
NPF is the Network Packet Filter on NetBSD. It's what makes the SPARCstation have internet, since it's on it's own private network with the netboot server, for our purposes.
$ext_if = "vr0"
$int_if = "tlp0"
$localnet = $$$.$$$.5.0/24
map inet4($ext_if) dynamic $localnet -> inet4($ext_if)
group "internal" on $int_if {
pass in final all
pass out final all
}
group "external" on $ext_if {
pass in final all
pass out final all
}
group "loopback" on lo0 {
pass final all
}
group default {
pass final all
}
sysctl nonsense
In order to make our Netboot machine be a router for our SPARCstation, we need to add something to sysctl to make ip forwarding work.
Edit /etc/sysctl.conf, and add the following line,
net.inet.ip.forwarding=1
Some rc.conf configuration, and other nonsense.
Now that we've set pretty much everything up, we need to set some stuff up on our NetBSD netboot server such that everything we need will be configured properly on startup, and so that all the applications will be started properly.
Your /etc/rc.conf file should look like this:
# $NetBSD: rc.conf,v 1.97 2014/07/14 12:29:48 mbalmer Exp $
#
# See rc.conf(5) for more information.
#
# Use program=YES to enable program, NO to disable it. program_flags are
# passed to the program on the command line.
#
# Load the defaults in from /etc/defaults/rc.conf (if it's readable).
# These can be overridden below.
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
fi
# If this is not set to YES, the system will drop into single-user mode.
#
hostname valar.cif.rochester.edu
rc_configured=YES
defaultroute="$$$.$$$.3.1"
ifconfig_vr0="$$$.$$$.3.200 netmask 255.255.255.0"
ifconfig_tlp0="$$$.$$$.5.1 netmask 255.255.255.0 media 10baseT"
ping $$$.$$$.5.50 > /dev/null 2>&1 &
# Add local overrides below.
#
sshd=YES
wscons=YES
ntpd=YES
ntpdate=YES
nfs_server=YES
mountd=YES
rpcbind=YES
rarpd=YES
dhcpd=YES
ipforwarding=YES
npf=YES
Of not here is the ping. This is a little bit of a stupid workaround, but it allows the link that is sharing things to the SPARCstation to never go dead. Also note that the media option of the interface serving to the SPARCstation is limited to 10baset. This makes things more reliable, and doesn't affect performance too much given how the link is limited to a 10baset connection on the SPARCstation's side.
Although the above limitation is not strictly necessary (Since we have a switch between the SPARCstation and the netboot server), it's still helpful for reliability's sake. Most everything else is just making sure everything else starts properly.
Then, you will need to edit /etc/hosts
127.0.0.1 localhost valor valor.cif.rochester.edu localhost.
$$$.$$$.5.1 valor
$$$.$$$.5.101 balrog
On the Client OS...
Some things have to be modified in /sparc before everything will work properly.
hosts
First and foremost, you will have to edit /etc/hosts, to make sure the following lines are present and proper.
127.0.0.1 localhost localhost.
$$$.$$$.5.1 valor valor.cif.rochester.edu
$$$.$$$.5.101 balrog.cif.rochester.edu balrog
fstab
Next, you will have to edit /sparc/etc/fstab. This means you should remove the cdrom row and the hard drive row, in favor of NFS.
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
valor:/sparc / nfs rw 0 0
kernfs /kern kernfs rw
ptyfs /dev/pts ptyfs rw
procfs /proc procfs rw
tmpfs /var/shm tmpfs rw,-m1777,-sram%25
rc.conf
Next, you should modify /sparc/etc/rc.conf a little bit to make things more optimized. There is a lot of documentation on how to do this on NetBSD, so feel free to look at that.
For some reason, on our system, we could not find a set of things in rc.conf to enable multiuser mode to function with any degree of speed. So, we force single-user mode, temporally, until someone can find a combination of things that allow multiuser mode to function properly.
To do this, edit /sparc/etc/rc.conf, and set the following to be true.
rc_configured=NO
This disables any rc.conf configuration, so is a little bit of a hacky workaround.
ttys
You should make sure that the serial port is enabled for the type of terminal we will be using. Since we don't have a keyboard for our SPARCstation as of yet, we interact with it through either Windows 3.1's terminal app, or by way of a dummy terminal.
To make sure this is working properly, you should edit /sparc/etc/ttys, to make sure the following line looks like this:
ttya "/usr/libexec/getty std.9600" vt100 on secure
Since our dummy terminal is not vt100 compatible, it's worthwhile editing that to unknown, or some other value. But, given how the terminal is, at present, broken, setting it to vt100 is fine, and probably recommended, since it's what Windows 3.1 supports.
REBOOT THE NETBOOT SERVER
Exactly what I said. You should reboot the netboot server now.
On the SPARCstation.
Since our SPARCstation has a bad battery, and consequently cannot store MAC address properly, you need to set the MAC address byte-by-byte, then tell the computer to boot via net. Once all of the RAM has been checked, you will arrive at the openfirmware OK prompt. (Denoted by "ok"). From here, you will have to run each of the following commands (Not typing in ok at the beginning).
ok 1 0 mkp
ok 72 1 mkp
ok 8 2 mkp
ok 0 3 mkp
ok 20 4 mkp
ok 11 5 mkp
ok 3A 6 mkp
ok 8 7 mkp
ok 0 8 mkp
ok 0 9 mkp
ok 0 a mkp
ok 0 b mkp
ok 11 c mkp
ok 3a d mkp
ok 8 e mkp
ok 0 f 0 do i idprom@ xor loop f mkp
boot net
If you are on Windows 3.1, it is possible to send a txt file by way of typing it character by character. This method saves much time, and will likely be implemented via a Raspberry pi or Arduino in the future to allow for this ease of use.
After it checks its RAM, and does another POST check, it should start booting properly into NetBSD 11.
Congratulations! You now have a functional, diskless, NetBSD setup on a SPARCstation 10! Have fun with it! : )