UNIX Sixth Edition
This is a guide to installing UNIX sixth edition in the simh PDP-11 emulator. Besides the PDP-11 emulator you only need the v6 distribution tape, which you can get from http://doc.cat-v.org/unix/v6/operating-systems-lecture-notes/v6/dist.tap or my site.
You should also read some of the documents that come with UNIX. You can get most of them (and the UNIX Programmer's Manual) as Postscript files here: http://doc.cat-v.org/unix/v6/operating-systems-lecture-notes/v6/doc/index.html or from my site (also as PDF). The Programmer's Manual without the documents is also available here.
The UPM for v6 (among others) is also available here.
Particularly relevant is the Setting up UNIX document (start.ps/pdf).
Note: If you don't want to install UNIX yourself, you can grab the pre-installed RK05 images and the expect script that was used to build them here.
Installing the root file system
There are three RK05 disk images on the tape:
To install the root file system create an
with the following lines:
set cpu 11/40 set tm0 locked att tm0 path/to/your/dist.tape att rk0 disk0.rk att rk1 disk1.rk att rk2 disk2.rk d 100000 012700 d 100002 172526 d 100004 010040 d 100006 012740 d 100010 060003 d 100012 000777 g 100000 g 0
This tells the emulator to emulate a PDP-11/40, attaches the distribution tape and three disks, and then executes the bootstrap.
To run, type
press ^E to stop the emulator. It will start again at 0.
Now copy the boot sector and root fs from tape to RK0:
=tmrk disk offset 0 tape offset 100 count 1 =tmrk disk offset 1 tape offset 101 count 3999 =
and stop with ^E. We will copy the rest to disk when we are running UNIX.
To boot UNIX, boot from RK0 and load the kernel
rkunix. Login as
sim> boot rk0 @rkunix login: root #
Welcome to UNIX.
A quick introduction:
To erase one character type
#, to kill the whole line type
To interrupt a program type
(usually on Delete or Backspace key, depends on terminal).
If you want to change that, use stty:
# stty erase <key to erase character> kill <key to kill line>
A good standard are
^H (Backspace) and
The terminal is configured with option cr1 by default which delays output after a newline, set it to cr0 to get faster output:
# stty cr0
cd is still called
chdir in v6
/usr/source/s1/sh.c later if you want to change that).
Creating device files
To restore the other RK disks we have to create the correct device files.
/etc/mknod without arguments tells you what arguments it expects:
usage: mknod name b/c major minor
We create a block- and character-device for each of the three disks (major number 0 and 9 resp.):
# /etc/mknod /dev/rk0 b 0 0 # /etc/mknod /dev/rk1 b 0 1 # /etc/mknod /dev/rk2 b 0 2 # /etc/mknod /dev/rrk0 c 9 0 # /etc/mknod /dev/rrk1 c 9 1 # /etc/mknod /dev/rrk2 c 9 2
We also need a tape device (major number 3/12):
# /etc/mknod /dev/mt0 b 3 0 # /etc/mknod /dev/rmt0 c 12 0
Copy disks and mount them
Finally we can copy the source and doc disks from tape:
# dd if=/dev/mt0 of=/dev/rk1 count=4000 skip=4100 # dd if=/dev/mt0 of=/dev/rk2 count=4000 skip=8100
You can now mount them to /usr/source and /usr/doc (needs to be created):
# /etc/mount /dev/rk1 /usr/source # mkdir /usr/doc # /etc/mount /dev/rk2 /usr/doc
If you want the disks to be mounted at startup, edit
# ed /etc/rc 28 2 /etc/update a /etc/mount /dev/rk1 /usr/source /etc/mount /dev/rk2 /usr/doc . w 89 q #
This completes the basic installation.
To halt the system type
sync a couple of times, stop and quit the emulator:
# sync # sync # sync # ^E Simulation stopped, PC: 002502 (MOV (SP)+,177776) sim> q Goodbye
Recompiling the Kernel and System Configuration
After the installation there is still some stuff to do. We will compile a new kernel with additional support for 8 terminal lines, a papertape device and a line printer.
boot.ini that will be used to boot the system:
set cpu 11/40 att rk0 disk0.rk att rk1 disk1.rk att rk2 disk2.rk ; att tm0 scratch.tape ; att lpt printer.txt ; att ptp paperout ; att ptr paperin set dci en set dci lines=8 att dci 1106 d sr 1 b rk
This will create 8 terminal lines you can attach to with telnet over port 1106. Uncomment the lines to attach tape, printer and papertape output/input files. If the switch register is set to zero, the kernel will not print anything, Setting it to 1 will enable kernel printing.
% pdp11 boot.ini PDP-11 simulator V3.9-0 Disabling XQ Listening on port 1106 (socket 9) @rkunix mem = 1035 RESTRICTED RIGHTS Use, duplication or disclosure is subject to restrictions stated in Contract with Western Electric Company, Inc. login: root #
Now we will delete the unneeded kernels and build our own:
# rm hpunix rpunix unix # chdir /usr/sys/conf # cc mkconf.c # mv a.out mkconf # cat >myconf rk tm pc 8dc lp ^D # mkconf <myconf # as m40.s # mv a.out m40.o # cc -c c.c # as l.s # mv a.out l.o # ld -x l.o m40.o c.o ../lib1 ../lib2 # mv a.out /unix
If you want, you can write a shell script that does this for you,
look at or modify
Now halt and boot kernel
unix, we can now also delete
# sync # sync # sync # ^E Simulation stopped, PC: 002656 (MOV (SP)+,177776) sim> b rk0 @unix mem = 1027 RESTRICTED RIGHTS Use, duplication or disclosure is subject to restrictions stated in Contract with Western Electric Company, Inc. login: root # rm rkunix
Now we will create the necessary device files again,
for that we consult
/usr/sys/conf/c.c. The first table
is for block devices, the second for character devices.
The major number for
/etc/mknod is the index into the corresponding table.
# /etc/mknod /dev/lp0 c 2 0 # /etc/mknod /dev/pc c 1 0 # /etc/mknod /dev/tty0 c 3 0 # /etc/mknod /dev/tty1 c 3 1 # /etc/mknod /dev/tty2 c 3 2 # /etc/mknod /dev/tty3 c 3 3 # /etc/mknod /dev/tty4 c 3 4 # /etc/mknod /dev/tty5 c 3 5 # /etc/mknod /dev/tty6 c 3 6 # /etc/mknod /dev/tty7 c 3 7
To enable the tty lines, edit
/etc/ttys (changes take effect after reboot).
# ed /etc/ttys 112 1,8s/./1/ w 112 q
Now to tell
dcheck about the disks we have mounted:
# chdir /usr/source/s1 # ed df.c 1282 /rp/ "/dev/rp0", d -i "/dev/rk0", "/dev/rk1", . w 1295 q # ed icheck.c 5051 /rp/ "/dev/rrp0", d -i "/dev/rrk0", "/dev/rrk1", . w 5065 q # ed dcheck.c 3332 /rp/ "/dev/rrp0", d -i "/dev/rrk0", "/dev/rrk1", . w 3346 q # cc df.c # mv a.out /bin/df # cc icheck.c # mv a.out /bin/icheck # cc dcheck.c # mv a.out /bin/dcheck
For some reason
icheck report bad free count on rk2.
I don't know how this could be fixed right now.
Now you should have a working UNIX v6 system, have fun with it.