Preface
It's been a long time since I originally wrote this article back in 2005 for Linux Journal. Do people even read paper any more? *smirk* I figured it needed a little update. I will walk you through all the steps necessary to boot up ancient UNIX (ancient as in 1970s) on your very own computer using the SIMH simulator. I also include special notes if you want to run the examples on the Raspberry Pi and Raspbian. (Which didn't even exist in 2005!). Enjoy!
Image Credit: "Pdp-11-40" by Stefan_Kögl - Own work.
Licensed under CC BY-SA 3.0 via Wikimedia Commons.
I have always had a voracious appetite for early minicomputer and mainframe history. I believe recorded history itself is the single-most important innovation of human existence. We humans seem to have a hard-wired compulsion to record, pass on and learn from the mistakes and successes of those before us. Open-source software and hardware is the natural evolution of this concept applied to technology. In the Open Source philosophy, we are all free to learn from the wealth of software created by the masses that came before us. By examining the evolution of a project, we can learn from the mistakes of others and, perhaps most important, copy verbatim from their successes. By harnessing this freely available history as well as unfettered cooperation, we advance the common good.
Recently, some companies have begun to loosen their grip on the early computing “intellectual property”. Although some have not fully embraced open source, these sometimes small, token gestures offer us a wealth of knowledge. In this article, I focus on how we can explore early operating system history by running “historic” UNIX releases on our very own Linux boxes using a simulator. The SCO Group (Yes, “them”, previously Caldera, Inc.) claims current ownership of early UNIXes and has released them under an “Ancient Unix” license, which allows for noncommercial use.
I focus here on the UNIX V5 release, because it is the earliest available UNIX. UNIX V6, V7 and various early BSD releases are also available. If you plan on trying out any of these OSes, examine the licenses included with each before booting them up.
Stranger in a Strange Land: the UNIX V5 User Environment
The UNIX V5 system provided in the disk image we will use is rather stark and unfriendly compared to modern, lush UNIX/Linux systems. Here are a few pointers before we get started:
- sh is the shell. It's only 858 lines of C; don't expect it to work like the /bin/bash shell.
- Use chdir to change the default directory.
- Backspace and arrow keys rarely work.
- ed is the text editor; see en.wikipedia.org/wiki/Ed.
- bas is a basic interpreter.
- fc is a FORTRAN interpreter.
- cc is the C compiler.
- Source code is in /usr/source.
- There are not many files (528), so use find / -print to see what else is included. It should scroll by just fast enough to read it ;-)
SIMH is a ground-up system simulator; it simulates the CPU, memory, firmware and devices of a number of early computer systems. This means that original distributed software can run unmodified on these simulated systems. SIMH successfully simulates devices such as disks, tape drives, printers and networking devices. This means that not only can we run these historic systems, but we can communicate and transfer data to and from them using modern technologies and protocols. A great deal of thanks is owed to the authors and contributors of SIMH. Their decision to release under open source furthers all our understanding of our history and guarantees that this history will always be free.
Getting Started: Installing SIMH
Raspberry Pi Note If you are running this on a Raspberry Pi running Raspbian you are in luck, SIMH is available as pre-built software. Skip the compile in this section and just install simh using apt-get: sudo apt-get install simh Then just skip to Running UNIX V5 |
Below I will detail the command line steps needed to download and compile the SIMH source code. The latest SIMH release is V3.9-0 at the time of this writing.
If you want to use Ethernet emulation, you will need to install the PCAP development packages for your OS. The SIMH installation documents explain how to do this, and you can skip this step if you're not going to be using networking support on your simulated machines. If you are running Fedora or similar you can simply run:
|
The stuff you type to compile SIMH is below in bold.
|
This builds all possible system simulators. Each simulator becomes a separate binary in the ./BIN/ directory. SIMH can be run as any normal user, but if you want to use Ethernet network simulation, you need to execute it as root (under UNIX) to allow libpcap access to the Ethernet device. Otherwise, continue as any non-root user. Our particular example of UNIX V5 does not use networking.
Running UNIX V5
Raspberry Pi Note If you are running this on a Raspberry Pi running Raspbian you can perform all these steps as the "pi" user in it's home directory. Make sure you have at least 4MB of free space. (Yes, You read the correct. The entire UNIX V5 is less then 4MB.) |
UNIX V5, released in June 1974, was still very early in UNIX development at Bell Labs. Much of the system was still written in assembler. This disk image includes a working C compiler (cc) and a great deal of interesting source code under /usr/source.
To begin our exploration, we must download the UNIX V5 disk image. In the same shell as you compiled SIMH, run the following:
|
This zip archive contains the pre-installed image file as well as a README and file containing license information. The disk image is a snapshot of a working installed system. In this case, it is simulating an RK05 disk drive. We must now collect the pieces we need to get this system booted. Begin by copying the BIN/pdp11 binary from under the SIMH build into our uv5 directory, then we will create a small config file "pdp11.ini" that tells the simulator how to boot UNIX.
Raspberry Pi Note If you are running this on a Raspberry Pi running Raspbian skip the next step where you copy (cp) the pdp11 binary and instead, run the following: ln -s /usr/bin/pdp11 . |
|
Create a file pdp11.ini with your favorite editor and place the following lines in it.
|
This tells the simulator what kind of CPU to emulate and to attach the unix_v5_rk.dsk file as a simulated RK-style disk using the rk0 device name. Finally, this file tells the simulator to boot the OS image on that disk.
Your uv5 simulator directory should look like the following:
|
We are ready. Let's boot UNIX V5 and have some fun! Follow the example session below or go off on your own exploring. Note, you will likely need to use CTRL-h as backspace if you make a mistake.
|
Let's look at some source code, starting with the "echo" program. It's small and simple.
|
Let's compile the echo program, rename it and run a "Hello World"
|
Nice! Now, let's create, compile and run our own hello world C program. We will use "cat" as a poor man's editor to create the source file.
|
Let's try a basic program next, use cat to create hello.b with some basic source
|
All done for now, Let's HALT the system. In true historical UNIX style, we will run sync three times, then push the HALT button. Or in our case, the SIMH equivalent which is CTRL-e
|
That's it! You're up and running. You have officially set your fingers on a “real” historical UNIX system. As you can see, there is plenty of source code to look over and a working compiler to play with. UNIX V5 is only one of the early operating systems you can explore with SIMH. On the SIMH Web site, you will find a repository of disk images for lots of other systems. The learning curve can be quite steep on these older OSs but there is a lot to learn from them. You can find conceptual bit and pieces of them strewn about inside all modern systems. It's living history at your fingertips.
If you are interested in seeing what a PDP-11 system and RK05 disk actually looked like, take a look at the photo gallery on the SIMH Web site (see Resources). Also, try searching Google Images for a wealth of great photographs.
Resources
- SIMH Web Site: simh.trailing-edge.com
- SIMH Users Guide: http://simh.trailing-edge.com/pdf/simh_doc.pdf
- SIMH Photo Gallery: simh.trailing-edge.com/photos.html
- SIMH Contributors: simh.trailing-edge.com/contrib.html
- PDP-11 History and Photos: www.pdp11.org
- UNIX History Timeline (Printable!): www.levenez.com/unix/
- Open Group UNIX History: www.unix.org/what_is_unix
- The Unix Heritage Society: www.tuhs.org
- PDP Unix Preservation Society: minnie.tuhs.org/PUPS
About the author
Matthew is the Senior Enterprise Architect at the New Jersey Institute of Technology (NJIT). When he is not working, he enjoys hacking on electronics, microcontrollers and embedded systems. He can also make a mean falafel when the circumstances call for it. Matthew is a total nerd and thus completely useless in conversations regarding "sports". Matthew also greatly dislikes talking about himself in the third person in author biographies.For more random nonsense from Matthew he suggests following him on twitter: @sysmatt
Like this article? See more of Matt's published works