-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a1fd79
commit efb11c4
Showing
136 changed files
with
17,800 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Booting V7 on a SIMH PDP11/70 | ||
|
||
To generate a working V7 installation, I followed [Installing v7 on SIMH](https://gunkies.org/wiki/Installing_v7_on_SIMH). I include a copy of the RP06 disk image that is made by following the instructions on that page. It can be used to give you a fast start to running V7. | ||
|
||
## Basic installation | ||
|
||
Start by making a directory to work in, say _v7_. | ||
|
||
Get a working simulator, _git clone_ [https://github.com/simh/simh](https://github.com/simh/simh), change into the directory and run ```make pdp11```, you'll find the _pdp11_ command in the _BIN_ directory. You can install this binary in the _v7_ directory or on your own _bin_ directory if you have one. | ||
|
||
Copy _rp06-0.disk.gz_ to the _v7_ directory, and unzip it using the _gunzip_ command. | ||
|
||
Copy the _v7_ command script into your _v7_ directory. | ||
|
||
This script expects to use a file called _v7boot.ini_ to configure the installation. It defines the devices that the _pdp11_ will support, the _v7conf.ini_ file in this directory matches the current kernel installed on the disk. Copy _v7boot.ini_ into your _v7_ directory. | ||
|
||
## Initial boot | ||
|
||
Change into your _v7_ directory and type ``v7``: | ||
|
||
``` sh | ||
$ v7 | ||
|
||
PDP-11 simulator V4.0-0 Current git commit id: 37bc857b | ||
|
||
After Disabling XQ is displayed type boot | ||
and at the : prompt type hp(0,0)unix | ||
|
||
Disabling XQ | ||
./v7boot.ini-10> att tm0 tm0.tap | ||
%SIM-INFO: TM0: creating new file | ||
%SIM-INFO: TM0: Tape Image 'tm0.tap' scanned as SIMH format | ||
``` | ||
SIMH has created an empty file _tm0.tap_ that is the tape image, I'll come back to that later. There is a puzzling lack of a prompt, but it's waiting for you to type ``boot`` to load a small program to get things started. You can use ^H to delete characters. Back to the listing (including the last line we had above): | ||
|
||
``` sh | ||
%SIM-INFO: TM0: Tape Image 'tm0.tap' scanned as SIMH format | ||
boot | ||
: | ||
``` | ||
Now we have a prompt _:_, and need to load the kernel code, type ``hp(0,0)unix``. This loads the code for the kernel from HP device zero, looking for the file in partition zero. Note this allows you to load other versions of the kernel, always keep a working version around. | ||
|
||
``` sh | ||
boot | ||
: hp(0,0)unix | ||
mem = 2020544 | ||
# | ||
``` | ||
You are now booted into a single user system, using just the root partition. If you type stuff, you'll find that it comes out in upper-case, which is convenient if your console is an ASR33 teletype. To get into multiuser mode, type Control-D, which is not echoed: | ||
|
||
``` sh | ||
: hp(0,0)unix | ||
mem = 2020544 | ||
# RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSURE | ||
IS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITH | ||
WESTERN ELECTRIC COMPANY, INC. | ||
WED DEC 31 19:10:00 EST 1969 | ||
|
||
login: | ||
``` | ||
|
||
You can login as ```root``` with a password of ```root```, or use ```dmr``` as a user with no password, and type a few commands: | ||
|
||
``` sh | ||
login: dmr | ||
$ ls | ||
$ pwd | ||
/usr/dmr | ||
$ | ||
``` | ||
|
||
To stop the simulation, you need to ensure that any disk writes are written to the disk before stopping, to do this type ```sync``` a few times. Then hit ^E to return to the simulator, and finally ```q``` to quit. | ||
|
||
``` sh | ||
$ pwd | ||
/usr/dmr | ||
$ sync | ||
$ sync | ||
$ sync | ||
$ sync | ||
$ | ||
Simulation stopped, PC: 002306 (MOV (SP)+,177776) | ||
sim> q | ||
Goodbye | ||
``` | ||
|
||
# Getting files in and out | ||
|
||
Although V7 has a _tar_, it uses a binary format, and not the text format that was eventually adopted by POSIX to become the standard. I wrote a version of the _tp_ program in Python for the V6 project - see [uxtp](https://github.com/pcollinson/unixv6-extras/tree/main/uxtp). Sadly, _tp_ on the V6 and V7 won't create directories, so I included the ability to add a shell script to the dump called _makedirs.sh_ that creates any directory that is needed. This has proved a very useful idea. | ||
|
||
Here's a demo of getting files from this distribution into V7. Let's move the contents _sh-test_ which looks for and installs _/bin/['_ which I found was missing on my distribution when I started writing shell scripts. The _tp_ internal file format includes the path name to the files, and you are limited to 31 characters, so you need to start close to the source. The program will write into the _tm0.tap_ that SIMH made earlier. Your paths may vary below. | ||
|
||
``` sh | ||
$ cd unixv7-extras | ||
$ uxtp -rvs ../v7/tm0.tap sh-test | ||
Adding makedirs.sh | ||
Adding sh-test/README.md | ||
Adding sh-test/check | ||
``` | ||
|
||
Now you can fire up the V7 system and login: | ||
|
||
``` sh | ||
$ tp xvm makedirs.sh | ||
x makedirs.sh | ||
End | ||
$ sh makedirs.sh | ||
$ tp xvm | ||
x makedirs.sh | ||
x sh-test/README.md | ||
x sh-test/check | ||
End | ||
$ ls sh-test | ||
README.md | ||
check | ||
$ | ||
``` | ||
|
||
This sequence first gets the _makedirs.sh_ file from the tape, and next it's run to create any necessary directories. Then _tp_ command extracts the contents into the directories that were made. Finally run _ls_ command to look at the files. | ||
|
||
You'll find that if you write to the tape from V7 using ```tp rm files```, it will appear on _tm0.tap_ and can be read and used immediately. Incidentally, this is not true for DECTAPE. | ||
|
||
If you want to get files into the system while V7 is live, then you need to detach and reattach the tape file. I have a little SIMH control file that resets the tape. First you need to type ^E to get back to the simulator control level. This pauses the running V7 and you can return using the _co_ command. SIMH has a ```do``` command that allows you to put commands in a file. I have included a file called _relm_ which detaches and re-attaches the tape drive. | ||
|
||
``` sh | ||
$ | ||
Simulation stopped, PC: 002360 (MOV (SP)+,177776) | ||
sim> do relm | ||
./relm-2> att tm0 tm0.tap | ||
%SIM-INFO: TM0: Tape Image 'tm0.tap' scanned as SIMH format | ||
|
||
``` | ||
|
||
The ^E I typed at the V7 prompt is not shown. The _relm_ file ends in ```co``` to continue back to the running system. To get the prompt again, type return. You can now read the new data from the tape. | ||
|
||
## What next? | ||
|
||
The next step is to configure the kernel adding new devices - see [v7conf](../v7conf). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
echo | ||
echo After Disabling XQ is displayed type | ||
echo boot - there is not prompt | ||
echo then at the : prompt type hp(0,0)unix | ||
echo Login as root, password root | ||
set cpu 11/70 | ||
set cpu 2M | ||
set cpu idle | ||
set rp0 rp06 | ||
att rp0 rp06-0.disk | ||
att tm0 tm0.tap | ||
boot rp0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
det tm0 | ||
att tm0 tm0.tap | ||
co |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set cpu 11/45 | ||
set cpu idle | ||
set rp0 rp06 | ||
att rp0 rp06-0.disk | ||
att tm0 v7.tap | ||
boot tm0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exec pdp11 v7boot.ini |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
echo | ||
echo After Disabling XQ is displayed type boot | ||
echo and at the : prompt type hp(0,0)unix | ||
echo | ||
set cpu 11/70 | ||
set cpu 2M | ||
set cpu idle | ||
set rp0 rp06 | ||
att rp0 rp06-0.disk | ||
att tm0 tm0.tap | ||
boot rp0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
hp | ||
root hp 0 | ||
swap hp 1 | ||
swplo 0 | ||
nswap 8778 | ||
tm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# fsck - file system check program | ||
|
||
This version of _fsck_ was distributed in the _v7addenda_ tape, but needed a little bit of work to make it work nicely on V7. I've added some _#defines_ and associated _#ifdef_ sections to preserve the original code. | ||
|
||
This version will put orphaned files into a _lost+found_ directory that needs to be installed at the top of any file system you intend to run the code on. I've included a shell script that will make a suitable directory with space in its blocks for some files. | ||
|
||
If you use _fsck_ on a large partition, the program asks for a temporary file, this should not be on the disk being checked. | ||
|
||
## Compilation | ||
|
||
Use ```make``` to compile the code, ```make install``` to install the binary and manual page, and ```make clean``` to remove the _fsck_ binary. | ||
|
||
## Tests | ||
|
||
The [tests](tests) directory contains several testing programs that can induce a file system problem, that _fsck_ can fix. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
.TH FSCK 1M | ||
.SH NAME | ||
fsck \- file system consistency check and interactive repair | ||
.SH SYNOPSIS | ||
.B /etc/fsck | ||
[ option ] ... | ||
[ filesystem ] ... | ||
] ... | ||
.SH DESCRIPTION | ||
.I Fsck | ||
audits and interactively repairs inconsistent conditions for | ||
the named | ||
.IR filesystems. | ||
If a file system is consistent then the number of files, number of blocks | ||
used, and number of blocks free are reported. | ||
If the file system is inconsistent the operator is prompted for concurrence | ||
before each correction is attempted. | ||
Most corrections lose data; | ||
all losses are reported. | ||
The default action for each correction | ||
is to wait for the operator to respond | ||
`yes' or `no'. | ||
Without write permission | ||
.I fsck | ||
defaults to | ||
.BR "\-n " action. | ||
.PP | ||
These options are recognized: | ||
.TP | ||
.B \-y | ||
Assume a yes response to all questions. | ||
.TP | ||
.B \-n | ||
Assume a no response to all questions. | ||
.TP | ||
.BI \-s X | ||
Ignore the actual free list and (unconditionally) construct a new | ||
one by rewriting the super-block of the file system. | ||
The file system should be unmounted while this is done, | ||
or extreme care should be taken that the system is quiescent | ||
and that it is rebooted immediately afterwards. | ||
This precaution is necessary so that the old, bad, in-core copy | ||
of the superblock will not continue to be used, or written on the file system. | ||
.IP | ||
The free list is created with optimal interleaving | ||
according to the specification | ||
.IR X : | ||
.RS | ||
.IP | ||
.B \-s3 | ||
optimal for RP03 | ||
.br | ||
.B \-s4 | ||
optimal for RP04, RP05, RP06 | ||
.br | ||
.BI \-s c : s | ||
space free blocks | ||
.I s | ||
blocks apart in cylinders of | ||
.I c | ||
blocks each. | ||
.RE | ||
.IP | ||
If | ||
.I X | ||
is not given, | ||
the values used when the filesystem was created | ||
are used. | ||
If these values were not specified, then | ||
.IR c =400, | ||
.IR s =9 | ||
is assumed. | ||
.TP | ||
.BI \-S X | ||
Conditionally reconstruct the free list. | ||
This option | ||
is like | ||
.BR \-s X | ||
except that the free list is rebuilt only | ||
if there were no discrepancies discovered in the | ||
file system. | ||
It is useful for forcing free list reorganization | ||
on uncontaminated file systems. | ||
.B \-S | ||
forces | ||
.BR \-n . | ||
.TP | ||
.B \-t | ||
If | ||
.I fsck | ||
cannot obtain enough memory to keep its tables, | ||
it uses a scratch files. | ||
If the | ||
.B -t | ||
option is | ||
specified, the file named in the next argument | ||
is used as the scratch file. | ||
Without the | ||
.B \-t | ||
option, | ||
.I fsck | ||
prompts if it needs a | ||
scratch file. | ||
The file should not be on the | ||
file system being checked, and if it is not | ||
a special file or did not already exist, it is | ||
removed when | ||
.I fsck | ||
completes. | ||
.PP | ||
If no filesystems are given to | ||
.I fsck | ||
then a default list of file systems is read from | ||
the file | ||
.BR /etc/checklist . | ||
.PP | ||
.ne 10 | ||
Inconsistencies checked are as follows: | ||
.TP | ||
1. | ||
Blocks claimed by more than one inode or the free list. | ||
.TP | ||
2. | ||
Blocks claimed by an inode or the free list outside the range of the file system. | ||
.TP | ||
3. | ||
Incorrect link counts. | ||
.TP | ||
4. | ||
Size checks: | ||
.RS | ||
Incorrect number of blocks in file. | ||
.br | ||
Directory size not a multiple of 16 bytes. | ||
.RE | ||
.TP | ||
5. | ||
Bad inode format. | ||
.TP | ||
6. | ||
Blocks not accounted for anywhere. | ||
.TP | ||
7. | ||
Directory checks: | ||
.RS | ||
File pointing to unallocated inode. | ||
.br | ||
Inode number out of range. | ||
.RE | ||
.TP | ||
8. | ||
Super Block checks: | ||
.RS | ||
More than 65536 inodes. | ||
.br | ||
More blocks for inodes than there are in the file system. | ||
.RE | ||
.TP | ||
9. | ||
Bad free block list format. | ||
.TP | ||
10. | ||
Total free block and/or free inode count incorrect. | ||
.PP | ||
Orphaned files and directories (allocated but unreferenced) are, | ||
with the operator's concurrence, reconnected by | ||
placing them in the "lost+found" directory. | ||
The name assigned is the inode number. The only restriction | ||
is that the directory "lost+found" must preexist | ||
in the root of the filesystem being checked and | ||
must have empty slots in which entries can be made. | ||
This is accomplished by making "lost+found", copying | ||
a number of files to the directory, and then removing them | ||
(before | ||
.I | ||
fsck | ||
is executed). | ||
.PP | ||
Checking the raw device is almost always faster. | ||
.SH FILES | ||
/etc/checklist | ||
contains default list of file systems to check. | ||
.SH "SEE ALSO" | ||
dcheck(1), icheck(1), | ||
checklist(5), fs(5), crash(8) | ||
.SH BUGS | ||
Inode numbers for | ||
.B . | ||
and | ||
.B .. | ||
in each directory should be checked for validity. | ||
.br | ||
The | ||
.B \-b | ||
option of | ||
.IR icheck (1) | ||
should be available. |
Oops, something went wrong.