If you're only interested in the implementation, skip ahead to SETUP.
A Little History
I started my UNIX career at the US National Institutes of Health (NIH). When I first started there, in 1992, I was a student intern with the Office of the Director. I returned, as a student assistant computer specialist, in 1995. At that time, I was given access to an amazing variety of state of the art equipment, including a pair of Sun SPARCstation 2s and a SPARCstation 10, which were exclusively for my use. Given the time period, I installed Solaris 2.x on them, starting with release 2.5. There were still machines around, mostly SS1, SS1+, and SS2 models, running SunOS 4.x, but I didn't have much interaction with them. They were mostly AFS (Andrew file system, an early distributed filesystem standard, created by Carnegie Mellon University) hosts, and were old tech, to me. So, while I saw fellow employees using them, I didn't pay a lot of attention to how they worked.
Interest Surfaces
I have always had an interest in what would be considered vintage equipment, since I didn't have the means to purchase state of the art machines. The first UNIX box that I personally owned was a DECstation 5000/120 that I purchased from Terrapin Trader, the surplus sales group at the University of Maryland, College Park. That machine didn't come with a complete operating system, so I quickly located The NetBSD Project, and the nascent pmax port, just before its first release, in NetBSD 1.1. I did some basic testing, and got my system working around November of 1997. This was my first real interaction with BSD UNIX, in any form. I quickly came to appreciate the extremely open and collaborative nature of NetBSD, and have enjoyed it, in many forms, from then until now. My interest in NetBSD led to investigations into the history of BSD, in general, and to my presentation on "Unusual UNIXes" at the Vintage Computer Festival East 2019.
Setup
So, let's get rolling with some actual shell! To get started, you should make sure that you have qemu built for your system. Here are some links to get you started:
I use qemu on a ton of platforms, but as I type this, I'm on vacation, so I am currently using an Apple MacBook Air (2020/M1). So, I built qemu (with GL acceleration), following the instructions from knazarov's homebrew-qemu-virgl repo. Once I had that running, I created a new folder to store my SPARCstation 5 VM in, and grabbed the necessary components:
$ mkdir sunos-414-sparc$ cd sunos-414-sparc
Once I had those, I started the configuration of the VM. Let me first thank KEKLKAKL, who provided a great starting point for this exercise. To get started, I generated the disk that I would be installing SunOS 4.1.4 on, and created my launch script:
Notice that I have changed the default network range that qemu provides for user (SLIRP) networking. I did this because I was having issues in getting SunOS to set the netmask correctly for qemu's default 10.0.2.0/24 subnet. I then launched the installation, using ./run.sh, and followed KEKLKAKI's excellent walk-through of the installation of SunOS 4.1.4. During the installation, I chose 192.168.76.15 as the IP address for the VM.
Once that was complete, I rebooted the system, and configured the default gateway. This is a little more difficult than it is in Solaris 2.x/SunOS 5.x, as there is no /etc/defaultrouter file. Instead, we add the following to /etc/rc.local:
This adds a default route (0.0.0.0 network) with 192.168.76.2 as the gateway and a metric of 1, since there is one hop to that gateway.
DNS on SunOS 4.1.4
By default, SunOS 4.x does not do DNS, except as a fall-back from NIS. Yes, Sun really wanted everyone to get onboard with NIS, and even expected you to use it for TCP/IP name resolution. So, your options are:
- install a NIS/YP server as a DNS proxy
- do some library hacking to change the resolution priorities
I chose to do #2, as that sounded a lot more straight-forward. Sun actually wrote up a great document on how to do just that, and I have captured it here. I created the resolv.conf as follows:
Once you do that, you have a working emulated SPARCstation 5, running SunOS 4.1.4, with functional TCP/IP!