amd64-specific second-stage bootstrap
The main purpose of this program is to load the system kernel while dealing with
the pitfalls of the PC BIOS architecture.
As described in
this program is loaded by the
primary bootstrap loader and provides a convenient way to load the kernel.
This program acts as an enhanced boot monitor for PC systems, providing a
common interface for the kernel to start from.
Basic operations include:
- Detecting and switching between multiple consoles.
- Loading kernels from any device supported by your system BIOS.
- Loading kernels compressed by
- Passing system parameters queried from the BIOS to the kernel.
- Providing an interactive command line.
The sequence of its operation is as follows: initialization, parsing the
configuration file, then an interactive command line. While at the command
line you have 5 seconds to type any commands, if needed. If time expires, the
kernel will be loaded according to the current variable settings (see the
command). Each time a kernel load
fails, the timeout is increased by one second. The sequence of
operations is as follows:
- Set up a protected mode environment which catches and reports processor
exceptions and provides a simple protected-mode BIOS interface.
- Probe for console devices, which includes the (default) PC VGA+Keyboard
pc0) and up to four serial consoles
connected to the serial ports. Display messages to the default console
about the devices found.
- Detect memory. Conventional memory is detected by querying the BIOS.
Extended memory is detected by probing page-by-page through the address
space, rather than asking the BIOS; many BIOS's cannot report larger than
64M of memory. All memory found is reported to the default console
- Probe for APM support in the BIOS. Display a message if support is
- If the file /etc/boot.conf exists on
boot was loaded from,
open and parse it. Lines beginning with the ‘#’ character,
as well as whitespace at the beginning of lines, are ignored. The file may
contain any commands
boot accepts at
the interactive prompt. Though default settings usually suffice, they can
be changed here.
boot.conf processing can be skipped, and
the automatic boot cancelled, by holding down either Control key as
- The header line
is displayed to the active console, where
x.xx is the version number of the
>> OpenBSD/amd64 BOOT
boot program, followed by the
prompt, which means you are in interactive mode and may enter commands. If
you do not,
boot will proceed to load
the kernel with the current parameters after the timeout period has
attempts to load the kernel
. If it fails to find the
kernel and no alternative kernel image has been specified, the system will be
unable to boot.
supports booting from
and CRYPTO volumes.
The following commands are accepted at the
- Boots the specified kernel image with any options given. If
image are omitted, values from
boot variables will be used.
When selecting the device to boot from,
boot makes no distinction between SCSI
and IDE type drives; they are detected as ‘hd’ devices.
Therefore, to boot kernel /bsd from
slice ‘a’ on the first hard drive (irrespective of device
type), specify “boot hd0a:/bsd”.
- Causes the kernel to ask for the
root device to use.
- Causes the kernel to go into
- Causes the kernel to drop into
ddb(4) at the
earliest convenient point.
- Causes the kernel to boot single-user.
- echo [
- Displays args on the console device.
- Prints a list of available commands and machine dependent commands, if
- Issues machine-dependent commands. These are defined for amd64
- Boots the specified partition boot block in place of the original
(MBR) boot block:
Where a is the first MBR partition
table entry, and d the last.
- Set the I/O base address for the serial port to be used as serial
- Prints a list of hard disks installed on your system including: BIOS
device number, and the BIOS geometry.
- If used without any arguments, this command will print out the memory
configuration as determined through BIOS routines. Otherwise the
arguments specify how to modify the memory configuration. They take
the form of:
Meaning to add(+), exempt(-) or limit(=) the amount of memory specified
by size at the location specified by
address. Both size and base address
can be specified as octal, decimal, or hexadecimal numbers, as
accepted by the
routine. Memory size may be suffixed by K or k, for kilobytes; M or m,
for megabytes; and G or g, for gigabytes.
The limit(=) option simply ignores any memory above the given memory
limit. This is useful for testing kernels in an artificially
constrained memory situation. For example, the following limits the
kernel to using only memory below 64MB:
Memory segments are not required to be adjacent to each other; the only
requirement is that there is real physical memory under the range
added. The following example adds 32MB of memory right after the first
Another useful command is to withdraw a range of memory from OS usage
(it may have been wrongfully reported as useful by the BIOS). This
example effectively excludes the 15–16MB range from the map of
machine mem +0x2000000@0x1000000
machine mem -0x100000@0xf00000
- Prints contents of processor registers if compiled with
- ls [
- Prints contents of the specified
directory in long format including:
attributes and file type, owner, group, size, filename.
- Reboots the machine by initiating a warm boot procedure.
- set 
- If invoked without arguments, prints a list of variables and their values.
If only varname is specified, displays
contents of that variable. If varname and
value are both specified, sets that
variable to the given value. Variables include:
- Address at which to load the kernel.
- Debug flag if
boot was compiled
with DEBUG defined.
- Boot device name (e.g.,
- Options to pass to the loaded kernel.
- File name containing the kernel image.
- Number of seconds boot will wait for human intervention before booting
the default kernel image.
- Active console device name (e.g.,
- stty 
- Displays or sets the speed for a console
device. If changing the baudrate for the
currently active console,
you five seconds of grace time before committing the change to allow you
to change your terminal's speed to match. If changing speed
not for the active console, the baudrate is
set for the next time you switch to a serial
console. The baudrate value is not used for the
The default baudrate is 9600bps.
- Displays system time and date.
- first stage bootstrap
- PXE bootstrap
- system bootstrap
- system bootstrap's startup file
- kernel image
- kernel image for single processor machines
- kernel image for multiprocessor machines
- kernel image for installation/recovery
Boot the default kernel:
Remove the 5 second pause at boot-time permanently, causing
to load the kernel immediately without
# echo "boot" >
Use serial console. A null modem cable should connect the specified serial port
to a terminal. Useful for debugging.
boot> set tty com0
Invoke the serial console at every boot:
# echo "set tty com0" >
Boot the kernel named /bsd
from the second
hard disk in “User Kernel Configuration” mode (see
This mechanism allows for the explicit enabling and disabling of devices
during the current boot sequence, as well as the modification of device
parameters. Once booted, such changes can be made permanent by using
boot> boot hd1a:/bsd
This program was written by Michael Shalayeff for OpenBSD
on the i386 platform, and was later ported to the amd64