First install the simulator and a few utilities by typing
root@pixel:~# apt-get install simh tmux telnet
Next create a system account in which to run simh and set user to that account.
root@pixel:~# adduser --uid 2000 --gid 100 simh
root@pixel:~# su - simh
After this, download and unpack the archive unix-v7-6.tar.gz of the original Unix R7 tape found on the website
https://homepages.thm.de/~hg53/pdp11-unix/
using the command
simh@pixel:~ $ wget https://homepages.thm.de/~hg53/pdp11-un ... 7-6.tar.gz
simh@pixel:~ $ tar zxf unix-v7-6.tar.gz
Now follow the HOWTO file in unix-v7-6 to assemble the tape and move it to the run directory
simh@pixel:~ $ cd unix-v7-6/mktape
simh@pixel:~/unix-v7-6/mktape $ make
simh@pixel:~/unix-v7-6/mktape $ mv mktape ../V7
simh@pixel:~/unix-v7-6/mktape $ cd ../V7
simh@pixel:~/unix-v7-6/V7 $ ./mktape
simh@pixel:~/unix-v7-6/V7 $ mv unix_v7.tm ../run
simh@pixel:~/unix-v7-6/V7 $ cd ../run
The run directory contains two configuration files. By default they are set to emulate a PDP-11/45 with an rp04 disk. We want to use a bigger disk so change setup.config as
...
set rp0 rp06
...
Continuing with the HOWTO file we load the tape and proceed to follow the instructions
http://gunkies.org/wiki/Setting_Up_Unix ... th_Edition
see also
http://minnie.tuhs.org/PUPS/Setup/v7_setup.html
simh@pixel:~/unix-v7-6/run $ pdp11 setup.conf
Overwrite last track? [N] (just press return)
sim> run 100000
<ctrl>+e (the system hangs so press ctrl+e)
sim> run 0
Boot
: tm(0,3)
file sys size: 5000
file system: hp(0,0)
: tm(0,4)
Tape? tm(0,5)
Disk? hp(0,0)
Last chance before scribbling on disk. (just press return)
: hp(0,0)hptmunix
#
At this point Unix R7 is running in single-user mode in the simulator. Now, set the console so it is not crazy, generate the /dev directory, make the user filesystem, mount it and load the last part of the tape.
# stty -lcase (note that the terminal will echo this in upper-case)
# stty erase '^h'
# stty kill '^u' (note <ctrl>+c on Raspbian is <ctrl>+? on R7)
# stty cr0 nl0
# cd /dev
# make rp06
# make tm
# for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
> do /etc/mknod tty$i c 19 $i; done
# /etc/mkfs /dev/rp3 322278
# dd if=/dev/nrmt0 of=/dev/null bs=20b files=6
# restor rf /dev/rmt0 /dev/rp3
Last chance before scribbling on /dev/rp3. (just press return)
# mount /dev/rp3 /usr
# dd if=/usr/mdec/hpuboot of=/dev/rp0 count=1
Now recompile the kernel to enable the tty devices. The first version of this document enabled the DC11 device and driver; however, this device does not have interrupt driven output and creates a 100 percent CPU load on an otherwise idle system. As SIMH doesn't support the DH11 hardware the only other option is the DZ11, which has preliminary support in Unix R7 but requires a tiny patch to be enabled. We first modify mkconf in the /usr/sys/conf directory to enable the driver. The editing must be done with ed and requires adding 7 lines. I found a script on the web at
http://wsxyz.net/v7/
which works nicely. The tab characters are significant to the assembler code in this patch so I have replaced them by <tab> so they don't get lost on the web. We'll change them back to real tabs when the file is safely transferred to the simulator. The script is
Code: Select all
249a
"dz",
0, 300, CHAR+INTR,
"<tab>dzin; br5+%d.\n<tab>dzou; br5+%d.",
".globl _dzrint\ndzin:<tab>jsr r0,call; jmp _dzrint\n",
".globl _dzxint\ndzou:<tab>jsr r0,call; jmp _dzxint\n",
"",
" dzopen, dzclose, dzread, dzwrite, dzioctl, nulldev, dz_tty,",
"",
"int dzopen(), dzclose(), dzread(), dzwrite(), dzioctl();\nstruct tty dz_tty[];",
.
45a
"dz",
.
w
q
# cd /usr/sys/conf
# cat >dz.tmp
in the simulator. Then paste the text and finally type <ctrl>+d to save the file. Edit the file to translate the <tab> symbols back to real tabs. Please type a tab character in the following command and not just spaces where the spaces are.
# ed dz.tmp
1,$s/<tab>/ /g
w
q
# ed mkconf.c <dz.tmp
14422
14839
#
If everything went as planned, the configuration system has been patched to recognize the dz driver and we can procede as before.
# date 8610200930 (can't set date to anything more than 1999)
# cd /usr/sys/conf
# cp hptmconf simhconf
# ed simhconf (editor a=append, .=stop appending, w=write, q=quit)
a
dz
.
w
q
# ./mkconf <simhconf
# make
as - -o l.o l.s
as -o mch.o mch0.s mch.s
cc -c c.c
ld -o unix -X -i l.o mch.o c.o ../sys/LIB1 ../dev/LIB2
# mv unix /
# ls -l /unix
-rwxrwxr-x 1 root 54866 Oct 10 10:24 /unix
(make sure the size is right, otherwise, redo)
# cd /etc
# ed ttys
18,$d
1,$s/00/14/
1,$p
14console
14tty00
14tty01
14tty02
14tty03
14tty04
14tty05
14tty06
14tty07
14tty08
14tty09
14tty10
14tty11
14tty12
14tty13
14tty14
14tty15
w
q
#
Before rebooting, rename the "dmr" user to "pi", move the root home directory to someplace more sensible and set the passwords.
# cd /etc
# ed passwd
s/dmr/pi/g
p
pi::7:3::/usr/pi:
1p
root:KycUDzoHvjyg6:0:1::/:
s/:$/root:/
p
root:KycUDzoHvjyg6:0:1::/root:
w
q
# mkdir /root
# cd /usr
# mv dmr pi
# passwd pi
New password: (please don't enter raspberry)
# passwd root
New password: (again not raspberry)
Now halt the system.
# sync
# sync
# sync
<ctrl>+e
sim> quit
At this point you should be back in Raspbian. Now change the file run.conf to enable the tty devices and upgrade the cpu to a PDP-11/70 with more RAM by editing the first lines to read
set cpu 11/70
set cpu 2048k
set cpu idle
set rp0 rp06
attach rp0 system.hp
set tto 7B
set dz enabled
set dz lines=16
attach -m dz 2000
set dz 7B
d cpu 2000 042102
...
Reboot the simulator with the command
simh@pixel:~/unix-v7-6/run $ pdp11 run.conf
boot
: hp(0,0)unix
mem = 2020544
# <ctrl>+d
RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSURE
IS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITH
WESTERN ELECTRIC COMPANY, INC.
MON OCT 20 09:43:54 EDT 1986
Now login and create a .profile with the commands that make the console sensible. Again note that <ctrl>+? means <ctrl>+c in R7 and there seems no way to change this other than patching the source. Also note that <ctrl>+? is often produced by the <delete> or <backspace> key on terminal emulators.
login: root
Password:
# ed .profile
a
stty erase '^h'
stty kill '^u'
stty cr0 nl0
.
w
q
# . ./.profile
# cp .profile /usr/pi
# cd /usr/pi
# chown pi .profile
# chgrp bin .profile
# sync
# sync
<ctrl>+e
sim> quit
Configuration of the Unix R7 image is essentially complete so lets make a backup copy.
simh@pixel:~/unix-v7-6/run $ cp system.hp system.bak
Now let's run the pdp11 inside tmux so we can leave it running in the background.
simh@pixel:~/unix-v7-6/run $ tmux
[3] 0:bash* "pixel" 09:03 20-Oct-16
simh@piexl:~/unix-v7-6/run $ pdp11 run.conf
boot
: hp(0,0)unix
# <ctrl>+d
RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSURE
IS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITH
WESTERN ELECTRIC COMPANY, INC.
MON OCT 20 10:13:33 EDT 1986
login:
<ctrl>+b d (detach the tmux session)
You are now back in Raspbian with the pdp11 emulator with the console running detached in the tmux session. There are 16 ttys accessible from the telnet port 2000 that can now be used to log into the system.
simh@pixel:~/unix-v7-6/run $ telnet localhost 2000
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connected to the PDP-11 simulator DCI device, line 0
login: pi
Password:
$ ls
.profile
$ <ctrl>+d
login:
<ctrl>+]
telnet> quit
Using telnet is fine when connecting locally. To make things secure it is a good idea to firewall port 2000 from remote connections. This can be done by adding a few lines to rc.local as follows.
/sbin/iptables -F
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -A INPUT -p tcp --destination-port 2000 \
! -s 127.0.0.0/8 -j DROP
You can also enter these commands manually as
root@pixel:~# /sbin/iptables -F
root@pixel:~# /sbin/iptables -P INPUT ACCEPT
root@pixel:~# /sbin/iptables -A INPUT -p tcp --destination-port 2000 \
! -s 127.0.0.0/8 -j DROP
to avoid rebooting. Now, to access the simulator remotely. Add your public key to the /home/simh/.ssh/authorized_key file with the prefix
command="telnet -E 127.0.0.1 2000" ssh-rsa ...
Note that ... represent the rest of your public key. Now on the remote host where you will log in from edit /home/username/.ssh/config to add
Code: Select all
Host simh
User simh
Hostname pixel
EscapeChar ^]
eric@remote:~ $ slogin simh
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is 'off'.
Connected to the PDP-11 simulator DZ device, line 0
login: pi
Password: (since you are connected through ssh the password will not be
transmitted in a readable way over the internet)
$ ls
.profile
$ <ctrl>+]. (disconnect using the EscapeChar followed by a period)
Connection to pixel closed.
eric@remote:~ $
If you try setting up SIMH following these directions, it would be great to post here how it went.