2.11BSD RP06

I’ve recently redone my 2.11BSD installation. The one I used was about ten years old, and I’m not really sure anymore where I found it’s base or what I did to it to make it into what it is today – not really useful for pointing people to a known-good, working starting point. And recently a number of quite interesting new patches came out – the ansification of the C compiler, and the new top, to name the most obvious.

So, high time to start fresh. First of course a reliable source of a tape image to start from… well, what better place to look than on TUHS.

https://www.tuhs.org/Archive/Distributions/UCB/2.11BSD_patch457/tape0.bz2

and don’t forget to unzip the tape file (like I did…). Anyway, since PDP2011 does not have tape controllers, this process will have to run on SIMH. I’ll use the following setup for SIMH:

set cpu 11/70 4m
set rp enable
set rp0 rp06
attach rp0 211bsd-rp06.dsk
set tm disable
set ts enable
set ts0 capac=0,locked
attach ts0 ./tape0

and put that in a file named ‘simh.ini’.

Then off. First up is booting from the tape and setting up the disk label for the RP06 image – really by far the most complex thing in the whole build. I’ve just copied the layout and sizes off my old image, no real wisdom going on here.

# pdp11 simh.ini
PDP-11 simulator V4.0-0 Current git commit id: 18472dc6
Disabling XQ
/root/build/bsd/simh.ini-4> attach rp0 211bsd-rp06.dsk
RP0: creating new file: 211bsd-rp06.dsk
Overwrite last track? [N] y
sim> boot ts
70Boot from ts(0,0,0) at 0172522
: ts(0,1)
Boot: bootdev=01001 bootcsr=0172522
disklabel
Disk? xp(0,0,0)
'xp(0,0,0)' is unlabeled or the label is corrupt.
Proceed? [y/n] y
d(isplay) D(efault) m(odify) w(rite) q(uit)? m
modify
d(isplay) g(eometry) m(isc) p(artitions) q(uit)? p
modify partitions
d(isplay) n(umber) s(elect) q(uit)? n
Number of partitions (8 max) [1]? 3
modify partitions
d(isplay) n(umber) s(elect) q(uit)? s
a b c d e f g h q(uit)? a
sizes and offsets may be given as sectors, cylinders
or cylinders plus sectors: 6200, 32c, 19c10s respectively
modify partition 'a'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? s
'a' size [340670]: 15884
modify partition 'a'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? o
'a' offset [0]: 0
modify partition 'a'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? t
'a' fstype [2.11BSD]:
modify partition 'a'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? q
modify partitions
d(isplay) n(umber) s(elect) q(uit)? s
a b c d e f g h q(uit)? b
sizes and offsets may be given as sectors, cylinders
or cylinders plus sectors: 6200, 32c, 19c10s respectively
modify partition 'b'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? s
'b' size [0]: 16720
modify partition 'b'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? o
'b' offset [0]: 15884
modify partition 'b'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? t
'b' fstype [unused]: swap
modify partition 'b'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? q
modify partitions
d(isplay) n(umber) s(elect) q(uit)? s
a b c d e f g h q(uit)? c
sizes and offsets may be given as sectors, cylinders
or cylinders plus sectors: 6200, 32c, 19c10s respectively
modify partition 'c'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? s
'c' size [0]: 308066
modify partition 'c'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? o
'c' offset [0]: 32604
modify partition 'c'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? t
'c' fstype [unused]: 2.11BSD
modify partition 'c'
d(isplay) z(ero) t(ype) o(ffset) s(ize) f(rag) F(size) q(uit)? q
modify partitions
d(isplay) n(umber) s(elect) q(uit)? d
type: SMD
disk: SMD
label: DEFAULT
flags:
bytes/sector: 512
sectors/track: 22
tracks/cylinder: 19
sectors/cylinder: 418
cylinders: 815
rpm: 3600
drivedata: 1 0 0 0 0
3 partitions:
size offset fstype [fsize bsize]
a: 15884 0 2.11BSD 1024 1024 # (Cyl. 0 - 37)
b: 16720 15884 swap # (Cyl. 38 - 77)
c: 308066 32604 2.11BSD 1024 1024 # (Cyl. 78 - 814)
modify partitions
d(isplay) n(umber) s(elect) q(uit)? q
modify
d(isplay) g(eometry) m(isc) p(artitions) q(uit)? q
d(isplay) D(efault) m(odify) w(rite) q(uit)? w
d(isplay) D(efault) m(odify) w(rite) q(uit)? q

There, that’s done. Now on to make file systems on the newly defined partitions. It’s really only necessary to do that for the root partition now, but since the standalone mkfs works really well, I’ll do the /usr partition too. There’s a lot of prompts in this bit, just press enter.

