A week ago, after completing the installation of a Raspberry Pi into an old Sun CDROM drive external enclosure, I posted a picture of the enclosure on Facebook. The response from an old friend was, “Can you run SunView on it?”
Of course, a Raspberry Pi is no Sun Workstation so, the answer was, not directly. However, I immediately did a Google search for Sun emulators and was very surprised to find that someone had actually written one. And so my project for the next week was born.
After downloading the source to TME (The Machine Emulator) and installing all the development libraries I tried to build the blighter. Unfortuately this was not as simple as you may have thought as the configure script had a bug which only showed itself if not on a x86 machine. This and the build system’s requirement for an ancient version of the libltdl module loading library for libtool took me nearly three days to work through. Still, I did now have a binary to play with.
It was then time to try it out. Somewhat sillily I followed some instructions I found on the Internet. These instructions included how to create a disk image file and then how to configure it from within the “tape” booted kernel’s format command. Following these instructions caused the emulator to Bus Error and crash when it tried to write to the virtual disk for the first time. I wasted a day trying to debug this… but it turned out that the instructions were wrong!
Having gone back to basics and used the size and parameters from a Seagate ST1480N disk, used in the SPARCstation 2, I was able to format, partition and install the miniroot. I thought this was the end of my problems… until I tried to install the OS.
The “suninstall” program just refused to be able to seek to the correct tape file for the installation files even though mt(1) worked perfectly. Puzzling. Another number of hours trying to find why this wasn’t working and I find that the VM config file needed parameters removing from the tape drive definition as the default only worked with NetBSD as the OS and not SunOS. :-/
Everything seemed good. After a couple of hours I had a working VM on the Pi and it didn’t even seem that slow. So, I logged in and started SunView. Woohoo! Task complete, almost. The mouse emulation didn’t work properly. I thought that maybe it was due to the VM running too slowly to read the input correctly. Still, I could a least post “task complete” as I did have SunView running, which is what Richard had asked.
It now took me another day or so of debugging to determine that the Mouse Systems mouse emulation was broken when encoding the movement delta values. The original code seems to require the compiler to pretend that hex values are signed integers when assigning to unsigned 8 bit integers. Well, dodgy!
Having fixed that bug all now works, if rather slowly.
Given the interest on Google+ and Twitter about this emulation I’ve spent today creating an automatic download, configure and build script with an easy to use prototype VM creation system for an emulated Sun3 running SunOS 4.1.1, which you can download here.