UNIX Fifth Edition

UNIX fifth edition comes as a bootable RK05 image. You can get it from TUHS and gunzip it.

In the following we will start from this bare system and build a somewhat more complete installation out of it. This mirrors the procedure for the fourth edition. You can find the result here.

Booting the system

Create a boot.ini:

set cpu 11/45
att rk0 disk0.rk
d sr 2
b rk0

And boot it (the kernel is aptly named unix):

% pdp11 boot.ini                                                                                   

PDP-11 simulator Open SIMH V4.1-0 Current        git commit id: 4d383732
Disabling XQ
@unix
mem = 64526

login: root
#

To halt, type sync and stop the emulation with ^E:

# sync
# 
Simulation stopped, PC: 001726 (MOV (SP)+,177776)
sim>

Now to create a more complete system out of this. I suggest you use this boot.ini and use disk0.rk as root.rk. src.rk and man.rk will be formatted and populated during the installation process.

Building a new kernel

Build a new kernel with the device drivers we want.

@unix
mem = 64537

login: root
# chdir /usr/sys/conf
# cc mkconf.c
# mv a.out mkconf
# mkconf
rk
rp
tc
tm
dh
pc
^D
# chdir ..
# rm -f conf.o low.o
# cc -c conf/c.c
# mv c.o conf.o
# as conf/l.s
# mv a.out low.o
# sh ld
# mv a.out /unix
# sync

Now reboot into the new kernel.

Create device files.

# chdir /dev
# /etc/mknod rk0 b 0 0
# /etc/mknod rk1 b 0 1
# /etc/mknod rk2 b 0 2
# /etc/mknod rk3 b 0 3
# /etc/mknod tap0 b 2 0
# /etc/mknod tap1 b 2 1
# /etc/mknod tap2 b 2 2
# /etc/mknod tap3 b 2 3
# /etc/mknod mt0 b 3 0
# /etc/mknod kmem c 1 1
# /etc/mknod tty0 c 5 0
# /etc/mknod tty1 c 5 1
# /etc/mknod tty2 c 5 2
# /etc/mknod tty3 c 5 3
# /etc/mknod tty4 c 5 4
# /etc/mknod tty5 c 5 5
# /etc/mknod tty6 c 5 6
# /etc/mknod tty7 c 5 7
# /etc/mknod pc c 6 0

Enabling serial lines

With the tty files in place we can now enable more teletype lines for logging in:

# ed /etc/ttys
56
1,8s/0/1/
w
56
q
#

After rebooting you should be able to connect to local port 555 via telnet.

Dump source onto second disk

Make a new file system, dump source onto tape, and restore onto new file system:

# chdir /usr/source
# ls
s1
s2
s3
s4
s7
# /etc/mkfs /dev/rk1 4872
isize = 103
# tp mr *
 254 entries
1238 used
1300 last
END
# /etc/mount /dev/rk1 /mnt
# chdir /mnt
# ls
# mkdir s1 s2 s3 s4 s7
# chmod 755 *
# chown bin *
# tp mx
END
#

Now delete source from root disk:

# chdir /usr/source/s2
# rm -f *
# chdir ../s3
# rm -f *
# chdir ../s7
# rm -f *
# chdir ../s1
# rm -f [a-f]*
# rm -f *
# chdir ../s4
# rm -f [a-f]*
# rm -f *
# chdir ..
# rmdir *
# chdir /
# /etc/umount /dev/rk1
# /etc/mount /dev/rk1 /usr/source

Edit /etc/rc to make the mount permanent:

# ed /etc/rc
70
$
/etc/update
i
/etc/mount /dev/rk1 /usr/source
.
w
102
q
#

Dump manual onto third disk

Get the reconstructed manual in nroff format man.tap and mount it:

sim> att tm0 man.tap

Then make and mount a new file system, create directories and restore manual there:

# /etc/mkfs /dev/rk2 4872
isize = 103
# mkdir /usr/man
# /etc/mount /dev/rk2 /usr/man
# chdir /usr/man
# mkdir man0 man1 man2 man3 man4 man5 man6 man7 man8
# tp mx
END
#

Install the man command and make mount permanent:

# chmod 775 man
# mv man /usr/bin/man
# ed /etc/rc
102
/mount/
/etc/mount /dev/rk1 /usr/source
a
/etc/mount /dev/rk2 /usr/man
.
w
131
q

Install nroff

Get nroff.tp and mount it:

sim> att tc1 nroff.tp

Then extract into roff source directory, build and install nroff binary:

# chdir /usr/source/s7
# tp 1x
END
# chown bin nroff*
# as nroff[1-5].s roff7.s nroff8.s
# ld -s -n a.out
# mv a.out /usr/bin/nroff

Add a new user

To add a new user, add a new line to /etc/passwd, create the user directory, and if you like, set a password with passwd user:

# ed /etc/passwd
49
$
bin::3:1::/bin:
a
aap::10:1::/usr/aap:
.
w
70
q
# mkdir /usr/aap
# chown aap /usr/aap

Install ul and mc

Get aap.tp and mount it:

sim> att tc0 aap.tp

Extract mc.c and ul.c, build and install them:

login: aap
% tp 0x mc.c ul.c
END
% cc mc.c
% mv a.out mc
% cc ul.c
% mv a.out ul
% su
# mv mc /usr/bin
# mv ul /usr/bin

Try them out:

% ls /usr/sys | mc
buf.h       dmr         ken         low.o       reg.h       text.h      
conf        file.h      ld          mch.o       seg.h       tty.h       
conf.h      filsys.h    lib1        param.h     systm.h     user.h      
conf.o      inode.h     lib2        proc.h                              
% man cat | ul


CAT(I)                       1/15/73                       CAT(I)



NAME
     cat - concatenate and print

SYNOPSIS
     cat file ...

DESCRIPTION
     Cat reads each file in sequence and writes it on  the  stan-
     dard output.  Thus:

        cat file

     is about the easiest way to print a file.  Also:

        cat file1 file2 >file3

[...]
%

Installing the B programming language

I have reconstructed the compiler and runtime system for B and made it work on UNIX v4 and v5. You can find the instructions here