BOOT(8) BSD System Manager's Manual BOOT(8)NAMEboot - bootstrap procedures for BSD/OS
DESCRIPTION
BSD/OS is normally booted by simply turning on the power to the computer
and waiting. Under normal conditions, the floppy drive will be empty, so
the BIOS will read and execute the boot block from the hard disk, which
will read and execute the program /boot. Then, /boot will normally size
memory, then read and execute the kernel, /bsd. Next, the kernel does a
series of probes to determine what hardware is present, then executes the
program init(8). Init then runs the shell script /etc/rc. This script
checks the file systems, configures the network hardware and starts back-
ground system tasks. If it completes normally, init will spawn getty
processes for the terminals listed in /etc/ttys, to allow users to log
in. If /etc/rc exits with an error code, init will instead run a single
user shell.
A number of these steps may be configured or modified during a single ex-
ecution, or in configuration files.
The bootstrap normally uses the standard PC display and keyboard for out-
put and input when needed. If no keyboard is present, and if carrier is
present on the primary serial port, com0 (known as COM1 to DOS), the
bootstrap ``auto switches'' to that port for input. It copies output to
both possible consoles. For permanent use of a serial console, see the
-console command below.
During the normal loading procedure, you will be presented with the fol-
lowing message:
press ESC to boot now, any other key to interrupt boot sequence
A counter will then start to count down backwards. If you strike the ESC
key during this countdown the counter will be terminated and the normal
loading procedure will continue. If you strike any other key during this
countdown the normal boot sequence will be aborted and you will be
prompted with:
Boot:
At this point, you can specify an alternate kernel to boot, potentially
on a different device. If the kernel named has a suffix of gz (e.g.,
bsd.gz) it is assumed to be compressed by gzip(1) using the deflate com-
pression method. The boot program will decompress the file as it is
read. The default boot flags for the kernel are changed to request a
boot to single user, possibly asking for a root filesystem location (see
below).
The bootstrap checks the amount of memory in the system just before load-
ing the kernel. On a PC, memory is in two sections. Base memory starts
at location 0 and is usually 640K, although the BIOS may reserve some of
this memory. Extended memory starts at 1 MB and continues upward.
The complete boot command is:
dev(adapter, controller, unit, partition)pathname [-adrsw | howto]
or
-bootcommand
If the command begins with - the line is treated as a boot command (see
below), otherwise the line is used as a boot specification. The device
specification (dev through the closing parenthesis) is optional; if omit-
ted, the kernel is loaded from the device and partition from which the
bootstrap was loaded. Otherwise, dev is the type of the desired device:
bios any disk defined by the BIOS (A:, B:, C: or D:)
fd floppy disk
wd ST506/RLL/ESDI/IDE hard disks
sd SCSI hard disks on aha or bha host adapter
aha disk on Adaptec or Buslogic ISA SCSI host adapter
eaha disk on Adaptec EISA SCSI host adapter
The values inside the parentheses should be numbers. If fewer than 4 ar-
guments are provided, the left most (i.e. starting with adapter ) will be
defaulted to 0, e.g., wd(1,2) is the same as wd(0,0,1,2). The arguments
have the following general meanings. Specific device types use them
somewhat differently as indicated.
adapter The adapter to use. Normally unused, but see below for spe-
cial use with sd and bios types.
controller When more than a single controller is present, controller
determines which controller to use. See below for special
use with any SCSI controller.
unit A single controller may have more than a single disk as-
signed to it. The unit value selects which disk, 0 being
the lowest disk number. See below for special use with any
SCSI disk.
partition The partition determines which BSD/OS partition on the se-
lected disk will be used. Partition 0 is the a partition, 1
is b and so on.
The BIOS device type uses the adapter field differently. If the adaptor
is 0, the unit is a floppy unit (A: or B:); otherwise, unit is a hard
disk known to the BIOS (C: or D:).
Aliases are provided to making using the BIOS device easier. There are
two forms:
drive:
and
drive.partition:
where drive is the drive letter (e.g., A, B, C or D) and the optional
partition is the partition to boot from (a - h). For example, C: maps to
bios(1,0,0,0) and D.e: maps to bios(1,0,1,4).
SCSI disks use the adapter, controller and unit fields slightly differ-
ently. When used with the sd device an adapter of 0 implies the use of
an aha host adapter, and an adapter of 1 implies the use of an eaha host
adapter. The aha and eaha device types are shorthand for this (and hence
do not need the adapter number set). For sd, aha and eaha devices the
controller number actually refers to the physical SCSI target ID (0-7,
normally set with jumpers or switches on the device). The unit number
actually refers to the logical disk number to which BSD/OS maps the de-
vice, i.e. the 1 in sd1. The controller determines which disk pathname
will be loaded from while the unit determines which disk the kernel will
be told to use as the root device.
The pathname identifies the desired file to be booted. If no device
specification or pathname is present (that is, only a RETURN is typed),
the default boot sequence is initiated. The default boot command is
/bsd.
The following options to the loaded kernel are available. With no op-
tions, the default is the same as specifying the -as options if the boot
was interrupted, and no options if the bootstrap was automatic. If any
options are present, only those present are actually used; a - alone ex-
plicitly disables all options.
-a Askname; if loading a generic kernel, the kernel will prompt for
the name of the root filesystem device. If loading a bootstrap
program, prompt for a boot command.
-d Enable debugging. Currently, this enables diagnostic output dur-
ing the startup operations of the kernel.
-r Use the default (compiled-in) root filesystem rather than using
the load device as the root.
-s Boot to a single-user shell rather than checking filesystems and
going into multiuser operation. Also, if specified to the boot-
strap using the -bootflags command (below) or implicitly by in-
terrupting the boot sequence, the bootstrap prompts for commands
rather than booting automatically.
-w Mount the root filesystem read/write rather than read-only (not
yet implemented in the kernel).
The boot flags may also be set using the howto parameter, which is a dec-
imal, octal or hex number that sets the boot flags-- see the RB_* con-
stants in sys/reboot.h. The use of the flags above is generally recom-
mended rather than a numeric value.
If a bootstrap command line begins with -, it is treated as an internal
boot command.
If the file /etc/boot.default exists, the /boot program reads this as a
series of commands to be executed, one command per line, just as if they
were typed from the keyboard. This can be used to boot the kernel from a
different device than the BIOS uses to boot, or to change various parame-
ters listed in the next section.
The commonly-used boot commands are the following:
-cat filename Display the contents of the file named by filename. For
example:
-cat /etc/boot.default
-changedisk Pause to request changing of floppy disks prior to execu-
tion of the kernel. This is useful when the root filesys-
tem is not on the same floppy disk as the kernel.
-console dev Set the console to be dev for the bootstrap and for the
kernel that is booted. Valid device names are:
kbd The standard keyboard and display (the default if
a keyboard is present or the com0 port does not
have carrier asserted).
com [X [ port [speed]]]
The serial device comX where X refers to the given
port, default 0. Note that BSD/OS starts with
com0 where as DOS labels this COM1. The port ad-
dress can be specified, or the standard PC values
for com0 through com3 will be used. The speed de-
faults to 9600.
auto If the bootstrap detects no keyboard and if the
com0 port has carrier, it will ``auto switch'' to
com0 as its input, copying output to both possible
consoles. If this situation exists, auto causes
the bootstrap to act as if
-console com
was used, causing the kernel to use the serial
console; otherwise it has no effect. Note that
when the bootstrap auto switches its output, it
does not automatically direct the kernel to use
the serial console; this must be done either with
-console com
or
-console auto.
-dev devname ioconf=value ...
Reconfigure the device specified by devname to have the
field specified by ioconf set to value. Wild card parame-
ters (such as sd* ) are overridden by specific parameters
(such as sd1 ). If both wild card and specific entries
match a given device, only the specific parameters are
used.
Valid ioconf fields are:
port Base port address for device; if -1, the device is
not probed.
iosiz Number of ports used by device
maddr Base address of memory mapped by device.
msize Amount of memory mapped by device.
irq The IRQ interrupt used by device. If the value is
IRQNONE, no IRQ is used; if the value is IRQUNK,
then the IRQ definition in the kernel config file
is ignored.
drq The DRQ (DMA) channel used by device
flags The flags field for the device
-help Display list of available commands.
-ls directory Display the contents of the requested directory. The in-
ode number and name of each file in the directory are dis-
played.
-parm recipient parameter=value
Pass in a parameter for subsystem or device recipient.
Typically the recipient field is used to specify a hard-
ware device(s) such as ncr1 or ncr*. The value part of the
parameter=value pair can be a comma separated list. For
example:
-parm ncr0 disconnect=target1,target2
It is also possible to specify a class answer such as:
-parm ncr0 disconnect=all
When a class is used it is then possible to subtract one
or more individuals from the class. An example of this
would be:
-parm ncr0 disconnect=all-target1
or:
-parm ncr0 disconnect=all-target1-target2
Specific legal values for the parameter=value pair are not
discussed here because they are are specific to the
recipient. These are discussed in the man page associated
with the recipient.
If multiple -parm commands are issued with same recipient
and parameter, but different values, the last one will be
used. If an error is made entering a -parm command it can
be correctly by simply re-entering it correctly.
No priority is given to recipients specified specifically
over recipients specified with wild cards. Specific
recipients should be entered after wild cards for them to
override wild card specifications.
-pnpid devname pnpid
Assign an alternate pnpid for devname. Hardware vendors
are constantly creating basically compatible devices with
new Plug and Play ids. This command is used to tell the
kernel that a new Plug and Play id is assigned to a device
that a given driver knows how to handle. The devname
specified applies to all units; which means that a tailing
unit number should not be supplied. For instance a legal
devname would be ``com'' while ``com0'' would be an ille-
gal specification.
-rootdev devspec
Rather than passing the load device to the kernel for use
as root device, pass the value of devspec, which has the
same form as a device specification used when booting a
kernel with no trailing pathname: dev(adapter, controller,
unit, partition). For example, this may be used to load
the kernel from a floppy disk, then instruct the kernel to
use a SCSI CD-ROM as the root filesystem with sr(0,0)
(/dev/sr0a).
The following boot commands are used to modify the level of output from
auto configuration and for debugging problems:
-autodebug flag ...
Modify output and/or enable debugging of auto configura-
tion in the kernel. The available values for val are:
-q Quieter output, suppresses addressing details.
-v Verbose output, prints additional device configura-
tion information.
-d Print information about each device and location
probed and the result, pausing after each screenful.
-a Print information as in -d, but confirm whether each
device should be probed. This is useful if probing
some device location causes a failure.
-p Page output if using the standard console (default
with -a).
-bootdebug val
Enable debugging of the boot procedure. The available
values for val are:
0 No debugging.
1 Print additional information about memory sizing and
unusual events.
2 Very verbose messaging, depending on the device type
used.
If the left shift key is held down while loading the boot-
strap (that is, until
loading /boot
is printed), -bootdebug will be initialized to 1 instead
of the default of 0. With some systems, this can cause a
keyboard error message or a stuck key error message. If
this happens, simply clear the error and then depress the
shift key again.
The following boot commands are used primarily for debugging memory and
cache problems:
-basemem mem Normally the amount of base memory is determined automati-
cally. The -basemem command can be used to force the
amount of base memory to the value specified by mem. Ap-
pending a G or K or M specifies an amount in gigabytes,
kilobytes or megabytes respectively.
-cmosmem Limit the auto sizing memory search to the amount of memo-
ry indicated by the CMOS.
-extendend mem
Some large memory machines may cause the memory sizing
code to hang the machine. In addition, the kernel needs
to be re-configured to handle large amounts of memory
(over 1 gigabyte) so the -extendend can limit the amount
of memory used by the default kernel to prevent it from
failing. The -extendend command limits the amount of mem-
ory to be checked to mem. Appending a G or K or M speci-
fies an amount in gigabytes, kilobytes or megabytes re-
spectively.
-memsize mem Normally the end of extended memory is determined automat-
ically. The -memsize command sets the size of extended
memory to mem, disabling the automatic memory sizing test.
Appending a G or K or M specifies an amount in gigabytes,
kilobytes, or megabytes respectively.
-noflushcache While sizing memory, do not use the wbinvd instruction to
flush the cache. This instruction hangs on some mother-
boards.
-sizemem [no]acpi | best | [no]biose801 | [no]scan
Several methods are used to determine the amount of ex-
tended memory in the system just before loading the ker-
nel. The ACPI SMAP interface is attempted first, followed
by the BIOS 0xe801 interface, and finally by scanning mem-
ory. The -sizemem command allows the specification of
methods to skip and/or an explicit list of methods to at-
tempt. The argument is a space-separated list of methods
to attempt, or not to attempt if prefixed with no. The de-
fault is best which specifies that all the methods should
be attempted.
For example,
-sizemem acpi
will only attempt to use ACPI to size memory and:
-sizemem nobiose801
will only attempt to use ACPI and memory scanning. This
would be useful on a system where the value returned by the
BIOS 0xe801 interface is known to be incorrect.
If none of the specified methods succeed in sizing extended
memory, the kernel will most likely not work properly.
The following boot commands are used primarily in scripts in
/etc/boot.default:
-apm Enable Advanced Power Management features.
-bootflags [-adrsw | howto]
Set the boot flags [-adrsw | howto]. Note that specifying
the bootflags on the load line will override the bootflags
set by -bootflags.
-ckexec file [-adrsw | howto]
Compute the checksum on file and compare it to the checksum
recorded in the file file.cksum. If file.cksum does not ex-
ist or the checksums do not match, the command does noth-
ing. If the checksum does match, the file is loaded and
executed.
-cksum file Computes and displays the checksum for file.
-default_kernel file
Specify an alternate default kernel pathname (the default
is /bsd ). This can be useful when a compressed kernel is
used (by setting the default to /bsd.gz ).
-echo [-n] str
Print str to the console. If -n is specified then do not
append a newline to str.
-echoon Turn on echoing of commands.
-echooff Turn off echoing of commands.
-estopon Stop parsing from file on error. This is the default.
-estopoff Do no stop parsing from file on error.
-exec file [-adrsw | howto]
Load and execute file.
-include file Read boot commands from file.
-iomem [enable | reserve] addr size
Mark size bytes of io memory starting at addr as available
(enable) or not available (reserve). This feature is nor-
mally only required when using PC Cards. By default, the
following ranges are disabled:
0xa0000 0x10000
0xb0000 0x10000
0xc0000 0x10000
0xe0000 0x10000
0xf0000 0x10000
-ioport [enable | reserve] base count
Mark count io ports starting at base as available (enable)
or not available (reserve). By default, the following range
is disabled:
0x3b0 16
This feature is normally only required when using PC Cards
or devices that fall into the default reserved range.
-irq [enable | reserve] irq [...]
Mark the specified irq's as available (enable) or not
available (reserve). This feature is normally only required
when using PC Cards.
-kdebug [-i | val]
Set kernel debugging flags. The -i flag requests the ker-
nel attach to the kgdb port as soon as that port is at-
tached. The flags can be specified numerically by specify-
ing val. This would be used when an older /boot is used
with a newer kernel which supports more than just the -i
kdebug option.
-kernspace mem
Supply an estimate of how much memory will be used by the
kernel. This value is used to calculate the size of the
buffer cache, and can be useful on small memory machines
(to make the buffer pool smaller than the default). Ap-
pending a G or K or M specifies an amount in gigabytes,
kilobytes or megabytes respectively. This option is pri-
marily intended for use with installation floppies, reserv-
ing additional space for memory-based filesystems.
-load file [-adrsw | howto]
Load the program file (which may include a device specifi-
cation), optionally setting the boot flags to [-adrsw |
howto].
-pause sec Pause for up to sec seconds, counting the seconds down.
Prompt the user to press any key to abort reading of the
/etc/boot.default file. If the user presses a key and
aborts the reading of /etc/boot.default , the boot flags
are reset to -as.
-pccard_iowait [on | off]
Turn on or off the inserting of wait states when using PC
Cards.
-ramdisk size Create a ramdisk of size bytes at the end of memory. Cur-
rently only one ramdisk may be specified.
-ramdiskimage file
Load a ramdisk image from file. The ramdisk must first be
allocated by the -ramdisk command.
-show Show the boot parameters that are currently set.
-start [-adrsw | howto]
Execute the program previously loaded with the -load com-
mand, optionally setting the boot flags to [-adrsw |
howto].
-waitnl Wait for the user to press <ENTER> on the keyboard.
The boot instructions in a /etc/boot.default file can be used to override
defaults (memory sizing, console device, or kernel name location). It
should contain any -console or -dev commands first. If it then loads a
kernel, it should include a -pause line first to allow the script to be
interrupted. If the file does not load a kernel, the bootstrap will pause
for 5 seconds after running the script to allow interruption, and will
then load the default kernel if not interrupted.
BOOT HINTS
Here are a few common boot procedures. The sections that follow describe
what is happening in more detail.
To boot a single user shell from the hard disk: make sure the floppy
drive is empty, reset the processor, press any key when prompted, then
type a RETURN at the Boot: prompt. You should usually run fsck(8) to
check the file systems before doing anything else. If you type control-
D, the system will come up multi-user. Don't forget that the root is
read-only at the start, so if you want to do maintenance in single-user
mode, you need to do
mount -u /
to enable writes.
To boot a backup kernel from the hard disk: make sure the floppy drive is
empty, reset the processor, press any key when prompted, then type the
desired kernel name at the Boot: prompt (e.g., /bsd.good). This will land
you in a single user shell.
To boot BSD/OS from the hard disk, even though the FDISK label is set to
boot DOS by default: insert a BSD/OS boot floppy and reset the processor.
At the Boot: prompt, type ``wd()bsd -'' for other types of SCSI disks
(replace wd with sd for a SCSI main disk on aha or bha, or bios).
Leave off the - if you want a single user shell. The floppy drive is now
free, and can be used normally when the system finishes booting. (See
below for creating a floppy that boots straight BSD/OS without any opera-
tor intervention.)
To boot with a CD-ROM root: insert a BSD/OS boot floppy and a BSD/OS CD-
ROM and reset the processor. At the Boot: prompt, press RETURN. Type
RETURN again at when offered the chance to change floppies. After kernel
auto configuration, you will be prompted ``root device?''. Type ``sdNa''
for a SCSI CD-ROM on SCSI drive N, or ``mcd0a'' for the Mitsumi ISA CD-
ROM. The boot floppy is no longer needed, so you may insert another flop-
py if desired.
If there is a floppy in drive 0 when the processor is reset, then its
boot block with be read and executed by the BIOS. The boot floppies in-
cluded with the system use a /etc/boot.default script to control the
loading process. A boot floppy can also be constructed that sets the
boot flags to -s, always starting at the Boot: prompt. If you just type
a RETURN, the default action is to boot /bsd from the floppy.
If you boot with a floppy root, then you must not remove the floppy while
running; however, if you specify an alternate device, then the floppy is
free and can be used for any purpose.
To make a floppy that boots straight to BSD/OS on a hard disk, make a
copy of your distribution boot floppy, and in the copy, put a line like
wd(0,0)/bsd
in the file /etc/boot.default. Replace wd with sd if you have a SCSI main
disk; change the unit numbers as needed.
BOOT DETAILS
The boot process on a PC consists of a number of stages.
The first stage is handled by the system BIOS. It selects a boot device,
then loads and executes the first sector of the device. The device se-
lection is sometimes configurable, but often defaults to the ``A'' floppy
if a diskette is present, otherwise the ``C'' (primary) hard disk. If
the disk is a hard disk, the first block may be a BSD/OS boot block, a
standard PC master boot record, or a program like bootany (see
disksetup(8)), which allows a choice of systems to be booted. In the
latter two cases, a PC FDISK partition table in the first block lists the
PC-style partitions and indicates which should normally be booted. An-
other bootstrap facility may also be used, such as the OS/2 boot manager.
If a BSD/OS partition is selected, a BSD/OS boot block is then executed
(usually one of fdboot, wdboot, ahaboot, or eahaboot). The boot block
loads a slightly larger program from the following 15 sectors (usually
one of bootfd, bootwd, bootaha, or booteaha). That program prints
``Loading /boot'' and then loads and executes /boot from the indicated
partition. /boot then loads and executes the kernel, passing the boot
flags and additional information to the kernel.
FILES
/boot Second stage boot
/etc/boot.define Defines symbols used by -parm command
/sbin/init The first user program
/etc/rc Startup shell script
/etc/boot.default Default boot command
SEE ALSObootany(8), boot.define(5), disksetup(8), init(8), reboot(8), shut-
down(8)ACKNOWLEDGEMENTS
The boot program incorporates de-compression code by the Info-ZIP group.
There are no extra charges or costs due to the use of this code, and the
original compression sources are freely available from CompuServe in the
IBMPRO forum and by anonymous ftp from the Internet site
ftp.uu.net:/pub/archiving/zip. The sources used in the boot program are
also available from ftp.bsdi.com:/pub/bsdi/misc/unziplib.
BSDI BSD/OS September 17, 1999 10