COHERENT manpages
This page displays the COHERENT manpage for booting [How booting works].
List of available manpages
Index
booting -- Technical Information
How booting works
Booting is the method by which COHERENT is loaded from a hard disk or
floppy disk and set into action. The term comes from the old expression
about pulling one's self up by one's bootstraps.
This article discusses the events that take place while booting the
COHERENT system. You do not need to read this article to know how to boot
COHERENT, as all booting details are handled by COHERENT automatically.
However, if you are interested in the details, or want to tailor the system
to your needs, it will help.
Two I/O devices are involved in booting. The first device is called the
boot device; it contains the program necessary to invoke the COHERENT
system and start it running. The second device is called the root device;
it contains the root file system after the system is running. In most
cases, these two devices are the same physical device.
Initial Startup
When you boot from a hard disk, your computer's BIOS loads the master boot
from the first sector of your hard disk into memory. The master boot then
loads the secondary boot from the first sector of your boot partition.
When you boot from a floppy disk, however, the BIOS loads the secondary
boot directly.
This program, called the bootstrap or secondary boot, is very small (only
512 bytes), so it cannot do very much. Therefore, its main purpose is to
read in a larger, more complex program called the tertiary boot, or /tboot.
It is /tboot that actually performs the work of loading the COHERENT system
into memory.
If the secondary boot does not find a file called /tboot, it print a `?' to
prompt for the boot image you want it to load. This indicates a severe
error because it means that the tertiary boot can not be found.
If the secondary boot finds /tboot, it loads it into memory and lets it
take over booting. The first thing /tboot does is search for a file called
/autoboot in the root directory of the device being booted. If /tboot
finds /autoboot, it first pauses for five seconds, so you can abort the
process and boot another kernel if you wish. If you do not abort booting
within five seconds, /tboot then loads /autoboot into memory and runs it.
If, however, /tboot cannot find /autoboot, it prompts you to type the name
of the COHERENT image to boot, usually /coherent. You can type the commands
dir or ls if you do not remember the name of the image you wish to boot.
Note that /autoboot is usually a link to /coherent.
If you need to find the file name of the kernel you are now running
(usually /coherent), use the program fifo(), which is kept in library
libmisc. See the Lexicon entry libmisc for details.
After it loads the system image /autoboot from the root device, the system
initializes all devices, as well as starting the idle process and program
/etc/init. The idle process uses any leftover computer time.
init controls the operation of the system from this point on. It first
executes the command /etc/brc (i.e., ``boot run commands''), which can run
commands like fsck. brc can request a reboot, remain in single-user mode,
or enter multi-user mode automatically. init then calls the shell to
handle commands from the system console. The shell responds by prompting
with #, and expects regular commands. At this point, the system is in
single-user mode, which means that no other users can log in to the system.
The shell is running in superuser mode and only the console's user is
logged in.
At this point, you can enter commands to the system in a normal fashion.
One difference from normal, multi-user operation is that the system is in
single-user mode, to allow special processing to take place before other
users log in. Being in single-user mode gives you the opportunity to run
fsck to check the file system and perform other administrative tasks before
other users log into the system.
When administrative activities are finished, you should type <ctrl-
D>. This terminates single-user operation; init then opens the system
to other users.
The file /etc/rc contains shell commands that the system executes just
before making the system available to other users. This file typically
includes commands to delete temporary files and mount standard devices. It
also performs any installation-specific commands you require. As system
administrator, you maintain this file. You must be sure that it is
properly updated and never removed.
One command that must be included in /etc/rc is /etc/update, which
periodically calls sync() to update buffered data to the disk.
init also maintains the file /etc/utmp, which notes users' login and
logout.
Features of the Master Bootstrap
The COHERENT master bootstrap allows you to boot different operating
systems from different partitions of any hard drive. It is more powerful
than similar programs of other operating systems, and we strongly recommend
that you use it. If you do not use the MWC bootstrap, you may have to use
floppy disks to boot up MS-DOS and COHERENT. If you have two hard drives
and you are placing COHERENT on the second drive, you must use the MWC
bootstrap.
The bootstrap can be configured in three ways:
1. No active partition. With this configuration, you have the greatest
degree of flexibility. When you boot your system, the following prompt
appears on the screen:
Select Partition 0-7
This means that you must press the number key that corresponds to the
partition that holds the root partition of the operating system you wish
to boot. (For example, if you wish to boot COHERENT and its root
partition is on partition 2, then press the `2' key in response to this
prompt.) If you have one hard drive, only partitions 0 through 3 are
relevant to you. The bootstrap waits indefinitely until you tell it
what to boot.
2. COHERENT is active partition. Under this configuration, the system will
automatically boot COHERENT unless you press the number key that
represents the root partition of another operating system (e.g., MS-DOS)
while the A-drive light is on.
3. MS-DOS (or another operating system) is active partition. Under this
configuration, the system automatically boots MS-DOS unless you hit the
number key that represents the root partition of another operating
system (e.g., COHERENT) while the A-drive light is on.
Under some hardware configurations, particularly faster 80386 machines,
having an active partition can cause difficulties when you try to boot a
non-active partition. It often is difficult to press the appropriate
number key at the right time, and the right time itself can vary. For this
reason, the default setting of the master bootstrap is to have no active
partition. If at any time you wish to reconfigure the bootstrap, you need
only to run the fdisk utility under COHERENT and access option 1 (Change
active partition) of the option menu. Make the desired change and then
save the updated partition table.
Files Used During Startup
The following files are used when the system is in single-user mode:
/etc/drvld.all
Device tables to load. This usually names the keyboard driver
to use, should you be using the keyboard driver vtnkb.
/etc/init Initiate a process on each terminal line, call login when
appropriate.
/etc/brc Shell commands for booting.
/etc/checklist
List of partitions for fsck to check.
/bin/sh Bourne shell.
/bin/ksh Korn shell.
The following files are needed after the system has entered multi-user
mode:
/bin/login This file holds the program that controls logging in.
/etc/getty This file holds the executable program that permits a user to
log in on a port.
/etc/logmsg This file holds the text of the login prompt.
/etc/motd This file holds the message of the day.
/etc/mount.all
Shell script to mount partitions.
/etc/rc This file holds a series of shell commands that coherent
executes when it enters multi-user startup.
/etc/ttys This file is holds information about terminals. Its contents
are read by getty to ensure that it sets the port to the
correct baud rate and terminal type.
/etc/utmp This file holds information about who is logged in right now.
It is read by the command who.
Building a Bootable Floppy Disk
Building a bootable floppy disk for COHERENT requires a few more steps than
are required to build a bootable floppy for MS-DOS. The task is not
particularly painful, it simply requires a little more attention to detail.
The following details the steps required to build a version of COHERENT
that can be booted off a floppy disk. Note that the following describes an
extremely minimal configuration, which can be used only in single-user
mode.
1. Format the Floppy Disk
To begin, format the floppy disk with the command /etc/fdformat. After
you format the floppy disk, use the command /etc/mkfs command to write
a blank file system onto it.
2. Write a Bootstrap to the Floppy Disk
To make the floppy disk bootable, you must copy a special program, or
bootstrap, into the first sector (or boot block) of the floppy disk.
(This is the same program that is called the secondary boot in the
above sections.) If a floppy disk is to be bootable, a set of
instructions must be present in the boot block that tell the system
the name of the kernel -- that is, the file on the floppy disk to be
loaded and executed.
To write the bootstrap to the floppy disk, you must copy it to the
device that the floppy disk is in. This ensures that the bootstrap is
copied to the first sector, or boot block, of the floppy disk. For
example, to copy the bootstrap for a 1.2-megabyte floppy disk in
floppy drive 0 (or A), type the command:
cp /conf/boot.fha /dev/fha0
To copy the bootstrap for a 1.44-megabyte floppy disk to floppy drive
0, type the command:
cp /conf/boot.fva /dev/fva0
3. Write Tertiary Boot
After you have copied the boot sector, you must mount the floppy
device and copy /tboot to it. To mount a 1.44-megabyte floppy disk to
floppy drive 0, type the command:
/etc/mount /dev/fva0 /f0
Copy /tboot with the following command:
cp /tboot /f0
Warning: Never mount the floppy disk before you copy the bootstrap to
it!
See the Lexicon article on floppy disks for the table of floppy disk
devices to use with the above commands.
4. Copy the Necessary Files
Once the bootstrap is properly written to the floppy disk, it is now
time to copy the essential files to it. Type the following commands:
mkdir /f0/etc
mkdir /f0/dev
mkdir /f0/bin
mkdir /f0/tmp
cp /tboot /coherent /coherent.sym /f0
cp /etc/init /etc/brc /etc/profile /f0/etc
cp /dev/* /f0/dev
cp /bin/sh /bin/sync /f0/bin
If you are using either of the loadable keyboard drivers nkt or vtnkb,
also execute the following commands:
mkdir /f0/drv
mkdir /f0/conf
mkdir /f0/conf/kbd
cp /etc/drvld.all /f0/etc
cp /drv/* /f0/drv
cp /conf/kbd/* /f0/conf/kbd
The above files will let you run COHERENT in single-user mode, which
is all that you need when you boot COHERENT from a floppy disk.
Note that the files /etc/brc and /etc/drvld.all are scripts that you
must modify to suit your needs. The file /etc/brc is a key file in
the booting process, so be prepared to modify its contents. The
significance of this will be reviewed in depth in the next section.
Warning: After you have finished copying files to the floppy disk,
execute the command umount to unmount the floppy disk. If you do not,
the files will be damaged or lost!
5. The Boot Sequence, Modifications To Make the Disk Work
When the computer system powers up and accesses the floppy disk, it
reads the boot sector of the disk, which in turn looks for the file
/tboot and executes it. /tboot looks for the kernel named /autoboot,
reads it, and executes it. If /tboot cannot find /autoboot, it
prompts you to type the name of the kernel to boot.
The kernel loads and invokes /etc/init which, in part, looks for and
executes the statements in /etc/brc, which, in turn, typically loads
loadable drivers and runs /etc/fsck to check the file systems. If you
wish to run fsck on the floppy disk, you must copy it from the hard
drive.
What is truly important is the exit status of /etc/brc. If its exit
status is not zero, the system remains in single-user mode. If its
exit status is zero, the system attempts to enter multiuser mode.
The above-listed files are the bare minimum for a single-user floppy
disk. To build a floppy disk with the minimum files needed, your
/etc/brc file should look like this:
/etc/drvld.all
exit 1
This forces an exit status of one and causes COHERENT to spawn a
single-user shell, /bin/sh.
From the shell prompt, you can do whatever you wish, but you are
limited to the commands and functions copied to the floppy disk.
/etc/brc is not the only file that may need modification. The kernel
(/coherent or /autoboot) must have the values rootdev and pipedev
patched for the floppy disk's major and minor device numbers. This
patching can be done with the commands /bin/db or /conf/patch.
To patch the kernel on the floppy disk mounted on /f0 for a 5.25-inch,
high-density disk as the root and pipe device, type:
/conf/patch /f0/coherent rootdev=makedev\(4,14\)
/conf/patch /f0/coherent pipedev=makedev\(4,14\)
For a 3.5-inch, high-density disk, type:
/conf/patch /f0/coherent rootdev=makedev\(4,15\)
/conf/patch /f0/coherent pipedev=makedev\(4,15\)
Finally, note that when you boot your floppy disk, the disk must not be
write protected. This is because COHERENT must be able to write temporary
files into directory /tmp; if it cannot do so, booting will fail.
Uses of a Bootable Floppy Disk
A bootable floppy disk can be a lifesaver should something occur to corrupt
the COHERENT file system on the hard drive. A properly prepared floppy can
be used to recover a damaged file system by running /etc/fsck. You can also
use it to copy files from the hard drive should you decide to re-install
COHERENT on the hard drive.
Multiuser-mode floppy disks can also be built for the fun of seeing such a
system run from a floppy disk. The capacity of such a system is limited,
of course, but it can be done.
See Also
Administering COHERENT,
boot,
libmisc,
tboot
Notes
Some users have attempted to use Norton Utilities or similar tools to
rearrange the partition table, only to find that COHERENT no longer boots.
That is because the kernel has embedded within it the name of the partition
on which it and its root file system live. By using Norton Utilities to
shuffle the partition table, the kernel will no longer be able to find any
of the files or utilities it needs to boot your system.
If you still wish to shuffle your disk's partition table, be sure to change
the name of the root device within the kernel before you change the
partition table.