70Boot from ts(0,0,1) at 0172522
: ts(0,2)
Boot: bootdev=01002 bootcsr=0172522
Mkfs
file system: xp(0,0,0)
file sys size [7942]:
bytes per inode [4096]:
interleaving factor (m; 2 default):
interleaving modulus (n; 209 default):
isize = 1984
m/n = 2 209
Exit called
70Boot from ts(0,0,2) at 0172522
: ts(0,2)
Boot: bootdev=01002 bootcsr=0172522
Mkfs
file system: xp(0,0,2)
file sys size [154033]:
bytes per inode [4096]:
interleaving factor (m; 2 default):
interleaving modulus (n; 209 default):
isize = 38496
m/n = 2 209
Exit called

Then on to copy the root file system from the tape. As follows:

70Boot from ts(0,0,2) at 0172522
: ts(0,3)
Boot: bootdev=01003 bootcsr=0172522
Restor
Tape? ts(0,5)
Disk? xp(0,0,0)
Last chance before scribbling on disk. End of tape

What doesn’t show here is that after the message ‘Last chance before scribbling on disk’ you should type enter, but that doesn’t echo. Just wait a small minute.

Then comes the first moment we’re booting the new system. There is a thing to consider: the image on the tape is at patch level 457, and that is the unlucky level where the date is not correctly taken from the disk. So you must make sure to set the date each time you boot from now on, until you have completed the next series of patches – and at the very least #458.

Ok having said that, onwards with the boot and then to install the boot sector in the RP06 image, and copying the /usr, /usr/src/sys and /usr/src directories from the tape.

 70Boot from ts(0,0,3) at 0172522
: xp(0,0,0)unix
Boot: bootdev=05000 bootcsr=0176700
… system coming up... lots of messages
# date <the right date and time!>
# dd if=/mdec/hpuboot of=/dev/rxp0a count=1
1+0 records in
1+0 records out
# cd /dev
# rm *mt*
# ./MAKEDEV ts0
# sync
# mount /dev/xp0c /usr
# cd /usr
# mt rew
# mt fsf 6
# tar xpbf 20 /dev/rmt12
# mt -f /dev/rmt12 fsf
# mkdir src
# cd src
# tar xpbf 20 /dev/rmt12
# mt rew
# mt fsf 8
# tar xpbf 20 /dev/rmt12
# cd /
# chmod 755 / /usr /usr/src /usr/src/sys
# umount /dev/xp0c

The tar commands above take a bit of time – you can add a ‘v’ in the option letters to see what is going on, like xpbvf instead of xpbf.

Next up is fscking the new file system. Not sure why, but it consistently shows a few errors. Just accept them.

# fsck -y /dev/rxp0c

Then to set up /etc/fstab. I’ll spare you the details and just give the bare ed commands to change the default fstab to what we need:

# ed fstab
4,6d
1,3s/ra/xp/
3s/xp0d/xp0c/
w
q

then reboot – use the reboot command, that shuts the system down nicely. And then boot up and go into multiuser mode. Then we’re going to setup and build a kernel for PDP2011!

Again, I’ll give you the ed script. The base is the VERNON configuration; changes are made to the system identity, the CPU model, and several devices. No RL, only one KL, no LP, a bit more PTY, a DE instead of a QE, and no SLIP. Oh, and no quota – I really don’t see the point.

# cd /usr/src/sys/conf
# cp VERNON PDP2011
# ed PDP2011
/11\/70/
s/#//
/73,53/
s/PDP/#PDP/
/IDENT/
s/VERNON/PDP2011/
/QUOTA/
s/YES/NO/
/NRL/
s/2/0/
/NTS/
s/1/0/
/NKL/
/NKL/
s/8/1/
/NLP/
s/1/0/
/NPTY/
s/12/16/
/NDE/
s/0/1/
/NSL/
s/1/0/
/NQE/
s/1/0/
w
q
# ./config PDP2011
# cd ../PDP2011

Then we’re about to go into compiling the kernel. But before you do, the makefile needs to be changed because the config will make one of the overlays go over the 8K limit. To fix that, I’ll move the toy.o object into overlay 8. PDP2011 will not need it anytime soon, and it could probably be removed from the sources as well… anyway, this is a quick solution. The theory of the overlay shuffling is neatly explained in this post:

http://www.dnull.com/bsd/oldnews/bsdnew62161.html

# ed Makefile
/toy/
s/toy.o //
/OV8/
s/m/toy.o m/
w
q

Then of course make the kernel and install it – nothing fancy required, just make and make install. If you’re doing something experimental to the kernel, it makes sense to keep a backup of a known-good version, but that’s not the case here; everything is well and truly tested, so no need for backups or anything. Just make install is fine.

To finish things up, I then install the inetd config without tcp wrappers:

# cd /etc
# mv inetd.conf inetd.conf.wrappers
# mv inetd.conf.nowrappers inetd.conf

and that’s it!

Well, you’ll still have to set up networking. And set up the rc.local with your local daemons (correct the hash bang at the top, and chmod 700). And install the latest patches – especially since the patch level you are on now boots up with the clock defaulting to 1969. #459 fixes that, but you’ll really want to be at the latest #469. I’ll leave applying the patches ‘as an exercise for the reader’ though… or if you’re feeling lazy, you can pick up the disk image from the download page.