Subject: booting from drive other than 0 (#322) Index: sys/init_main.c,pdpstand/boot.c,etc/init.c 2.11BSD Description: Booting kernels other than the GENERIC kernel from drives other than unit 0 require the root filesystem device to be compiled in. The GENERIC kernel on the other hand automatically adapts to being booted from any unit by switching the root device (as well as swapdev and pipedev) to the load device. The man page for reboot(8) was very much out of date. Repeat-By: Copy the root filesystem (containing a non-GENERIC kernel) from drive 0 to drive 1. Then turn drive 0 offline and boot from unit 1. Note that the kernel panics when it is not able to mount the root filesystem or access the swap partition. This is because the compiled in 'rootdev' is still drive 0 rather than the load device (drive 1). Fix: The automatic adapting to the load device was generalized and is no longer specific to the GENERIC kernel. The kernel can be forced to use the compiled in root device by means of the "-bootflags -R" command. /boot now accepts commands to set the boot options that are passed thru to the kernel (and then on to /etc/init). A new man page has been created (boot(8)) describing these commands. A new flag has been defined which enables the 'debug' mode of autoconfig(8) to be enabled without having to recompile /etc/init or /etc/autoconfig. This flag is turned on with the "-bootflags -D" command to boot. With this update installed it is very easy to run 2.11BSD from any disk unit in the system as long as two steps are taken: 1) references to disks in /etc/fstab need to be changed to have the correct disk drive number. For example, moving the system from drive 0 to drive 1 means that: /dev/ra0a / ufs rw 1 1 /dev/ra0b none swap sw /dev/ra0c /users ufs rw 1 2 /dev/ra0d /tmp ufs rw 1 3 /dev/ra0e /usr ufs rw 1 4 /dev/ra0f /sysprog ufs rw 1 5 has to be changed to: /dev/ra1a / ufs rw 1 1 /dev/ra1b none swap sw /dev/ra1c /users ufs rw 1 2 /dev/ra1d /tmp ufs rw 1 3 /dev/ra1e /usr ufs rw 1 4 /dev/ra1f /sysprog ufs rw 1 5 2) /dev/swap and /dev/drum need to be recreated so they refer to the correct drive (1 instead of 0): cd /dev rm swap drum ln ra1b swap ln ra1b drum The update consists of: new man page for boot(8). patch for the autoconfig(8) and reboot(8) man pages. patch for init(8) to pass the 'autoconfig debug' flag thru to autoconfig. patch for systm.h and reboot.h patch for init_main.c in the kernel. patch for /boot and the reboot program. Cut where indicated, saving to a file (/tmp/322). Then: sh /tmp/322 patch -p0 < /tmp/322.patch sh /tmp/322.shar cd /usr/src/man/man8 /usr/man/manroff autoconfig.8 > autoconfig.0 /usr/man/manroff boot.8 > boot.0 /usr/man/manroff reboot.8 > reboot.0 install -m 444 autoconfig.0 boot.0 reboot.0 /usr/man/cat8 cd /usr/src/etc make init reboot cp reboot /etc/reboot mv /etc/init /etc/init.old install -m 755 -s init /etc/init And hope you do not have a power outage between those last two steps. If /etc/init is not present the system can not start running. cd /sys/pdpstand make clean make cp boot /boot cd /sys/YOUR_KERNEL make make install reboot You may wish to update the 'whatis' database to include the new man page: /usr/lib/makewhatis This and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. =============================cut here========================== #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # /tmp/322.shar # /tmp/322.patch # This archive created: Mon May 27 18:00:03 1996 export PATH; PATH=/bin:/usr/bin:$PATH if test -f '/tmp/322.shar' then echo shar: "will not over-write existing file '/tmp/322.shar'" else sed 's/^Z//' << \SHAR_EOF > '/tmp/322.shar' Z#! /bin/sh Z# This is a shell archive, meaning: Z# 1. Remove everything above the #! /bin/sh line. Z# 2. Save the resulting text in a file. Z# 3. Execute the file with /bin/sh (not csh) to create: Z# /usr/src/man/man8/boot.8 Z# This archive created: Mon May 27 17:58:30 1996 Zexport PATH; PATH=/bin:/usr/bin:$PATH Zif test -f '/usr/src/man/man8/boot.8' Zthen Z echo shar: "will not over-write existing file '/usr/src/man/man8/boot.8'" Zelse Zsed 's/^Y//' << \SHAR_EOF > '/usr/src/man/man8/boot.8' ZY.\" Public domain. May 24, 1996. ZY.\" ZY.\" @(#)reboot.8 1.0 (2.11BSD) 1996/5/24 ZY.\" ZY.TH BOOT 8 "May 24, 1996" ZY.UC 2 ZY.SH NAME ZYboot \- 2.11BSD bootstrap proceedure ZY.SH DESCRIPTION ZY.PP ZYThe 2.11BSD system is started by a two-stage process. The first is a ZYprimary bootstrap (limited to 512 bytes) which is able to read in ZYrelatively small stand-alone ZYprograms; the second (called ZY.IR boot ) ZYis used to read in the system itself. ZY.PP ZYThe primary bootstrap must reside in block zero of the ZYboot device (the disklabel resides in block one). It can be read ZYin and started by standard ROM cold boot ZYroutines or, if necessary, by keying in a small startup routine. The ZYprimary bootstrap is capable of loading \fBonly\fP type 0407 executable ZYfiles (impure ZY(non-shared), non-separate I&D.) ZYCopies of the block zero bootstraps are kept in the directory ZY.IR /mdec . ZY.IR Disklabel (8) ZYis normally used to place a copy of the appropriate bootstrap in block zero of ZYnew file systems. ZY.PP ZYThe primary bootstrap loads ZY.I boot ZYfrom the file system that starts at block 0 of the drive specified to ZYthe boot ROM. Normally the boot device is automatically used as the root ZYfilesystem. This action can be overriden by specifying the \fB\-R\fP command ZYto \fIboot\fP. ZYIf ZY.I boot ZYis not found the system will hang as the primary boot spins in an endless ZYloop trying to find \fIboot\fP. ZYNo diagnostic message results if the file cannot ZYbe found. ZY.IP \(bu ZY.BR "In an emergency" , ZYthe bootstrap methods described in the paper ZY.I "Installing and Operating 2.11BSD" ZYcan be used to boot from a distribution tape. ZY.PP ZYThe secondary boot program, called ZY.IR boot , ZYactually brings in the system. When read into location 0 and executed, ZY.I boot ZYsets up memory management, relocates itself into high memory, and types its ZYname and a `:' on the console. If this is an automatic, unattended reboot, ZY.I boot ZYwill use a default file specification for the installation, typing the ZYfile's name after the prompt. Otherwise, it reads a file specification ZYfrom the console. Normal line editing characters can be used to make ZYcorrections while typing this (see below for file specification format). ZYIf only a carriage return is typed, a default name (/unix) will be used. ZY.I Boot ZYfinds the [specified] file and loads it into memory location zero, sets up ZYmemory management as required, and calls the program by executing a `trap' ZYinstruction. ZY.PP ZYFor the system to boot, ZY.I /etc/init ZYmust exist and be executable; if it is not, the kernel will print a message ZYto that effect and loop. Further, for a single user boot, the files ZY.I /bin/sh ZYand ZY.I /dev/console ZYmust also exist and ZY.I /bin/sh ZYmust be executable (if either of these is missing, ZY.I init ZYwill attempt multi-user operation). ZYFor a multi-user boot the file ZY.I /etc/ttys ZYmust exist (if missing, ZY.I init ZYwill attempt single user operation). ZY.PP ZY.I Init ZYruns the ZY.IR autoconfig (8) ZYprogram to probe for and initialize devices. ZY.I Autoconfig ZYonly knows to look in \fI/unix\fP, thus if an alternate kernel name was ZYspecified none of the devices except \fI/dev/console\fP and the boot disk ZYwill be known. ZY.PP ZYIf \fIautoconfig\fP problems are suspected (or if you are simply ZYvoyeuristic) the \fBdebug\fP flag can be turned on by specifying ZY\fB\-D\fP to \fIboot\fP (see below). ZY.PP ZYWhen the system is running in single user mode, it starts a single user ZYshell on the console which types a `#' prompt. After doing any file system ZYchecks and setting the date ZY.RI ( date (1)) ZYa multi-user system can be brought up by typing an EOT (control-d) in ZYresponse to the `#' prompt. ZY.PP ZY.B "Boot file specification format:" ZYThe file specifications used with ZY.I boot ZYare of the form: ZY.IP ZY.I device(ctlr,unit,part)path [-aRrDs] ZY.LP ZYor ZY.IP ZY.I \-bootcommand ZY.LP ZYwhere ZY.TP ZY.I device ZYis the type of the device to be searched; ZY.TP ZY.I ctlr ZYis the controller number of the disk ZY.TP ZY.I unit ZYis the unit number of the disk or tape; ZY.TP ZY.I part ZYis the partition number of a filesystem on the specified disk ZYor the tape file number if the device is a tape. ZYThe underlying ZYdevice driver \fBmust\fP support disklabels and a valid disklabel must be ZYpresent if \fIpart\fP is anything except 0. ZY.TP ZY.I path ZYis the path name of a disk file to be loaded with all mount prefixes ZYstripped off ZY.RI ( path ZYmust be omitted for tape files.) Tape files are separated by single tape ZYmarks. ZY.PP ZYFlags to \fIboot\fP may be specified in either of two places. At the ZY\fB:\fP prompt and after the \fIfile\fP name. The options are: ZY.TP ZY.B \-a ZYAsk for a kernel name. This is present for symmetry only because in order ZYto specify this option you already have to be at the \fB:\fP prompt. ZY.TP ZY.B \-D ZYTurn on the ZY.I autoconfig ZYdebug flag. ZY.TP ZY.B \-R ZYforce the kernel to use its compiled in root device rather than adapting ZYto the boot device. ZY.TP ZY.B \-s ZYtell ZY.I init ZYto enter single user state rather than bringing the system all the way ZYup to multi-user mode. ZY.B \-r ZYmount the root filesystem read-only. This is not currently supported by ZYthe kernel mostly because pipes are implemented in the filesystem. ZY.LP ZYCommands (\fI\-bootcommand\fP) to \fIboot\fP are: ZY.TP 20 ZY.B \-bootflags N ZYwhere N is a decimal number. ZY.TP 20 ZY.B \-bootflags flag ZYwhere \fBflag\fP is from the list above. ZY.TP 20 ZY.B \-bootdebug N ZYwhere N is a decimal number. This is a general purpose flag word used ZYby \fIboot\fP and is not passed to the loaded program or kernel. ZY.PP ZY.I Device ZYis one of the following ZY.PP ZY.nf ZY.ne 10 ZY xp RM02/03/05, RP04/05/06, DIVA, SI Eagle, CDC 9766, Fuji 160 ZY rp RP03 ZY rk RK05 ZY hk RK06/7 ZY rl RL01/2 ZY si RM05, CDC 9766 ZY ra RA60/80/81, RX50, RD51/52/53, RC25 ZY ht TU/TE16 ZY tm TU/TE10 ZY ts TS-11 ZY.fi ZY.PP ZYThe stand alone tape drive unit number is specially encoded to specify ZYboth unit number and tape density (BPI). Most tape subsystems either ZYautomatically adjust to tape density or have switches on the drives to ZYforce the density to a particular setting, but for those which don't the ZYfollowing density select mechanisms may be necessary. The \fBts\fP only ZYoperates at 1600BPI, so there is no special unit density encoding. The ZY\fBht\fP will operate at either 800BPI or 1600BPI. Units 0 through 3 ZYcorrespond to 800BPI, and 4 through 7 to 1600BPI on drives 0 through 3 ZYrespectively. The standard DEC \fBtm\fP only supports 800BPI (and hence ZYcan't be used with the standard \*(2B distribution tape), but several ZYwidely used \fBtm\fP emulators support 1600BPI and even 6250BPI. Units 0 ZYthrough 3 correspond to 800BPI, 4 through 7 to 1600BPI, and 8 through 11 ZYto 6250BPI on drives 0 through 3 respectively. ZY.PP ZYFor example, to boot a system from unit 0 on an RK07, ZYtype \*(lqhk(0,0)unix\*(rq to the boot prompt. The specification ZY\*(lqra(1,0)unix\*(rq indicates an MSCP disk, unit 1. The specification ZY\*(lqra(1,0,0)unix\*(rq indicates an MSCP disk, unit 0 but on controller ZY1. ZYAnd finally the specification ZY\*(lqts(0,3)\*(rq would cause the fourth file on a tape threaded on `ts' ZYtape drive 0 to be loaded and executed. ZY.PP ZY.B "Cold boot loaders:" ZYThe following programs to load and execute the primary bootstrap may be ZYinstalled in read-only memories or manually keyed into main memory. Each ZYprogram is position-independent but should be placed well above location 0 ZYso it will not be overwritten. Each reads a block from the beginning of a ZYdevice into core location zero. The octal words constituting the program ZYare listed on the left. ZY.PP ZY.nf ZY.if n .ta 3 11 15 23 38 ZY.if t .ta .3i 1i 1.4i 2i 3.5i ZY.ne 10 ZYRK (drive 0): ZY 012700 mov $rkda,r0 ZY 177412 ZY 005040 clr \-(r0) / rkda cleared by start ZY 010040 mov r0,\-(r0) ZY 012740 mov $5,\-(r0) ZY 000005 ZY 105710 1: tstb (r0) ZY 002376 bge 1b ZY 005007 clr pc ZY.PP ZY.ne 11 ZYRP (drive 0) ZY 012700 mov $rpmr,r0 ZY 176726 ZY 005040 clr \-(r0) ZY 005040 clr \-(r0) ZY 005040 clr \-(r0) ZY 010040 mov r0,\-(r0) ZY 012740 mov $5,\-(r0) ZY 000005 ZY 105710 1: tstb (r0) ZY 002376 bge 1b ZY 005007 clr pc ZY.PP ZY.ne 7 ZYTM (drive 0): ZY 012700 mov $tmba,r0 ZY 172526 ZY 010040 mov r0,\-(r0) ZY 012740 mov $60003,\-(r0) ZY 060003 ZY 000777 br . ZY.DT ZY.SH FILES ZY.ta \w'/mdec/xxuboot 'u ZY/unix system code ZY.br ZY/boot system bootstrap ZY.br ZY/etc/init system process dispatcher ZY.br ZY/mdec/xxuboot sector 0 boot blocks, xx is disk type ZY.SH "SEE ALSO" ZYcrash(8V), ZYautoconfig(8), ZYreboot(2), ZYdisklabel(8), ZYfsck(8), ZYinit(8) ZSHAR_EOF Zchmod 444 '/usr/src/man/man8/boot.8' Zfi Zexit 0 Z# End of shell archive SHAR_EOF chmod 755 '/tmp/322.shar' fi if test -f '/tmp/322.patch' then echo shar: "will not over-write existing file '/tmp/322.patch'" else sed 's/^Z//' << \SHAR_EOF > '/tmp/322.patch' Z*** /usr/src/sys/sys/init_main.c.old Sun Dec 24 12:11:52 1995 Z--- /usr/src/sys/sys/init_main.c Thu May 9 20:37:05 1996 Z*************** Z*** 3,9 **** Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)init_main.c 2.0 (2.11BSD GTE) 1995/12/24 Z */ Z Z #include "param.h" Z--- 3,9 ---- Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)init_main.c 2.1 (2.11BSD GTE) 1996/5/9 Z */ Z Z #include "param.h" Z*************** Z*** 105,124 **** Z nchinit(); Z clkstart(); Z Z- #ifdef GENERIC Z /* Z! * If this is the GENERIC kernel we set 'rootdev' to be the same as Z! * the device booted from. 'swapdev' is set to the the 'b' partition Z! * of 'bootdev'. Set 'pipedev' to be 'rootdev'. The 077 in the first Z! * statement removes the controller number (bits 6 and 7) - those bits Z! * are passed thru from /boot but would only greatly confuse the rest Z! * of the kernel. Z */ Z! rootdev = makedev(major(bootdev), minor(bootdev) & 077); Z! swapdev = rootdev | 1; /* partition 'b' */ Z! pipedev = rootdev; Z! dumpdev = NODEV; /* paranoia */ Z! #endif Z Z /* Z * Need to attach the root device. The CSR is passed thru because this Z--- 105,133 ---- Z nchinit(); Z clkstart(); Z Z /* Z! * If the kernel is configured for the boot/load device AND the use of the Z! * compiled in 'bootdev' has not been overridden (by turning on RB_DFLTROOT, Z! * see conf/boot.c for details) THEN switch 'rootdev', 'swapdev' and 'pipedev' Z! * over to the boot/load device. Set 'pipedev' to be 'rootdev'. Z! * Z! * The &077 removes the controller number (bits 6 and 7) - those bits are Z! * passed thru from /boot but would only greatly confuse the rest of the kernel. Z */ Z! i = major(bootdev); Z! if ((bdevsw[i].d_strategy != nodev) && !(boothowto & RB_DFLTROOT)) Z! { Z! rootdev = makedev(i, minor(bootdev) & 077); Z! swapdev = rootdev | 1; /* partition 'b' */ Z! pipedev = rootdev; Z! /* Z! * We check that the dump device is the same as the boot device. If it is Z! * different then it is likely that crashdumps go to a tape device rather than Z! * the swap area. In that case do not switch the dump device. Z! */ Z! if ((dumpdev != NODEV) && major(dumpdev) == i) Z! dumpdev = swapdev; Z! } Z Z /* Z * Need to attach the root device. The CSR is passed thru because this Z*** /usr/src/sys/h/reboot.h.old Sun May 31 21:29:56 1987 Z--- /usr/src/sys/h/reboot.h Thu May 9 20:02:43 1996 Z*************** Z*** 3,9 **** Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)reboot.h 1.1 (2.10BSD Berkeley) 12/1/86 Z */ Z Z /* Z--- 3,9 ---- Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)reboot.h 1.2 (2.11BSD GTE) 1996/5/9 Z */ Z Z /* Z*************** Z*** 23,28 **** Z--- 23,29 ---- Z #define RB_NOFSCK 0x080 /* don't perform fsck's on reboot */ Z #define RB_POWRFAIL 0x100 /* reboot caused by power failure */ Z #define RB_RDONLY 0x200 /* mount root fs read-only */ Z+ #define RB_AUTODEBUG 0x400 /* init runs autoconfig with "-d" (debug) */ Z Z #define RB_PANIC 0 /* reboot due to panic */ Z #define RB_BOOT 1 /* reboot due to boot() */ Z*** /usr/src/sys/h/systm.h.old Fri Jan 20 19:49:52 1995 Z--- /usr/src/sys/h/systm.h Thu May 9 20:39:34 1996 Z*************** Z*** 3,9 **** Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)systm.h 1.2 (2.11BSD GTE) 12/29/94 Z */ Z Z #ifndef SUPERVISOR Z--- 3,9 ---- Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)systm.h 1.3 (2.11BSD GTE) 1996/5/9 Z */ Z Z #ifndef SUPERVISOR Z*************** Z*** 66,71 **** Z--- 66,72 ---- Z long dumplo; /* offset into dumpdev */ Z dev_t swapdev; /* swapping device */ Z dev_t pipedev; /* pipe device */ Z+ int nodev(); /* no device function used in bdevsw/cdevsw */ Z Z extern int icode[]; /* user init code */ Z extern int szicode; /* its size */ Z*** /usr/src/sys/pdpstand/boot.c.old Thu Jun 8 19:31:39 1995 Z--- /usr/src/sys/pdpstand/boot.c Thu May 9 22:08:02 1996 Z*************** Z*** 3,9 **** Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)boot.c 2.3 (2.11BSD) 1995/06/08 Z */ Z #include "../h/param.h" Z #include "../machine/seg.h" Z--- 3,9 ---- Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)boot.c 3.0 (2.11BSD) 1996/5/9 Z */ Z #include "../h/param.h" Z #include "../machine/seg.h" Z*************** Z*** 47,52 **** Z--- 47,53 ---- Z u_short pdrproto[16 + NOVL] = {0}; Z struct exec exec; Z struct ovlhdr ovlhdr; Z+ int bootdebug; Z unsigned btoc(); Z Z struct loadmap { Z*************** Z*** 172,181 **** Z--- 173,190 ---- Z */ Z if (checkword != ~bootopts) Z bootopts = RB_SINGLE | RB_ASKNAME; Z+ j = -1; Z do { Z if (bootopts & RB_ASKNAME) { Z+ another: Z printf(": "); Z gets(line); Z+ cp = line; Z+ if (*cp == '-') Z+ { Z+ dobootopts(cp, &bootopts); Z+ goto another; Z+ } Z } else { Z strcpy(line, defdev); Z strcat(line, defname); Z*************** Z*** 196,203 **** Z bcopy(line, line + strlen(defdev), strlen(line) + 1); Z bcopy(defdev, line, strlen(defdev)); Z } Z- i = open(line, 0); Z j = -1; Z if (i >= 0) { Z file = &iob[i - 3]; /* -3 for pseudo stdin/o/e */ Z j = checkunix(i, setup(i)); Z--- 205,221 ---- Z bcopy(line, line + strlen(defdev), strlen(line) + 1); Z bcopy(defdev, line, strlen(defdev)); Z } Z j = -1; Z+ if (cp = index(line, ' ')) Z+ { Z+ if ((bootflags(cp, &bootopts, "bootfile")) == -1) Z+ { Z+ bootopts |= RB_ASKNAME; Z+ continue; Z+ } Z+ *cp = '\0'; Z+ } Z+ i = open(line, 0); Z if (i >= 0) { Z file = &iob[i - 3]; /* -3 for pseudo stdin/o/e */ Z j = checkunix(i, setup(i)); Z*************** Z*** 592,594 **** Z--- 610,753 ---- Z { Z return((unsigned)(((((long) nclicks) + ((long) 63)) >> 6))); Z } Z+ Z+ /* Z+ * Couldn't use getopt(3) for a couple reasons: 1) because that would end up Z+ * dragging in way too much of libc.a, and 2) the code to build argc Z+ * and argv would be almost as large as the parsing routines themselves. Z+ */ Z+ Z+ char * Z+ arg(cp) Z+ register char *cp; Z+ { Z+ Z+ if ((cp = index(cp, ' ')) == NULL) Z+ return(NULL); Z+ while (*cp == ' ' || *cp == '\t') Z+ cp++; Z+ if (*cp == '\0') Z+ return(NULL); Z+ return(cp); Z+ } Z+ Z+ /* Z+ * Flags to boot may be present in two places. 1) At the ': ' prompt enter Z+ * a line starting with "-bootflags". 2) After the filename. For example, Z+ * to turn on the autoconfig debug flag: Z+ * Z+ * : -bootflags -D Z+ * Z+ * To force the kernel to use the compiled in root device (which also affects Z+ * swapdev, pipedev and possibly dumpdev): Z+ * Z+ * : -bootflags -R Z+ * Z+ * To specify flags on the filename line place the options after the filename: Z+ * Z+ * : ra(0,0)unix -D -s Z+ * Z+ * will cause the kernel to use the compiled in root device (rather than auto Z+ * matically switching to the load device) and enter single user mode. Z+ * Z+ * Bootflags may also be specified as a decimal number (you will need the Z+ * sys/reboot.h file to look up the RB_* flags in). Turning all bootflags off Z+ * is the special case: Z+ * Z+ * : -bootflags 0 Z+ * Z+ * There is a general purpose 'debug' flag word ("bootdebug") which can be Z+ * set to any arbitrary 16 bit value. This can be used when debugging a Z+ * driver for example. Z+ * Z+ * : -bootdebug 16 Z+ */ Z+ Z+ #define BOOTFLAGS "-bootflags" Z+ #define BOOTDEBUG "-bootdebug" Z+ Z+ dobootopts(cp, opt) Z+ register char *cp; Z+ int *opt; Z+ { Z+ char *bflags = BOOTFLAGS; Z+ char *bdebug = BOOTDEBUG; Z+ Z+ if (strncmp(cp, bdebug, sizeof (BOOTDEBUG) - 1) == 0) Z+ { Z+ if (cp = arg(cp)) Z+ bootdebug = atoi(cp); Z+ else Z+ printf("%s = %u\n", bdebug, bootdebug); Z+ return(0); Z+ } Z+ if (strncmp(cp, bflags, sizeof (BOOTFLAGS) - 1) == 0) Z+ { Z+ if (cp = arg(cp)) Z+ (void) bootflags(cp, &bootopts, bflags); Z+ else Z+ printf("%s = %u\n", bflags, bootopts); Z+ return(0); Z+ } Z+ printf("bad cmd: %s\n", cp); Z+ return(0); Z+ } Z+ Z+ bootflags(cp, pflags, tag) Z+ register char *cp; Z+ int *pflags; Z+ char *tag; Z+ { Z+ int first = 1; Z+ int flags = 0; Z+ Z+ while (*cp) Z+ { Z+ while (*cp == ' ') Z+ cp++; Z+ if (*cp == '\0') Z+ break; Z+ if (*cp == '-') Z+ { Z+ first = 0; Z+ while (*++cp) Z+ switch (*cp) Z+ { Z+ case ' ': Z+ goto nextarg; Z+ case 'a': Z+ flags |= RB_ASKNAME; Z+ break; Z+ case 'D': Z+ flags |= RB_AUTODEBUG; Z+ break; Z+ case 'r': Z+ flags |= RB_RDONLY; Z+ break; Z+ case 'R': Z+ flags |= RB_DFLTROOT; Z+ break; Z+ case 's': Z+ flags |= RB_SINGLE; Z+ break; Z+ default: Z+ goto usage; Z+ } Z+ continue; Z+ } Z+ if (first && *cp >= '0' && *cp <= '9') Z+ { Z+ *pflags = atoi(cp); Z+ return(0); Z+ } Z+ goto usage; Z+ Z+ nextarg: ; Z+ } Z+ if (first == 0) Z+ *pflags = flags; Z+ return(0); Z+ usage: Z+ printf("usage: %s [ -aDrRs ]\n", tag); Z+ return(-1); Z+ } Z*** /usr/src/etc/reboot.c.old Mon Jan 10 21:52:52 1994 Z--- /usr/src/etc/reboot.c Thu May 9 21:22:50 1996 Z*************** Z*** 9,15 **** Z "@(#) Copyright (c) 1980,1986 Regents of the University of California.\n\ Z All rights reserved.\n"; Z Z! static char sccsid[] = "@(#)reboot.c 5.5.1 (2.11BSD) 1/1/94"; Z #endif Z Z /* Z--- 9,15 ---- Z "@(#) Copyright (c) 1980,1986 Regents of the University of California.\n\ Z All rights reserved.\n"; Z Z! static char sccsid[] = "@(#)reboot.c 5.5.2 (2.11BSD) 1996/5/9"; Z #endif Z Z /* Z*************** Z*** 25,35 **** Z #include Z #include Z Z! #ifdef pdp11 Z! # define OPTS "lqnhdarsf" Z! #else Z! # define OPTS "lqnhdarsfk" Z! #endif Z Z main(argc, argv) Z int argc; Z--- 25,31 ---- Z #include Z #include Z Z! #define OPTS "lqnhdarsfRD" Z Z main(argc, argv) Z int argc; Z*************** Z*** 70,78 **** Z case 'r': howto |= RB_RDONLY; break; Z case 's': howto |= RB_SINGLE; break; Z case 'f': howto |= RB_NOFSCK; break; Z! #ifndef pdp11 Z! case 'k': howto |= RB_KDB; break; Z! #endif Z case '?': Z fprintf(stderr, Z "usage: %s [-%s]\n", myname, OPTS); Z--- 66,73 ---- Z case 'r': howto |= RB_RDONLY; break; Z case 's': howto |= RB_SINGLE; break; Z case 'f': howto |= RB_NOFSCK; break; Z! case 'R': howto |= RB_DFLTROOT; break; Z! case 'D': howto |= RB_AUTODEBUG; break; Z case '?': Z fprintf(stderr, Z "usage: %s [-%s]\n", myname, OPTS); Z*** /usr/src/etc/init.c.old Thu May 4 22:36:19 1995 Z--- /usr/src/etc/init.c Thu May 9 21:33:10 1996 Z*************** Z*** 5,11 **** Z */ Z Z #if defined(DOSCCS) && !defined(lint) Z! static char sccsid[] = "@(#)init.c 5.6.2 (2.11BSD GTE) 1995/05/04"; Z #endif Z Z #include Z--- 5,11 ---- Z */ Z Z #if defined(DOSCCS) && !defined(lint) Z! static char sccsid[] = "@(#)init.c 5.6.3 (2.11BSD GTE) 1996/5/9"; Z #endif Z Z #include Z*************** Z*** 117,124 **** Z Z openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH); Z #ifdef pdp11 Z! if (autoconfig() == 0) Z! howto = RB_SINGLE; Z #endif Z signal(SIGSYS, badsys); Z sigvec(SIGTERM, &rvec, (struct sigvec *)0); Z--- 117,124 ---- Z Z openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH); Z #ifdef pdp11 Z! if (autoconfig(howto) == 0) Z! howto = RB_SINGLE | (howto & RB_AUTODEBUG); Z #endif Z signal(SIGSYS, badsys); Z sigvec(SIGTERM, &rvec, (struct sigvec *)0); Z*************** Z*** 743,749 **** Z #ifdef pdp11 Z #include Z Z! autoconfig() Z { Z int pid, status, f; Z static char config[]= "/etc/autoconfig"; Z--- 743,750 ---- Z #ifdef pdp11 Z #include Z Z! autoconfig(howto) Z! int howto; Z { Z int pid, status, f; Z static char config[]= "/etc/autoconfig"; Z*************** Z*** 755,761 **** Z dup2(f, 0); Z dup2(0, 1); Z dup2(0, 2); Z! execl(config, "autoconfig", "-vc", 0); Z syslog(LOG_ERR, "init: couldn't exec %s\n", config); Z exit(AC_SETUP); Z } Z--- 756,763 ---- Z dup2(f, 0); Z dup2(0, 1); Z dup2(0, 2); Z! execl(config, "autoconfig", Z! howto & RB_AUTODEBUG ? "-vcd" : "-vc", 0); Z syslog(LOG_ERR, "init: couldn't exec %s\n", config); Z exit(AC_SETUP); Z } Z*** /usr/src/man/man8/reboot.8.old Tue Sep 6 23:38:37 1988 Z--- /usr/src/man/man8/reboot.8 Fri May 24 19:35:11 1996 Z*************** Z*** 2,17 **** Z .\" All rights reserved. The Berkeley software License Agreement Z .\" specifies the terms and conditions for redistribution. Z .\" Z! .\" @(#)reboot.8 6.5 (Berkeley) 9/6/88 Z .\" Z! .TH REBOOT 8 "September 6, 1988" Z .UC 2 Z .SH NAME Z! reboot \- UNIX bootstrapping procedures Z .SH SYNOPSIS Z .B /etc/reboot Z [ Z! .B \-lqnhdarsf Z ] Z .br Z .B /etc/halt Z--- 2,17 ---- Z .\" All rights reserved. The Berkeley software License Agreement Z .\" specifies the terms and conditions for redistribution. Z .\" Z! .\" @(#)reboot.8 2.1 (2.11BSD) 1996/5/24 Z .\" Z! .TH REBOOT 8 "May 24, 1996" Z .UC 2 Z .SH NAME Z! reboot \- stopping and restarting the system Z .SH SYNOPSIS Z .B /etc/reboot Z [ Z! .B \-lqnhdarsfRD Z ] Z .br Z .B /etc/halt Z*************** Z*** 21,36 **** Z .br Z .B /etc/fastboot Z [ Z! .B \-lqndars Z ] Z .SH DESCRIPTION Z! .PP Z! UNIX is started by placing it in memory at location zero and transferring to Z its entry point. Since the system is not reentrant, it is necessary to read Z it in from disk or tape each time it is to be boot strapped. Z .PP Z .B "Rebooting a running system:" Z! When UNIX is running and a reboot is desired, Z .IR shutdown (8) Z is normally used to stop time sharing and put the system into single user Z mode. If there are no users then Z--- 21,35 ---- Z .br Z .B /etc/fastboot Z [ Z! .B \-lqndarsRD Z ] Z .SH DESCRIPTION Z! 2.11BSD is started by placing it in memory at location zero and transferring to Z its entry point. Since the system is not reentrant, it is necessary to read Z it in from disk or tape each time it is to be boot strapped. Z .PP Z .B "Rebooting a running system:" Z! When the system is running and a reboot is desired, Z .IR shutdown (8) Z is normally used to stop time sharing and put the system into single user Z mode. If there are no users then Z*************** Z*** 68,79 **** Z .TP Z .B \-a Z Have the system booter ask for the name of the system to be booted, rather Z! than immediately booting the default system. Z .TP Z .B \-r Z Mount the root file system as Z .I "read only" Z! when the system reboots. Z .TP Z .B \-s Z Don't enter multi-user mode after system has rebooted \- stay in single Z--- 67,78 ---- Z .TP Z .B \-a Z Have the system booter ask for the name of the system to be booted, rather Z! than immediately booting the default system (/unix). Z .TP Z .B \-r Z Mount the root file system as Z .I "read only" Z! when the system reboots. This is not supported by the kernel in 2.11BSD. Z .TP Z .B \-s Z Don't enter multi-user mode after system has rebooted \- stay in single Z*************** Z*** 88,93 **** Z--- 87,103 ---- Z flag in conjunction with the Z .B \-h Z (halt) flag. Z+ .TP Z+ .B \-D Z+ Set the Z+ .IR autoconfig (8) Z+ debug flag. This is normally not used unless one is debugging the Z+ .I autoconfig Z+ program. Z+ .TP Z+ .B \-R Z+ Tells the kernel to use the compiled in root device. Normally the system Z+ uses the device from which it was booted as the root/swap/pipe/dump device. Z .PP Z .I Reboot Z normally places a shutdown record in the login accounting file Z*************** Z*** 111,326 **** Z .PP Z .B "Power fail and crash recovery:" Z Normally, the system will reboot itself at power-up or after crashes Z! (if the contents of low memory are intact.) Z An automatic consistency check of the file systems will be Z performed, and unless this fails, the system will resume multi-user Z operations. Z- .PP Z- .B "Cold starts:" Z- A PDP-11 UNIX system is started by a two-stage process. The first is a Z- primary bootstrap which is able to read in relatively small stand-alone Z- programs; the second (called Z- .IR boot ) Z- is used to read in the system itself. Z- .PP Z- The primary bootstrap must reside in the otherwise unused block zero of the Z- boot device. It can be read in and started by standard ROM cold boot Z- routines or, if necessary, by keying in a small startup routine. The Z- primary bootstrap is capable of loading type 0407 executable files (impure Z- (non-shared), non-separate I&D.) Z- Copies of the block zero bootstraps are kept in the directory Z- .IR /mdec . Z- .IR Newfs (8) Z- will normally place a copy of the appropriate bootstrap in block zero of Z- new file systems. Z- .PP Z- The primary bootstrap will normally load Z- .I boot Z- from the file system that starts at block 0 of drive 0 of the boot device Z- (this is usually root.) Z- If Z- .I boot Z- is not found, the name of another file to try will be read from the Z- console. Some devices' primary bootstraps, when asking for alternate Z- programs to boot, will prompt with a `>', others have no prompt because of Z- space considerations (and some, like the RA boot, can't even ask for Z- alternate program names.) No diagnostic message results if the file cannot Z- be found, and no provision is made for correcting typographical errors when Z- entering alternate names. Hitting a return will cause an error and allow Z- restarting. Z- .IP \(bu Z- .BR "In an emergency" , Z- the bootstrap methods described in the paper Z- .I "Installing and Operating 2.10bsd" Z- can be used to boot from a distribution tape. Z- .PP Z- The secondary boot step, called Z- .IR boot , Z- actually brings in the system. When read into location 0 and executed, Z- .I boot Z- sets up memory management, relocates itself into high memory, and types its Z- name and a `:' on the console. If this is an automatic, unattended reboot, Z- .I boot Z- will use a default file specification for the installation, typing the Z- file's name after the prompt. Otherwise, it reads a file specification Z- from the console. Normal line editing characters can be used to make Z- corrections while typing this (see below for file specification format.) Z- If only a carriage return is typed, a default name will be used. Z- .I Boot Z- finds the [specified] file and loads it into memory location zero, sets up Z- memory management as required, and calls the program by executing a `trap' Z- instruction. Z- .PP Z- Conventionally, the secondary boot program is `/boot' (if the root is the Z- first file system on disk 0 of the boot device) and the name of the current Z- version of the system is `/unix'. Z- .PP Z- For the system to boot, Z- .I /etc/init Z- must exist and be executable; if it is not, the kernel will print a message Z- to that effect and loop. Further, for a single user boot, the files Z- .I /bin/sh Z- and Z- .I /dev/console Z- must also exist and Z- .I /bin/sh Z- must be executable (if either of these is missing, Z- .I init Z- will attempt multi-user operation.) Z- For a multi-user boot the file Z- .I /etc/ttys Z- must exist (if missing, Z- .I init Z- will attempt single user operation.) Z- .PP Z- When the system is running in single user mode, it starts a single user Z- shell on the console which types a `#' prompt. After doing any file system Z- checks and setting the date Z- .RI ( date (1)) Z- a multi-user system can be brought up by typing an EOT (control-d) in Z- response to the `#' prompt. Z- .PP Z- .B "Boot file specification format:" Z- The file specifications used with Z- .I boot Z- are of the form: Z- .IP Z- .I device(unit,offset)path Z- .LP Z- where Z- .I device Z- is the type of the device to be searched; Z- .I unit Z- is the unit number of the disk or tape; Z- .I offset Z- is the block offset of a UNIX file system on the specified disk, Z- in physical (512 byte) blocks, Z- or the tape file number if the device is a tape; and Z- .I path Z- is the path name of a disk file to be loaded with all mount prefixes Z- stripped off Z- .RI ( path Z- should be omitted for tape files.) Tape files are separated by single tape Z- marks. Z- .I Device Z- is one of the following Z- .PP Z- .nf Z- .ne 10 Z- xp RM02/03/05, RP04/05/06, DIVA, SI Eagle, CDC 9766, Fuji 160 Z- rp RP03 Z- rk RK05 Z- hk RK06/7 Z- rl RL01/2 Z- si RM05, CDC 9766 Z- ra RA60/80/81, RX50, RD51/52/53, RC25 Z- ht TU/TE16 Z- tm TU/TE10 Z- ts TS-11 Z- .fi Z- .PP Z- The stand alone tape drive unit number is specially encoded to specify Z- both unit number and tape density (BPI). Most tape subsystems either Z- automatically adjust to tape density or have switches on the drives to Z- force the density to a particular setting, but for those which don't the Z- following density select mechanisms may be necessary. The \fBts\fP only Z- operates at 1600BPI, so there is no special unit density encoding. The Z- \fBht\fP will operate at either 800BPI or 1600BPI. Units 0 through 3 Z- correspond to 800BPI, and 4 through 7 to 1600BPI on drives 0 through 3 Z- respectively. The standard DEC \fBtm\fP only supports 800BPI (and hence Z- can't be used with the standard \*(2B distribution tape), but several Z- widely used \fBtm\fP emulators support 1600BPI and even 6250BPI. Units 0 Z- through 3 correspond to 800BPI, 4 through 7 to 1600BPI, and 8 through 11 Z- to 6250BPI on drives 0 through 3 respectively. Z- .PP Z- For example, to boot a system which starts at block 0 of unit 0 on an RK07, Z- type \*(lqhk(0,0)unix\*(rq to the boot prompt. The specification Z- \*(lqra(0,9700)unix\*(rq indicates an MSCP disk, unit 0, and the file Z- system found starting at block 9700 which would be appropriate for Z- partition `b' of an RD51, '52, or '53. And the specification Z- \*(lqts(0,3)\*(rq would cause the fourth file on a tape threaded on `ts' Z- tape drive 0 to be loaded and executed. Z- .PP Z- .B "Cold boot loaders:" Z- The following programs to load and execute the primary bootstrap may be Z- installed in read-only memories or manually keyed into main memory. Each Z- program is position-independent but should be placed well above location 0 Z- so it will not be overwritten. Each reads a block from the beginning of a Z- device into core location zero. The octal words constituting the program Z- are listed on the left. Z- .PP Z- .nf Z- .if n .ta 3 11 15 23 38 Z- .if t .ta .3i 1i 1.4i 2i 3.5i Z- .ne 10 Z- RK (drive 0): Z- 012700 mov $rkda,r0 Z- 177412 Z- 005040 clr \-(r0) / rkda cleared by start Z- 010040 mov r0,\-(r0) Z- 012740 mov $5,\-(r0) Z- 000005 Z- 105710 1: tstb (r0) Z- 002376 bge 1b Z- 005007 clr pc Z- .PP Z- .ne 11 Z- RP (drive 0) Z- 012700 mov $rpmr,r0 Z- 176726 Z- 005040 clr \-(r0) Z- 005040 clr \-(r0) Z- 005040 clr \-(r0) Z- 010040 mov r0,\-(r0) Z- 012740 mov $5,\-(r0) Z- 000005 Z- 105710 1: tstb (r0) Z- 002376 bge 1b Z- 005007 clr pc Z- .PP Z- .ne 7 Z- TM and TS (drive 0): Z- 012700 mov $tmba,r0 Z- 172526 Z- 010040 mov r0,\-(r0) Z- 012740 mov $60003,\-(r0) Z- 060003 Z- 000777 br . Z- .DT Z- .SH FILES Z- .ta \w'/mdec/xxuboot 'u Z- /unix system code Z- .br Z- /boot system bootstrap Z- .br Z- /etc/init system process dispatcher Z- .br Z- /mdec/xxuboot sector 0 boot blocks, xx is disk type Z .SH "SEE ALSO" Z! crash(8V), Z! fsck(8), Z! init(8), Z! newfs(8), Z! rc(8), Z shutdown(8), Z syslogd(8) Z--- 121,133 ---- Z .PP Z .B "Power fail and crash recovery:" Z Normally, the system will reboot itself at power-up or after crashes Z! \fBif\fP the contents of low memory are intact. Z An automatic consistency check of the file systems will be Z performed, and unless this fails, the system will resume multi-user Z operations. Z .SH "SEE ALSO" Z! autoconfig(8), Z! sync(2), Z! utmp(8), Z shutdown(8), Z syslogd(8) Z*** /usr/src/man/man8/autoconfig.8.old Wed Dec 30 18:44:08 1992 Z--- /usr/src/man/man8/autoconfig.8 Fri May 24 21:05:05 1996 Z*************** Z*** 2,8 **** Z .\" All rights reserved. The Berkeley software License Agreement Z .\" specifies the terms and conditions for redistribution. Z .\" Z! .\" @(#)autoconfig.8 2.6 (2.11BSD GTE) 12/30/92 Z .\" Z .TH AUTOCONFIG 8 "December 30, 1992" Z .UC 2 Z--- 2,8 ---- Z .\" All rights reserved. The Berkeley software License Agreement Z .\" specifies the terms and conditions for redistribution. Z .\" Z! .\" @(#)autoconfig.8 2.7 (2.11BSD GTE) 1996/5/24 Z .\" Z .TH AUTOCONFIG 8 "December 30, 1992" Z .UC 2 Z*************** Z*** 9,15 **** Z .SH NAME Z autoconfig \- configure the running system to the hardware Z .SH SYNOPSIS Z! .B "autoconfig [\-i ifile] [\-n nfile] [\-k kfile] [\-v] [\-c]" Z .SH DESCRIPTION Z .PP Z .I Autoconfig Z--- 9,15 ---- Z .SH NAME Z autoconfig \- configure the running system to the hardware Z .SH SYNOPSIS Z! .B "autoconfig [\-i ifile] [\-n nfile] [\-k kfile] [\-v] [\-d] [\-c]" Z .SH DESCRIPTION Z .PP Z .I Autoconfig Z*************** Z*** 83,88 **** Z--- 83,92 ---- Z \fB\-\^c\fR Z Report error messages for devices skipped because of problems with Z their interrupt vectors. Z+ .TP Z+ \fB\-\^d\fR Z+ Turn on debugging mode. Shows many gory details of autoconfig's internal Z+ processing. Z .SH BUGS Z Devices of the same type must be listed with ascending unit numbers Z or with wildcards. Z*************** Z*** 98,103 **** Z--- 102,109 ---- Z autoconfig a second time results in the error: Z .TP Z "namelist doesn't match running kernel." Z+ Autoconfig attempts to open /dev/kmem for write. If the kernel is in Z+ securelevel 1 or higher the open of /dev/kmem will fail. Z .SH FILES Z .ta 2i Z /etc/dtab device table Z*************** Z*** 106,109 **** Z .br Z /dev/kmem Z .SH SEE ALSO Z! ucall(2), dtab(5) Z--- 112,117 ---- Z .br Z /dev/kmem Z .SH SEE ALSO Z! ucall(2), Z! nlist(3), Z! dtab(5) Z*** /usr/src/man/man8/Makefile.old Thu Jan 25 23:42:06 1996 Z--- /usr/src/man/man8/Makefile Fri May 24 20:36:36 1996 Z*************** Z*** 14,24 **** Z # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED Z # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. Z # Z! # @(#)Makefile 5.4.3 (2.11BSD) 1996/1/23 Z # Z MDIR= /usr/man/cat8 Z SRCS= XNSrouted.8 ac.8 adduser.8 arff.8 arp.8 autoconfig.8 bad144.8 \ Z badsect.8 bugfiler.8 catman.8 chown.8 clri.8 comsat.8 crash.8 \ Z cron.8 dcheck.8 diskpart.8 dmesg.8 drtest.8 dump.8 dumpdir.8 \ Z dumpfs.8 edquota.8 format.8 fsck.8 fstat.8 \ Z gettable.8 getty.8 htable.8 icheck.8 ifconfig.8 implog.8 \ Z--- 14,25 ---- Z # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED Z # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. Z # Z! # @(#)Makefile 5.4.4 (2.11BSD) 1996/5/24 Z # Z MDIR= /usr/man/cat8 Z SRCS= XNSrouted.8 ac.8 adduser.8 arff.8 arp.8 autoconfig.8 bad144.8 \ Z badsect.8 bugfiler.8 catman.8 chown.8 clri.8 comsat.8 crash.8 \ Z+ boot.8 \ Z cron.8 dcheck.8 diskpart.8 dmesg.8 drtest.8 dump.8 dumpdir.8 \ Z dumpfs.8 edquota.8 format.8 fsck.8 fstat.8 \ Z gettable.8 getty.8 htable.8 icheck.8 ifconfig.8 implog.8 \ Z*************** Z*** 33,38 **** Z--- 34,40 ---- Z uuclean.8 uupoll.8 uusnap.8 uuxqt.8 Z OBJS= XNSrouted.0 ac.0 adduser.0 arff.0 arp.0 autoconfig.0 bad144.0 \ Z badsect.0 bugfiler.0 catman.0 chown.0 clri.0 comsat.0 crash.0 \ Z+ boot.0 \ Z cron.0 dcheck.0 diskpart.0 dmesg.0 drtest.0 dump.0 dumpdir.0 \ Z dumpfs.0 edquota.0 format.0 fsck.0 fstat.0 \ Z gettable.0 getty.0 htable.0 icheck.0 ifconfig.0 implog.0 \ Z*** /VERSION.old Mon May 20 19:50:04 1996 Z--- /VERSION Fri May 24 22:05:47 1996 Z*************** Z*** 1,4 **** Z! Current Patch Level: 321 Z Z 2.11 BSD Z ============ Z--- 1,4 ---- Z! Current Patch Level: 322 Z Z 2.11 BSD Z ============ SHAR_EOF chmod 755 '/tmp/322.patch' fi exit 0 # End of shell archive