Your own SPARCStation 5 workstation, with QEmu and Solaris, PART 1 - Setting up the emulator
The SPARCStation and the CD-i
Many years ago UI and UX were still in their diapers. Disk storage was frugal and expensive. A 100MB harddisk was considered huge, and it was as expensive as the whole rest of the computer system. The only systems that had developers who were exploring the corners of UI and UX were the Amiga and the Atari ST, and those systems were near to being obsolete. Let alone being considered for serious work. PCs had Windows 3.1 or Windows 95, which were graphical user interfaces, but drab as a mud fence.
Around this time, CD-ROM entered the scene. And all of a sudden, there it was: cheap storage, removable, with the stellar size of 650MB and even more! Realistic graphics, photos, video, it became available to developers almost overnight! And everyone wanted a piece of it!
Philips and Sony, having invented the CD, decided that if there is such an amount of storage, there should also be something that makes use of it. And so the CD-i console was born. A great system, with great graphical potential, and huge storage space (and let's be honest: also suffering from a few serious caveats that ended it's life quite soon).
And that's when I entered the scene and became a CD-i programmer. We explored the edges of UI and UX (and of copyrights), made many mistakes and many discoveries, and together layed some of the foundation of the modern-day User Experience that we all know.
A few years later, still a long time ago from now, Sony killed the CD-i with their PlayStation. And I had to move to greener pastures. But I still have my CD-i 605 professional development player from that time. And lately I was wondering if I could get it up and running again, and if I might even still write some software for it.
At the time we used Sun SparcStation IPC's for authoring the CD-i titles. I don't have space for a SparcStation IPC, even though they are small, and an emulator on my Macbook will probably zoom compared to the original. So I did a search on Google for 'sparcstation emulator'. The first hit was 'QEMU - Sparc32 System Emulator', and I had found a rabbit hole.
In this blog, I will recite the journey of creating an emulated Sun SparcStation 5 with QEMU and Solaris 2.6. Solaris 2.6 was the last Sun OS that I used, so it made sense to go for that.
Setting up QEMU and Solaris
For this step, you will need:
- A computer system, either Windows, Linux or Mac. I am using a MacBook Pro M2 Max, which is quite similar to Linux. On Windows, there are probably a few differences in the details.
- A recent version of QEMU, I am using version 9.1.0.
- A Solaris 2.6 boot disk.
Step 1 - Getting QEMU and Solaris
QEMU
The QEMU emulator runs from the Linux/Macos commandline (Terminal on Macos). This tutorial is quite descriptive and you don't have to have much detailed knowledge of using a commandline, but it will surely help.
On a Mac, the easiest way is to use Homebrew to install QEMU. Note that Homebrew is not installed by default on your Mac and you first need to install it. Instructions are on the Homebrew website. Once you have installed Homebrew, install QEMU with this command:
brew install qemu
On Linux (Debian/Ubuntu), you can use apt-get.
apt-get install qemu-system
QEMU is an open-source project, so you can also choose to download the source code and build it yourself, if you fancy such things. Just have a look on the qemu.org website.
Solaris
A Solaris 2.6 bootdisk image can be found on WinWorld.
Download the 'Sun Solaris 2.6.598 [Sun SPARC]' image. After downloading and unpacking, you should end up with the following file.
solaris_2.6_598_sparc.iso
Tutorials
There are a few similar tutorials like this one on the web, and I used them to good effect. However, they are not always precise in their details, and some of the choices they make are unfortunate. Still, they are useful, and they helped me a lot along the way, so kudos to their writers!
There's a turorial on AdaFruit
https://learn.adafruit.com/build-your-own-sparc-with-qemu-and-solaris?view=all- Also a tutorial on Brezular's Blog
https://brezular.com/2012/02/17/installation-solaris-2-6-sparc-on-qemu-part2-solaris-installation/
Commandline
QEMU runs from the commandline, using Terminal on Mac or Linux. I strongly recommend to make a special folder for all the QEMU-related things. Either in your home folder, or like I did on my Mac, in Applications.
On a Mac, open terminal and type the following (> is the prompt, you don't type it, and also it might look different for you):
This is where you will store all files and assets related to the Sparcstation 5 emulator.
The location I gave is a great one for a Mac, as now you will find a folder 'Emulator' with a subfolder 'qemu-sparcstation5' in your Applications menu. You can open Applications, browse to the subfolder, and select 'Open in Finder' to immediately open it.
In the rest of this tutorial, I will assume that you have opened a Terminal and moved to that folder, like so:
5
QEMU has a huge number of parameters. In the Terminal, having moved to the qemu-sparcstation5 folder with cd, type the following to generate a file with all the known parameters:
You can then find the file in the qemu-sparcstation5 folder and check it out with a text editor.
Step 2 - Creating a disk image
The tutorials differ from opinion on what's a usable size for the disk image. But we all have huge disk space compared to 1998, and I will follow Brezular's recommendation of 36GB. And by using his recommendation, I don't have to do the math anymore either, I can just use his calculations. ;)
The disk image is created through the Terminal commandline again. So, first open a Terminal, and:
> cd /Applications/Emulators/QEMU-SPARCSTATION-5
Now we can create the image like so.
qemu-img create -f qcow2 Solaris26.qcow2 36G
Result:
And with that, we are ready to start configuring the emulator!
Step 3 - Configuring the emulator
Starting QEMU
The installation of Solaris happens in QEMU itself, of course. To start QEMU such that we can start installing everything, we have to pass a bunch of parameters:
qemu-system-sparc \
-M SS-5 \
-m 256 \
-nic user,hostfwd=tcp:127.0.0.1:5555-:22 \
-drive file=Solaris26.qcow2,bus=0,unit=0,media=disk \
-drive file=solaris_2.6_598_sparc.iso,bus=0,unit=2,media=cdrom,readonly=on
To list all the supported parameters, type qemu-system-sparc --help > qemu-system-sparc-help.txt
These parameters mean the following:
- qemu-system-sparc
This starts the Sun4m-architecture emulator. This is the architecture of the SparcStation IPC, a 32-bit system. - -M SS-5
This specifies the machine. In our case I chose a SparcStation 5, which is close enough to a SparcStation IPC. Maybe SS-4 would be more true to reality. You can list all supported machines with this command: qemu-system-sparc -M help. - -m 256
The amount of ram memory that we want. 256MB is enough for everyone. But the SparcStation IPC could only have 48MB max. We cheat a bit, this is an emulator after all. ;) - -nic user,hostfwd=tcp:127.0.0.1:5555-:22
This will be explained in more detail later, but it is to forward the SSH port 22 of the QEMU guest machine (the SparcStation) to the local machine's IP port 5555, enabling us to later SSH into the emulated machine from our computer. - -drive file=Solaris26.qcow2,bus=0,unit=0,media=disk
This specifies the hard disk drive. It will become /dev/hda. - -drive file=solaris_2.6_598_sparc.iso,bus=0,unit=2,media=cdrom,readonly=on
This specifies a cdrom drive, which has the Solaris 2.6 boot disk inserted.
The emulator will now start in the OpenBIOS bootloader, which is provided for free with the emulator.
Note: it is possible to pass a real Sun BIOS to QEMU. You can find a few here. However, I ran into the problem that the BIOS kept trying to boot from the network, instead of showing me the OK prompt, whatever I tried. With OpenBIOS I had no issue at all. I recommend to just forget about using a real Sun BIOS. I'm also not sure about the copyright situation.
First boot
The first time we boot, we want to boot from the cd-rom into a single-user mode prompt, from which we can prepare the emulated system for installation of Solaris. For that, we type:
# boot cdrom:d -vs
The -v option stands for 'verbose', the -s option (or combined: -vs) stands for 'single-user'.
After some processing we reach the # prompt, we are now in an 'sh' shell..
Now we have to enter a few things to prepare the harddisk. This applies permissions and ownership to the drive(s):
# drvconfig
This creates /dev entries for all attached disks, so that we can mount them:
# disks
Formatting
The hard disk needs to be formatted and 'labeled' before it can be used. Solaris only has the parameters of a few types of harddisk built-in, and none of them is 36GB. So during the formatting procedure we will have to specify the parameters manually.
The formatting procedure is started with this command:
# format
Solaris asks us which disk we want to format. Choose disk 0.
Solaris now presents us with a list of hard drives that it knows. But we will choose '16. other', because we want to enter our own parameters.
The next steps will ask for the disk parameters. We will give our disk the following parameters (thanks Brezular!), for all other parameters we will accept the defaults:
- Disk type: 16
- Number of data cylinders: 24620
- Number of heads: 27
- Number of data sectors/track: 107
- Disk type name: Qemu36GB
When the disk is labeled, we can quit the format utility with the 'quit' command, and can reboot the system with the 'reboot' command. The disk is now prepared, and we can start the installation procedure after reboot.
We now have our virtual Sun SparcStation 5 workstation running on our computer!
Comments
Post a Comment