Preface
These are the steps to install 4.2BSD from August 1983 on a simulated VAX-11/780, using Bob Supnik’s SIMH emulator, and then backport a later driver for the DEC DEULA ethernet NIC into the system, recompile the kernel, and enable networking.
4.2 took about 3 years to produce, and contained many improvements over 4.1, which was still mostly the classic Bell Labs UNIX v7/32v. Most notable was the interim version 4.1a (released to the public in 4.1c), which included the first UNIX implementation of the ARPANET TCP/IP.
IP works out of the box with a fresh 4.2 install, but only a half-dozen or so ethernet drivers are supported, and SIMH only supports the DEUNA/DEULA card from DEC. Supported was added a couple years later in 1985. The source code repositories (in SCCS originally) are now available on github, so I’m going to pull down the two required drivers, insert them into the code and recompile the kernel to get networking functional. So far my tests show a pretty creaky networking stack, but it should be sufficient for LAN connectivity, and at least some routing.
You might want to read the official documentation as well. I’ve placed a copy at http://plover.net/~agarvin/4.2bsd-setup.pdf. This was generated from the files in the usr.tar.gz from below, in /usr/doc/setup. It was built with the following:
eqn *.t | tbl | groff -ms | ps2pdf - > setup.pdf
You’ll need the s troff macros. You can grab the file /usr/lib/tmac/tmac.s, change the name to s.tmac and place it in the directory when you run the above.
This is my first AsciiDoc document. Thanks to my Cisco coworker Dwight Schauer for introducing me to it!
1. Section: Preparation for install
My starting point for the guide was the excellent Computer History Wiki guide at http://gunkies.org/wiki/Installing_4.2_BSD_on_SIMH. I want to do a few things differently though.
We’ll use the files from the Unix Heritage Society, found: http://www.tuhs.org/Archive/Distributions/UCB/4.2BSD/
First, get a copy of http://plover.net/~agarvin/mk-dist-tape.py and place it someplace in the executable path. provided below.
Finally, we’ll use the 4.3-Quasijarus distribution floppy, as I haven’t been able to find a 4.2 floppy. The floppy has three programs: FORMAT, COPY, BOOT. The FORMAT is only used for a couple unusual drive types. COPY and BOOT we’ll use below.
mkdir 4.2BSD cd 4.2BSD for f in ingres.tar.gz miniroot.gz new.tar.gz rootdump.gz src.tar.gz srcsys.tar.gz stand.gz usr.tar.gz vfont.tar.gz; do curl -O http://www.tuhs.org/Archive/Distributions/UCB/4.2BSD/$f done gzip -d *gz mk-dist-tape.py -o 4.2bsd.tape stand:512 miniroot rootdump srcsys.tar usr.tar vfont.tar src.tar new.tar ingres.tar curl -O http://www.tuhs.org/Archive/Distributions/UCB/4.3BSD-Quasijarus0a/floppy.Z
The floppy.Z needs gzcompat to install. You can get it at: https://gist.github.com/MikeRalphson/232163 and compile with gcc gzcompat.c -o gzcompat. Then you type cat floppy.Z | gzcompat | gzip -d> floppy.img.
We have several choices for drives (and more can be added to /etc/disktab after we finish the install):
Type |
Size |
Desc |
rm03 |
67 MB |
DEC RM03 |
rm05 |
256 MB |
DEC RM05 |
rp06 |
200 MB |
DEC RP06 |
rm80 |
128 MB |
DEC RM80 |
rp05 |
85 MB |
DEC RP05 |
rp07 |
504 MB |
DEC RP07 |
rb02 |
10 MB |
DEC RL02 on 730 IDC |
rb80 |
131 MB |
DEC R80 on 730 IDC |
rk06 |
13 MB |
DEC RK06 |
rk07 |
27 MB |
DEC RK07 |
ra60 |
205 MB |
DEC RA60 Removable |
ra80 |
124 MB |
DEC RA80 Winchester |
ra81 |
446 MB |
DEC RA81 Winchester |
I’m going to use an ra81, since it’s sizeable and I’ve done it before. We can create a sparse file to "thin-provision" the drive. Also, I’ve uploaded a sample configuration file, which we’ll also download. Feel free to change anything that feels appropriate here.
curl -O http://plover.net/~agarvin/4.2bsd.conf truncate -s 622M rq0-ra81.dsk
And, let’s create a trivial startup script:
cat > start-42.sh << EOF vax780 4.2bsd.conf EOF chmod 775 start-42.sh
And to clean things up:
mkdir files mv *tar stand rootdump miniroot files
The preparation is finished, and we’re ready to install!
2. Section: Installation
The normal process is to use the COPY program on the distribution flopppy to copy the miniroot (the second tapefile, ts(0,1)) to the swap partition of the new disk, ra(0,1). However, I couldn’t get this to work, possibly because the instructions say to format the HD with the dec format program, which I suspect would partition it. Therefore, using an idea from gunkies.org, I’m going to set the first HD to be a temporary file, and I’m going install the root from there onto ra1, the second disk. Then, I’m going to shut down the vax, and change the second drive back to the first drive device.
This is the initial drive configuration in the 4.2bsd.conf file:
; Disks: set rq0 ra81 set rq1 ra81 at rq0 tmp-disk.dsk at rq1 rq0-ra81.dsk
Stuff to type is bolded below. We’ll create the temporary disk first
$ truncate -s 456M tmp-disk.dsk $ ./start-42.sh VAX780 simulator V3.9-0 RX: buffering file in memory sim> fload copy 0 sim> run 2 From: ts(0,1) To: ra(0,0) ra0: unlabeled Copy completed: 205 records copied Reboot request failed, PC: 00000001 (HALT) sim> fload boot 0 sim> run 2 Boot : /vmunix ra0: unlabeled 199488+56036+51360 start 0x11a0 4.2 BSD UNIX #9: Wed Nov 2 16:00:29 PST 1983 real mem = 8384512 avail mem = 7073792 using 102 buffers containing 835584 bytes of memory mcr0 at tr1 mcr1 at tr2 uba0 at tr3 hk0 at uba0 csr 177440 vec 210, ipl 15 rk0 at hk0 slave 0 rk1 at hk0 slave 1 uda0 at uba0 csr 172150 vec 774, ipl 15 ra0 at uda0 slave 0 ra1 at uda0 slave 1 zs0 at uba0 csr 172520 vec 224, ipl 15 ts0 at zs0 slave 0 dz0 at uba0 csr 160100 vec 300, ipl 15 dz1 at uba0 csr 160110 vec 310, ipl 15 dz2 at uba0 csr 160120 vec 320, ipl 15 dz3 at uba0 csr 160130 vec 330, ipl 15 lp0 at uba0 csr 177514 vec 200, ipl 14 root on ra0 WARNING: clock lost 2 days -- CHECK AND RESET THE DATE! WARNING: should run interleaved swap with >= 2Mb erase ?, kill U, intr ^C # cd /dev # ./MAKEDEV ra1 # disk=ra1 type=ra81 tape=ts /xtr
Build root file system Warning: 538 sector(s) in last cylinder unallocated /dev/rra1a: 15884 sectors in 23 cylinders of 14 tracks, 51 sectors 8.1Mb in 2 cyl groups (16 c/g, 5.85Mb/g, 1856 i/g) super-block backups (for fsck -b#) at: 32, 11520, Check the file system ** /dev/rra1a ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 2 files, 9 used, 7420 free (20 frags, 925 blocks) Rewind tape Restore the dump image of the root Warning: ./lost+found: File exists ** /dev/rra1a ** Last Mounted on /a ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 313 files, 3568 used, 3861 free (21 frags, 480 blocks) Root filesystem extracted If this is a 780, update floppy If this is a 730, update the cassette
# sync;sync;sync # control-E to exit to the simh prompt Simulation stopped, PC: 80001620 (FFS #0,#20,8003ED44,R0) sim> exit Goodbye
Ok, now it’s time to modify the 4.2bsd.conf file. The section with the hard drives should be changed to the follow (you’ll comment out, or delete, the line with the tmp disk, and change it so the permanent disk is drive 0:
; Disks: set rq0 ra81 set rq1 ra81 ; at rq0 tmp-disk.dsk at rq0 rq0-ra81.dsk
And at the end of the file, the last two lines should be uncommented, so it reads:
fload boot 0 run 2
Now, we install the rest of the OS. Again, bolded text is what you type:
$ ./start-42.sh VAX780 simulator V3.9-0 RX: buffering file in memory Boot : /vmunix ra0: unlabeled 199488+56036+51360 start 0x11a0 4.2 BSD UNIX 9: Wed Nov 2 16:00:29 PST 1983 real mem = 8384512 avail mem = 7073792 using 102 buffers containing 835584 bytes of memory mcr0 at tr1 mcr1 at tr2 uba0 at tr3 hk0 at uba0 csr 177440 vec 210, ipl 15 rk0 at hk0 slave 0 rk1 at hk0 slave 1 uda0 at uba0 csr 172150 vec 774, ipl 15 ra0 at uda0 slave 0 ra1 at uda0 slave 1 zs0 at uba0 csr 172520 vec 224, ipl 15 ts0 at zs0 slave 0 dz0 at uba0 csr 160100 vec 300, ipl 15 dz1 at uba0 csr 160110 vec 310, ipl 15 dz2 at uba0 csr 160120 vec 320, ipl 15 dz3 at uba0 csr 160130 vec 330, ipl 15 lp0 at uba0 csr 177514 vec 200, ipl 14 root on ra0 WARNING: should run interleaved swap with >= 2Mb Automatic reboot in progress... Tue Nov 1 12:27:40 PST 1983 Can't open checklist file: /etc/fstab Automatic reboot failed... help! erase ?, kill U, intr ^C # cd /etc # cp fstab.ra81 fstab # cat fstab # newfs /dev/ra0g ra81 Warning: 30 sector(s) in last cylinder unallocated /dev/rra0g: 82080 sectors in 115 cylinders of 14 tracks, 51 sectors 42.0Mb in 8 cyl groups (16 c/g, 5.85Mb/g, 2048 i/g) super-block backups (for fsck -b) at: 32, 11512, 22992, 34472, 45952, 57432, 68912, 80392, # newfs /dev/ra0h ra81 Warning: 28 sector(s) in last cylinder unallocated /dev/rra0h: 759668 sectors in 1064 cylinders of 14 tracks, 51 sectors 389.0Mb in 67 cyl groups (16 c/g, 5.85Mb/g, 2048 i/g) super-block backups (for fsck -b#) at: 32, 11512, 22992, 34472, 45952, 57432, 68912, 80392, 91872, 103352, 114832, 126312, 137792, 149272, 160752, 172232, 182816, 194296, 205776, 217256, 228736, 240216, 251696, 263176, 274656, 286136, 297616, 309096, 320576, 332056, 343536, 355016, 365600, 377080, 388560, 400040, 411520, 423000, 434480, 445960, 457440, 468920, 480400, 491880, 503360, 514840, 526320, 537800, 548384, 559864, 571344, 582824, 594304, 605784, 617264, 628744, 640224, 651704, 663184, 674664, 686144, 697624, 709104, 720584, 731168, 742648, 754128, # mount -a # cd /dev # ./MAKEDEV ts0 # cd / # mkdir /usr/sys /usr/src # rm sys # ln -s /usr/sys sys # cd /usr/sys # mt rew # mt fsf 3 # tar xpb 20 # cd /usr # mt rew # mt fsf 4 # tar xpb 20 # cd /usr/src # mt rew # mt fsf 6 # tar xpb 20 # cd new # mt rew # mt fsf 7 # tar xpb 20
And that is the basic install. You can type halt and then restart it to make sure everything starts correctly.
3. Section: Backpatch DEULA drivers
Unfortunately, the only ethernet NIC that SIMH vax780 supports is the DEUNA/DEULA cards from DEC. And 4.2BSD comes with support for only a half-dozen or so cards, none of which are the above. The driver for the DEULA card was added in November, 1983, just 3 months after the release of 4.2.
The CSRG archive CD-ROMs, available at https://www.mckusick.com/csrg/ for a fee, or at http://archive.org for download, contain all the SCCS archives for the BSD project. But a quicker way to get the driver is from github, where all the SCCS repos were converted and uploaded in 2012. We’ll need two files from there, if_de.h and if_dereg.h. You can find them at: https://github.com/csrg/original-bsd/tree/master/sys/vax/if.
Let’s grab the earliest version, and put them in a tarball in a tape file:
curl -O https://raw.githubusercontent.com/csrg/original-bsd/742cc7c4035be8abae00e7cb3e8401a7bd2ca4d9/sys/vax/if/if_de.c curl -O https://raw.githubusercontent.com/csrg/original-bsd/742cc7c4035be8abae00e7cb3e8401a7bd2ca4d9/sys/vax/if/if_dereg.h tar cvf de.tar if_de.c if_dereg.h mk-dist-tape.py -o de_drivers.tape de.tar
Now, from inside 4.2BSD, we’ll attach this tape and pull those files. Use ctrl-E to go to the sim prompt:
myname# Simulation stopped, PC: 80001620 (FFS 0,#20,8003ED44,R0) sim> at ts0 de_drivers.tape sim> go myname cd /tmp myname# mt rew myname# tar xvpb 20 x if_de.c, 26251 bytes, 52 tape blocks x if_dereg.h, 6606 bytes, 13 tape blocks myname# cp if_de.c if_dereg.h /sys/vaxif
Now it’s time to reconfigure the kernel.
The de(4) man page (see https://www.freebsd.org/cgi/man.cgi?query=de&apropos=0&sektion=4&manpath=4.3BSD+Reno&arch=default&format=html) from 4.3BSD tells us the configuration we’ll need to add to the generic terminal:
device de0 at uba0 csr 174510 vector deintr
We’ll also need to enable the ether pseudo device. You can do this pretty simply, as the placement and white space doesn’t really matter, by typing (adding a leading 0, otherwise it interprets it as decimal):
cd /sys/conf echo pseudo-device ether >> GENERIC echo vaxif/if_de.c optional de device-driver >> files.vax echo device de0 at uba0 csr 0174510 vector deintr >> GENERIC
Oh, one last thing. I didn’t get de.h, but it’s just one line, so let’s change the file if_de.c:
myname# cd /sys/vaxif myname# ex if_de.c 7 "if_de.c" 980 lines, 26251 characters :/de.h #include "de.h" :c #define NDE 1 . :x! "if_de.c" 980 lines, 26249 characters
And now we do:
cd /sys/GENERIC make clean make depend make
On my desktop, this only takes about 2 minutes. The final output is:
loading vmunix rearranging symbols text data bss dec hex 206248 57348 53656 317252 4d744
So let’s make a backup and install this in place, and try it:
mv /vmunix /vmunix.orig cp vmunix / halt
On reboot, you should see during the bootup:
de0 at uba0 csr 174510 vec 120, ipl 15 de0: addr=8:0:43:0:0:5
And to verify:
myname# netstat -i Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Collis de0* 1500 0.0.0 0.0.0 0 0 0 0 0 lo0 1536 loopback-n localhost 0 0 0 0 0 myname# ifconfig de0 de0: 0.0.0.0 flags=0<>
4. Section: Configure networking
The network stack in 4.2 seems to be pretty immature. It sends out arp requests for IPs outside of its network. I see UDP packets from routed with the checksum malformed (and network routing seems fundamentally broken, though host routes work well). There are many other known bugs if you check through the change list for 4.3BSD 4 years later. Still, it’s not difficult to get basic networking set up, and it working well enough to allow ingoing or outgoing tcp connections.
In /etc/hosts, add (with whatever networking you want, but I’m fitting this in my old network):
192.168.102.13 bsd4-2
Add in /etc/networks:
home 192.168.102
Change the first two lines in /etc/rc.local into these 4:
/bin/hostname bsd4-2 /etc/ifconfig de0 up /etc/ifconfig de0 arp /etc/ifconfig de0 `hostname`
Now on reboot, you should be able to check:
bsd4-2# netstat -i Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Collis de0 1500 home bsd4-2 3 0 3 0 0 lo0 1536 loopback-n localhost 1 0 1 0 0 bsd4-2# ifconfig de0 de0: 192.168.102.13 flags=c3<UP,BROADCAST,RUNNING>
And there we go! Attach it to a network tap or use one of simh’s other network utilities to get actual connections. I’ll do some write-up later on my discoveries on the peculiarities of 4.2.