Getting SunOS 4.1.4 installed and fully functional on real hardware turned out to be more difficult than I expected. What should have been a straightforward install from CD turned into a series of false starts, mostly around disk partitioning and disk labels. After several failed attempts I found it was far easier to start with a disk that already had a valid Sun disk label on it rather than trying to get the installer to label a blank drive correctly.

These are my notes from the process, covering the install itself and all the post-install work needed to get the system into a usable state with networking, DNS, X11R6, and a modern C++ compiler.

Installation

I installed from a CD burned with the SunOS 1.1.2 image, which contains SunOS 4.1.4. The install was done over a known 2.1 GB drive image with existing partitioning in place. Although the installer modifies the partition layout during installation, starting with a pre-labeled disk avoided the labeling failures I had experienced on previous attempts with blank drives.

This video is a helpful reference for the install process: https://www.youtube.com/watch?v=uvTOXp6kTZ8

Fixing the Terminal Definition

Modern terminal emulators identify themselves as xterm-256color, which SunOS 4.1.4 does not recognize. Without this fix, many terminal applications will not function correctly.

Edit /etc/termcap and find the xterm entry. Add an alias for xterm-256color by inserting |xterm-256color| after the existing |xterm| alias in the entry. For example, the beginning of the entry should look something like:

vs|xterm|xterm-256color|vs100|...

Networking

The OS installer configures some networking but not everything needed for a functional network connection. The following files need to be verified or created:

/etc/defaultrouter — Set to the IP address of your router:

192.168.70.1

/etc/gateways — Set to the IP address of your router.

/etc/netmasks — Add your network and mask:

192.168.70.0 255.255.255.0

/etc/resolv.conf — Add your DNS server:

nameserver 192.168.70.99

Fixing DNS Resolution

Out of the box, SunOS 4.1.x does not use /etc/resolv.conf for hostname resolution. The shared C library needs to be rebuilt with the resolver routines linked in to replace the default NIS-based lookups. This is a non-trivial procedure that involves extracting and relinking objects in libc.

The full step-by-step process is documented in SunOS 4.1 Using DNS without NIS.

Building and Installing X11R6

I built X11R6 using the bundled Sun cc compiler that ships with SunOS. The build process is straightforward if you follow the instructions included with the X11R6 source distribution. No special modifications were needed for SunOS 4.1.4.

Installing GCC 2.8.1 and libstdc++

Getting a C++ compiler running on SunOS 4.1.4 requires building both GCC and the C++ standard library. GCC 2.8.1 must be built first using the bundled Sun cc compiler, as it serves as the bootstrap compiler needed to later build GCC 2.95.3.

Both GCC versions use a multistage build process where you first compile the compiler, then rebuild it with itself. This second stage produces an optimized compiler that was built by its own code generation rather than the host compiler. Plan on at least a full day for each GCC build on vintage hardware.

The install instructions for this era of GCC and libstdc++ are ambiguous at best, so here is the order that worked for me.

1. Obtain the Sources

Download the following from ftp.gnu.org:

  • gcc-2.8.1
  • libstdc++-2.8.1

2. Build GCC First

Uncompress and untar the libstdc++ archive. Then move the GCC source tree into the top-level directory of libstdc++ and rename it to gcc:

tar xzf libstdc++-2.8.1.tar.gz
tar xzf gcc-2.8.1.tar.gz
mv gcc-2.8.1 libstdc++-2.8.1/gcc

Change into the gcc directory, configure, and build:

cd libstdc++-2.8.1/gcc
./configure
make

Read the INSTALL file and follow the instructions for a second-stage build, then install:

make install

3. Build libstdc++

Return to the libstdc++ top-level directory, configure, build, and install:

cd ..
./configure
make
make install

The install directions in the libstdc++ distribution are ambiguous about the build order, but building GCC first and then libstdc++ from the combined source tree is what ultimately worked.

Installing GCC 2.95.3

Once GCC 2.8.1 is installed you can use it to build GCC 2.95.3, which is a significant improvement in both features and build process. You cannot skip straight to 2.95.3 because the Sun cc compiler cannot build it directly. The bootstrap path is Sun cc to GCC 2.8.1 to GCC 2.95.3.

Download gcc-2.95.3 from ftp.gnu.org. I built everything using the “space saving” instructions from the documentation. Like 2.8.1, this is a multistage build where the compiler rebuilds itself. Plan on another full day for this on vintage hardware.

The key detail that is easy to miss is that the actual make and make install commands are run from the external build directory where you ran configure, not from within the source tree:

mkdir gcc-build
cd gcc-build
/path/to/gcc-2.95.3/configure
make
make install

There are still some ambiguous parts in the instructions, but this approach worked without issue.