Upgrading UNIX Sixth Edition

From Computer History Wiki
Revision as of 12:02, 4 March 2023 by Jnc (talk | contribs) (External links: +'run' shell command file)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UNIX Sixth Edition is distributed with binary (both user commands, and the operating system) for a PDP-11/40.

This makes sense, from a distribution logistics perspective; the -11/40 binaries will run on any PDP-11 available at the time which would support UNIX (i.e. PDP-11/45, etc), and once UNIX is up and running, it is fairly easy to produce binaries of the OS and user commands which take advantage of the extra capabilities of the /45, etc - principally Split I+D space.

The Setting up UNIX - Sixth Edition document is a little thin on details for how to do the upgraded OS, however; it just says:

In the run Shell file, the 11/45 code is commented out.
...
Since the layout of addresses in the system is somewhat peculiar, and
not directly supported by the link-editor 'ld', the 'sysfix' program
has to be run before the loaded output file can be booted.

Not very detailed (although, to be honest, there's not a great deal of complexity). More detailed instructions are below; and if you want to know more about that "somewhat peculiar .. layout of addresses in the system", see the page Unix V6 kernel memory layout.

Building a /45 or /70 OS binary

To start with, do read through the 'Setting up UNIX - Sixth Edition' document to make sure everything else in it is fresh in your memory.

The aforementioned 'run' shell command file (in /usr/sys) contains the following commented-out commands which need to be run to build a /45 or /70 system (the same OS binary can be run on either type of machine, and will automatically adapt):

as m45.s
mv a.out m45.o
cc sysfix.c
mv a.out sysfix
as data.s l.s
ld -x -r -d a.out m45.o c.o ../lib1 ../lib2
nm -ug
sysfix a.out x
mv x a.out

And that's all you need to do to build the OS binary for a /45; none of the other object files (in the two libraries) need to be touched.

(Note: you may need to edit the m45.s file to turn the 'floating point hardware present' flag off or on. If you intend to be turning it off and on a lot, it's probably best to move it into a separate file, and prepend that to m45.s in the assembly command, viz.:

as fpon.s m45.s

or

as fpoff.s m45.s

so you'll never have to actually edit anything.)

Here is a brief commentary on what each command does:

  • as m45.s - assemble the machine-language support module; all the other modules of the OS are written in C
  • mv a.out m45.o - the assembler's output file is named 'a.out' for historical reasons
  • cc sysfix.c - you'll need this command in a moment
  • mv a.out sysfix - the C compiler also uses 'a.out'
  • as data.s l.s - the l.s file contains configuration-specific material; see the explanation below - and the 'data.s' (the order is important) is to force the information in this to go in the 'data' section (see the memory layout article)
  • ld -x -r -d a.out m45.o c.o ../lib1 ../lib2 - the command to actually build the OS binary, using the system's ordinary linker/loader; the -r flag says to save the relocation information in the output file ('sysfix' will need this), the -x flag says to discard local symbols, and only retain globals, and the -d flag forces allocation of storage for common blocks
  • nm -ug - list un-defined global symbols (AKA errors)
  • sysfix a.out x - magic!
  • mv x a.out - it's probably better to do something like 'mv x /45unix', or something like that; since the /45 version of the OS will then be in a different file (you'll type that name in the bootstrapping process), if you make a mistake, the /40 version is still there, and can be booted

The configuration of the system (in terms of what devices it supports, etc) are specified in two files, 'c.c' and 'l.s'. For novice users, these are generated by the 'mkconf' utility, but after a while you may prefer to just edit them directly. (If you want to do anything that's not supported by 'mkconf', you will have no other choice, other than modifying it.)

The former provides the table which converts device numbers to the appropriate subroutines for the OS to open, read, write etc on that device. It also contains a few parameters; e.g. what device the root of the file system is on, and which device is used for swapping, and where on it the swap partition is.

The latter contains trap and interrupt vectors, and an instruction (per vector) to help link them to the device driver code (via some intermediary code in m40.s/m45.s).

It might be a good idea to practice all the above on a UNIX V6 system running under an emulator.

Building a /45 or /70 user command binary

On a /45 or /70, UNIX V6 supports the use of split-I+D for user commands. The '-i' flag to the linker/loader ('ld') tells it to produce an output binary which runs in this mode. Very few commands will need this; only those that use large amounts of memory.

Also, see the commentary in the 'Setting up UNIX - Sixth Edition' regarding floating point emulation (for machines that don't have floating point hardware).

See also

External links

  • run - the 'run' shell command file