Research V7 development
[unix-history] / usr / doc / setup
CommitLineData
74d4a75b
CH
1.TL
2Setting Up
3Unix
4\- Seventh Edition
5.AU
6Charles B. Haley
7Dennis M. Ritchie
8.AI
9.MH
10.PP
11The distribution tape can be used only on a DEC PDP11/45
12or PDP11/70 with RP03, RP04, RP05, RP06 disks and with
13a TU10, TU16, or TE16 tape drive.
14It consists of some preliminary bootstrapping programs followed by
15two file system images;
16if needed, after the initial construction of the file systems
17individual files can be extracted. (See restor(1))
18.PP
19If you are set up to do it,
20it might be a good idea immediately to make a copy of the
21tape to guard against disaster.
22The tape is 9-track 800 BPI and contains some 512-byte records
23followed by many 10240-byte records.
24There are interspersed tapemarks.
25.PP
26The system as distributed contains binary images
27of the system and all the user level programs, along with source
28and manual sections for them\(emabout
292100 files altogether.
30The binary images,
31along with other
32things needed to flesh out the file system enough so UNIX will run,
33are to be put on one file system called the `root file system'.
34The file system size required is about 5000 blocks.
35The file second system has all of the source and documentation.
36Altogether it amounts to more than 18,000 512-byte blocks.
37.SH
38Making a Disk From Tape
39.PP
40Perform the following bootstrap procedure to obtain
41a disk with a root file system on it.
42.IP 1.
43Mount the magtape on drive 0 at load point.
44.IP 2.
45Mount a formatted disk pack on drive 0.
46.IP 3.
47Key in and execute at 100000
48.RT
49.DS
50 TU10 TU16/TE16
51012700 Use the DEC ROM or other
52172526 means to load block 1
53010040 (i.e. second block) at 800 BPI
54012740 into location 0 and transfer
55060003 to 0.
56000777
57.DE
58.IP
59The tape should move and the CPU loop.
60(The TU10 code is
61.I
62not
63.R
64the DEC bulk ROM for tape;
65it reads block 0, not block 1.)
66.IP 4.
67If you used the above TU10 code, halt and restart the
68CPU at 0, otherwise continue to the next step.
69.IP 5.
70The console should type
71.DS
72.I
73Boot
74:
75.R
76.DE
77Copy the magtape to disk by the following procedure.
78The machine's printouts are shown in italic,
79explanatory comments are within ( ).
80Terminate each line you type by carriage return or line-feed.
81There are two classes of tape drives:
82the name `tm' is used for the TU10, and `ht' is used for
83the TU16 or TE16.
84There are also two classes of disks:
85`rp' is used for the RP03, and `hp' is used for the
86RP04/5/6.
87.PP
88If you should make a mistake while typing, the character '#'
89erases the last character typed up to the beginning of the line,
90and the character '@' erases the entire line typed.
91Some consoles cannot print lower case letters, adjust the
92instructions accordingly.
93.DS
94(bring in the program mkfs)
95\fI:\|\fRtm(0,3) (use `ht(0,3)' for the TU16/TE16)
96\fIfile system size:\fR 5000
97\fIfile system:\fR rp(0,0) (use `hp(0,0)' for RP04/5/6)
98.I
99isize = XX
100m/n = XX
101.R
102(after a while)
103.I
104exit called
105Boot
106:
107.R
108.DE
109This step makes an empty file system.
110.IP 6.
111The next thing to do is to restore the data
112onto the new empty file system. To do this you respond to
113the `\fI:\fR' printed in the last step with
114.DS
115(bring in the program restor)
116\fI:\|\fRtm(0,4) (`ht(0,4)' for TU16/TE16)
117\fItape?\fR tm(0,5) (use `ht(0,5)' for TU16/TE16)
118\fIdisk?\fR rp(0,0) (use `hp(0,0)' for RP04/5/6)
119\fILast chance before scribbling on disk.\fR (you type return)
120(the tape moves, perhaps 5-10 minutes pass)
121\fIend of tape\fR
122.I
123Boot
124:
125.R
126.DE
127You now have a UNIX root file system.
128.SH
129Booting UNIX
130.PP
131You probably have
132the bootstrap running, left over from the last step above;
133if not,
134repeat the boot process (step 3) again.
135Then use one of the following:
136.DS
137\fI:\|\fRrp(0,0)rptmunix (for RP03 and TU10)
138\fI:\|\fRrp(0,0)rphtunix (for RP03 and TU16/TE16)
139\fI:\|\fRhp(0,0)hptmunix (for RP04/5/6 and TU10)
140\fI:\|\fRhp(0,0)hphtunix (for RP04/5/6 and TU16/TE16)
141.DE
142The machine should type the following:
143.DS
144.I
145mem = xxx
146#
147.R
148.DE
149The
150.I
151mem
152.R
153message gives the memory available to user programs
154in bytes.
155.PP
156UNIX is now running,
157and the `UNIX Programmer's manual' applies;
158references below of the form X(Y) mean the subsection named
159X in section Y of the manual.
160The `#' is the prompt from the Shell,
161and indicates you are the super-user.
162The user name of the super-user is `root'
163if you should find yourself in multi-user mode and
164need to log in;
165the password is also `root'.
166.PP
167To simplify your life later, rename the appropriate version
168of the system as specified above plain `unix.'
169For example, use mv (1) as follows if you have an RP04/5/6 and
170a TU16 tape:
171.DS
172mv hphtunix unix
173.DE
174In the future, when you reboot,
175you can type just
176.DS
177hp(0,0)unix
178.DE
179to the `:' prompt.
180(Choose appropriately among `hp', `rp', `ht', `tm'
181according to your configuration).
182.PP
183You now need to make some special file entries
184in the dev directory. These specify what sort of disk you
185are running on, what sort of tape drive you have,
186and where the file systems are.
187For simplicity, this recipe creates fixed device names.
188These names will be used below, and some of them are built into
189various programs, so they are most convenient.
190However, the names do not always represent the actual major and
191minor device in the manner suggested in section 4 of the
192Programmer's Manual.
193For example, `rp3' will be used for the name of the file system
194on which the user file system is put, even though it might be on an RP06
195and is not logical device 3.
196Also, this sequence will put the user file system on the same
197disk drive as the root, which is not the best place
198if you have more than one drive.
199Thus the prescription below should be taken only as one example
200of where to put things.
201See also the section on `Disk layout' below.
202.PP
203In any event, change to the dev directory (cd(1)) and, if you like,
204examine and perhaps change the makefile there (make (1)).
205.DS
206cd /dev
207cat makefile
208.DE
209Then, use one of
210.DS
211make rp03
212make rp04
213make rp05
214make rp06
215.DE
216depending on which disk you have.
217Then, use one of
218.DS
219make tm
220make ht
221.DE
222depending on which tape you have.
223The file `rp0' refers to the root file system;
224`swap' to the swap-space file system; `rp3' to the
225user file system.
226The devices `rrp0' and `rrp3' are the `raw' versions
227of the disks.
228Also, `mt0' is tape drive 0, at 800 BPI;
229`rmt0' is the raw tape, on which large records can be read
230and written;
231`nrmt0' is raw tape with the quirk that it does not rewind
232on close, which is a subterfuge that permits
233multifile tapes to be handled.
234.PP
235The next thing to do is to extract the rest of the data from
236the tape.
237Comments are enclosed in ( ); don't type these.
238The number in the first command is the
239size of the file system;
240it differs between RP03, RP04/5, and RP06.
241.DS
242/etc/mkfs /dev/rp3 74000 (153406 if on RP04/5, 322278 on RP06)
243(The above command takes about 2-3 minutes on an RP03)
244dd if=/dev/nrmt0 of=/dev/null bs=20b files=6 (skip 6 files on the tape)
245restor rf /dev/rmt0 /dev/rp3 (restore the file system)
246(Reply with a `return' (CR) to the `Last chance' message)
247(The restor takes about 20-30 minutes)
248.DE
249All of the data on the tape has been extracted.
250.PP
251You may at this point mount the source
252file system (mount(1)). To do this type the following:
253.DS
254/etc/mount /dev/rp3 /usr
255.DE
256The source and manual
257pages are now available in subdirectories of /usr.
258.PP
259The above mount command is only needed if you
260intend to play around with source on a single
261user system, which you are going to do next.
262The file system is mounted automatically when multi-user
263mode is entered, by a command in the file
264/etc/rc. (See `Disk Layout' below).
265.PP
266Before anything further is done the bootstrap
267block on the disk (block 0) should be filled in.
268This is done using the command
269.DS
270dd if=/usr/mdec/rpuboot of=/dev/rp0 count=1
271.DE
272if you have the RP03, or
273.DS
274dd if=/usr/mdec/hpuboot of=/dev/rp0 count=1
275.DE
276if you have an RP04/5/6.
277Now the DEC disk bootstraps are usable.
278See Boot Procedures(8) for further information.
279.PP
280Before UNIX is turned up completely,
281a few configuration dependent exercises must be
282performed.
283At this point,
284it would be wise to read all of the manuals
285(especially `Regenerating System Software')
286and to augment this reading with hand to hand
287combat.
288.SH
289Reconfiguration
290.PP
291The UNIX system running is configured to run
292with the given disk
293and tape, a console, and no other device.
294This is certainly not the correct
295configuration.
296You will have to correct the configuration table to reflect
297the true state of your machine.
298.PP
299It is wise at this point to know how to recompile the system.
300Print (cat(1))
301the file /usr/sys/conf/makefile.
302This file is input to the program `make(1)' which
303if invoked with `make all' will recompile all of
304the system source and
305install it in the correct libraries.
306.PP
307The program mkconf(1) prepares files that
308describe a given configuration (See mkconf(1)).
309In the /usr/sys/conf directory,
310the four files
311\fIxy\fRconf
312were input to mkconf to produce the four versions of the system
313\fIxy\fRunix.
314Pick the appropriate one, and edit it to add lines describing your own configuration.
315(Remember the console typewriter is automatically included;
316don't count it in the kl specification.)
317Then run mkconf;
318it will generate the files l.s
319(trap vectors) c.c (configuration table),
320and mch0.s.
321Take a careful look at
322l.s to make sure that all the devices that you
323have are assembled in the correct interrupt vectors.
324If your configuration is non-standard, you will
325have to modify l.s to fit your configuration.
326.PP
327There are certain magic numbers and
328configuration parameters imbedded in various
329device drivers that you may want to change.
330The device addresses of each device
331are defined in each driver.
332In case you have any non-standard device
333addresses,
334just change the address and recompile.
335(The device drivers are in the directory
336/usr/sys/dev.)
337.PP
338The DC11 driver is set to run 4 lines.
339This can be changed in dc.c.
340.PP
341The DH11 driver is set to handle 3 DH11's with
342a full complement of 48 lines.
343If you have less, or more,
344you may want to edit dh.c.
345.PP
346The DN11 driver will handle 4 DN's.
347Edit dn.c.
348.PP
349The DU11 driver can only handle a single DU.
350This cannot be easily changed.
351.PP
352The KL/DL driver is set up to run
353a single DL11-A, -B, or -C (the console)
354and no DL11-E's.
355To change this, edit
356kl.c to have NKL11 reflect the total number of
357DL11-ABC's and
358NDL11 to reflect the number of DL11-E's.
359So far as the driver is concerned,
360the difference between the devices is
361their address.
362.PP
363All of the disk and tape drivers
364(rf.c, rk.c, rp.c, tm.c, tc.c,
365hp.c, ht.c)
366are set up to run 8 drives and should not
367need to be changed.
368The big disk drivers (rp.c and hp.c)
369have partition tables in them which you
370may want to experiment with.
371.PP
372After all the corrections
373have been made,
374use `make(1)' to recompile the system (or
375recompile individually if you wish: use the makefile
376as a guide).
377If you compiled individually, say `make unix' in the
378directory /usr/sys/conf.
379The final object file (unix) should be
380moved to the root, and then booted to try it out.
381It is best to name it /nunix so as not to destroy
382the working system until you're sure it does work.
383See Boot Procedures(8) for a discussion
384of booting.
385Note: before taking the system down,
386always (!!) perform
387a sync(1)
388to force delayed output to the disk.
389.SH
390Special Files
391.PP
392Next you must put in special files for the new devices in
393the directory /dev using mknod(1).
394Print the configuration file
395c.c created above.
396This is the major
397device switch of each device class (block and character).
398There is one line for each device configured in your system
399and a null line for place holding for those devices
400not configured.
401The essential block special files were installed above;
402for any new devices,
403the major device number is selected by counting the
404line number (from zero)
405of the device's entry in the block configuration table.
406Thus the first entry in the table bdevsw would be
407major device zero.
408This number is also printed in the table along the right margin.
409.PP
410The minor device is the drive number,
411unit number or partition as described
412under each device in section 4 of the manual.
413For tapes where the unit is dial selectable,
414a special file may be made for each possible
415selection.
416You can also add entries for other disk drives.
417.PP
418In reality, device names are arbitrary. It is usually
419convenient to have a system for deriving names, but it doesn't
420have to be the one presented above.
421.PP
422Some further notes on minor device numbers.
423The hp driver uses the 0100 bit of the minor device number to
424indicate whether or not to interleave a file system across
425more than one physical device. See hp(4) for more detail.
426The tm and ht drivers use the 0200 bit to indicate whether
427or not to rewind the tape when it is closed. The
4280100 bit indicates the density of the tape on TU16 drives.
429By convention, tape special files with the 0200 bit on have an `n'
430prepended to their name, as in /dev/nmt0 or /dev/nrmt1.
431Again, see tm(4) or ht(4).
432.PP
433The naming of character devices is similar to block devices.
434Here the names are even more arbitrary except that
435devices meant to be used
436for teletype access should (to avoid confusion, no other reason) be named
437/dev/ttyX, where X is some string (as in `00' or `library').
438The files console, mem, kmem, and null are
439already correctly configured.
440.PP
441The disk and magtape drivers provide a `raw' interface
442to the device which provides direct transmission
443between the user's core and the device and allows
444reading or writing large records.
445The raw device counts as a character device,
446and should have the name of the corresponding
447standard block special file with `r' prepended.
448(The `n' for no rewind tapes violates this rule.)
449Thus the raw magtape
450files would be called /dev/rmtX.
451These special files should be made.
452.PP
453When all the special files have been created,
454care should be taken to change
455the access modes (chmod(1))
456on these files to appropriate values (probably 600 or 644).
457.SH
458Floating Point
459.PP
460UNIX only supports (and really expects to have) the FP11-B/C
461floating point unit.
462For machines without this hardware,
463there is a user subroutine
464available that will catch illegal instruction
465traps and interpret floating point operations.
466(See fptrap(3).)
467To install this subroutine in the library, change to /usr/src/libfpsim
468and execute the shell files
469.DS
470 compall
471 mklib
472.DE
473The system as delivered does not have this code included
474in any command,
475although the operating system adapts automatically to the
476presence or absence of the FP11.
477.PP
478Next, a floating-point version of
479the C compiler in /usr/src/cmd/c
480should be compiled using the commands:
481.DS
482cd /usr/src/cmd/c
483make fc1
484mv fc1 /lib/fc1
485.DE
486This allows programs with floating point constants
487to be compiled.
488To compile floating point programs use the `\-f'
489flag to cc(1). This flag ensures that the floating
490point interpreter is loaded with the program and that
491the floating point version of `cc' is used.
492.SH
493Time Conversion
494.PP
495If your machine is not in the Eastern time zone,
496you must edit (ed(1)) the file
497/usr/sys/h/param.h
498to reflect your local time.
499The manifest `TIMEZONE' should be changed
500to reflect the time difference between local time and GMT in minutes.
501For EST, this is 5*60; for PST it would be 8*60.
502Finally, there is a `DSTFLAG'
503manifest;
504when it is 1 it causes the
505time to shift to Daylight Savings automatically
506between the last Sundays in April and October
507(or other algorithms in 1974 and 1975).
508Normally this will not have to be reset.
509When the needed changes are done, recompile and load the
510system using
511make(1)
512and install it.
513(As a general rule, when a system header file is changed,
514the entire system should be recompiled.
515As it happens, the only uses of these flags are in
516/usr/sys/sys/sys4.c, so if this is all that was changed it
517alone needs to be recompiled.)
518.PP
519You may also want to look at timezone(3)
520(/usr/src/libc/gen/timezone.c) to see
521if the name of your timezone is in its internal table.
522If needed, edit the changes in.
523After timezone.c has been edited
524it should be compiled and installed in
525its library.
526(See /usr/src/libc/(mklib and compall))
527Then you should
528(at your leisure)
529recompile and reinstall
530all programs that use it (such as date(1)).
531.SH
532Disk Layout
533.PP
534If
535there are to be more file systems mounted than just the root
536and /usr,
537use mkfs(1) to create any new file system and
538put its mounting in the file /etc/rc (see init(8) and mount(1)).
539(You might look at /etc/rc anyway to
540see what has been provided for you.)
541.PP
542There are two considerations in deciding how to adjust the arrangement
543of things on your disks:
544the most important is making sure there is adequate space
545for what is required;
546secondarily, throughput should be maximized.
547Swap space is a critical parameter.
548The system
549as distributed has 8778 (hpunix) or 2000 (rpunix) blocks
550for swap space.
551This should be large enough so running out of swap space never
552occurs.
553You may want to change these if local wisdom indicates otherwise.
554.PP
555The system as distributed has all of the binaries in /bin.
556Most of
557them should be moved to /usr/bin, leaving only the ones required for
558system maintenance (such as icheck, dcheck, cc, ed, restor, etc.) and the most
559heavily used in /bin.
560This will speed things up a bit if you have only one disk, and also free
561up space on the root file system for temporary files. (See below).
562.PP
563Many common system programs (C, the editor, the assembler etc.)
564create intermediate files in the /tmp directory,
565so the file system where this is stored also should be made
566large enough to accommodate
567most high-water marks.
568If you leave the root file system as distributed
569(except as discussed above) there
570should be no problem.
571All the programs that create files in /tmp take
572care to delete them, but most are not immune to
573events like being hung up upon, and can leave dregs.
574The directory should be examined every so often and the old
575files deleted.
576.PP
577Exhaustion of user-file space is certain to occur
578now and then;
579the only mechanisms for controlling this phenomenon
580are occasional use of du(1), df(1), quot(1), threatening
581messages of the day, and personal letters.
582.PP
583The efficiency with which UNIX is able to use the CPU
584is largely dictated by the configuration of disk controllers.
585For general time-sharing applications,
586the best strategy is to try to split user files,
587the root directory (including the /tmp directory)
588and the swap area among three controllers.
589.PP
590Once you have decided how to make best use
591of your hardware, the question is how to initialize it.
592If you have the equipment,
593the best way to move a file system
594is to dump it (dump(1)) to magtape,
595use mkfs(1) to create the new file system,
596and restore (restor(1)) the tape.
597If for some reason you don't want to use magtape,
598dump accepts an argument telling where to put the dump;
599you might use another disk.
600Sometimes a file system has to be increased in logical size
601without copying.
602The super-block of the device has a word
603giving the highest address which can be allocated.
604For relatively small increases, this word can be patched
605using the debugger (adb(1))
606and the free list reconstructed using icheck(1).
607The size should not be increased very greatly
608by this technique, however,
609since although the allocatable space will increase
610the maximum number of files will not (that is, the i-list
611size can't be changed).
612Read and understand the description given in file system(5)
613before playing around in this way.
614You may want to
615see section rp(4) for some suggestions
616on how to lay out the information on RP disks.
617.PP
618If you have to merge a file system into another, existing one,
619the best bet is to
620use tar(1).
621If you must shrink a file system, the best bet is to dump
622the original and restor it onto the new filesystem.
623However, this might not work if the i-list on the smaller filesystem
624is smaller than the maximum allocated inode on the larger.
625If this is the case, reconstruct the filesystem from scratch
626on another filesystem (perhaps using tar(1)) and then dump it.
627If you
628are playing with the root file system and only have one drive
629the procedure is more complicated. What you do is the following:
630.IP 1.
631GET A SECOND PACK!!!!
632.IP 2.
633Dump the current root filesystem (or the reconstructed one) using dump(1).
634.IP 3.
635Bring the system down and mount the new pack.
636.IP 4.
637Retrieve the WECo distribution tape and perform steps 1 through
6385 at the beginning of this document,
639substituting the desired file system size instead of 5000
640when asked for `file system size'.
641.IP 5.
642Perform step 6 above up to the point where the `tape'
643question is asked. At this point mount the tape
644you made just a few minutes ago. Continue with step 6 above substituting
645a 0 (zero) for the 5.
646.SH
647New Users
648.PP
649Install new users by editing the password file
650/etc/passwd (passwd(5)).
651This procedure should be done once multi-user mode is entered
652(see init(8)).
653You'll have to make a current directory for each new user
654and change its owner to the
655newly installed name.
656Login as each user to make sure the password
657file is correctly edited.
658For example:
659.DS
660ed /etc/passwd
661$a
662joe::10:1::/usr/joe:
663.li
664.
665w
666q
667mkdir /usr/joe
668chown joe /usr/joe
669login joe
670ls \-la
671login root
672.DE
673This will make a new login entry for joe,
674who should be encouraged to use passwd(1)
675to give himself a password.
676His default current directory is
677/usr/joe
678which has been created.
679The delivered password file
680has the user
681.I
682bin
683.R
684in it to be used as a prototype.
685.SH
686Multiple Users
687.PP
688If UNIX is to support simultaneous
689access from more than just the console terminal,
690the file /etc/ttys (ttys(5)) has to be edited.
691To add a new terminal be sure the device is configured
692and the special file exists, then set
693the first character of the appropriate line of /etc/ttys to 1
694(or add a new line).
695Note that init.c will have to be recompiled if there are to be
696more than 100 terminals.
697Also note that if the special file is inaccessible when init tries to create a process
698for it, the system will thrash trying and retrying to open it.
699.SH
700File System Health
701.PP
702Periodically (say every day or so) and always after a crash,
703you should check all the file systems for consistency
704(icheck, dcheck(1)).
705It is quite important to execute sync (8)
706before rebooting or taking the machine down.
707This is done automatically every 30 seconds by the update
708program (8) when a multiple-user system is running,
709but you should do it anyway to make sure.
710.PP
711Dumping of the file system should be done regularly,
712since once the system is going it is very easy to
713become complacent.
714Complete and incremental dumps are easily done with
715dump(1).
716Dumping of files by name is best done by
717tar(1) but the number of files is somewhat limited.
718Finally if there are enough drives entire
719disks can be copied using cp(1), or preferably with
720dd(1) using the raw special files and an appropriate
721block size.
722.SH
723Converting Sixth Edition Filesystems
724.PP
725The best way to convert file systems from 6th
726edition (V6) to 7th edition (V7) format
727is to use tar(1). However, a special version of tar must
728be prepared
729to run on V6.
730The following steps will do this:
731.IP 1.
732change directories to /usr/src/cmd/tar
733.IP 2.
734At the shell prompt respond
735.DS
736make v6tar
737.DE
738This will leave an executable binary named `v6tar'.
739.IP 3.
740Mount a scratch tape.
741.IP 4.
742Use tp(1) to put `v6tar' on the scratch
743tape.
744.IP 5.
745Bring down V7 and bring up V6.
746.IP 6.
747Use tp (on V6) to read in `v6tar'. Put it in
748/bin or /usr/bin (or perhaps some other preferred location).
749.IP 7.
750Use v6tar to make tapes of all that you wish to convert.
751You may want to read the manual section on tar(1) to
752see whether you want to use blocking or not.
753Try to avoid using full pathnames when making the tapes. This
754will simplify moving the hierarchy to some other place on
755V7 if desired. For example
756.DS
757chdir /usr/ken
758v6tar c .
759.DE
760is preferable to
761.DS
762v6tar c /usr/ken
763.DE
764.IP 8.
765After all of the desired tapes are made, bring
766down V6 and reboot V7. Use
767tar(1) to read in the tapes just made.
768.SH
769Odds and Ends
770.PP
771The programs
772dump,
773icheck, quot, dcheck, ncheck, and df
774(source in /usr/source/cmd)
775should be changed to
776reflect your default mounted file system devices.
777Print the first few lines of these
778programs and the changes will be obvious.
779Tar should be changed to reflect your desired
780default tape drive.
781.sp 3
782.in 4i
783Good Luck
784.sp 1
785Charles B. Haley
786.br
787Dennis M. Ritchie