In general, when a PC-style computer first boots, it starts the BIOS. The BIOS is a small piece of software that figures out things like which drives are attached and what they’re attached to, what sort of CPU is installed, and how much memory is available. After getting that information, the BIOS loads a minimal boot loader from some kind of storage device.[11]
The boot loader is a small program that handles initial system configuration and boots the kernel. It finds and starts the kernel, which in turn detects hardware, attaches device drivers, and performs other core setup. Finally, the kernel calls init(8)
, which starts processes and enables user programs, network interfaces, server software, and so on.
While most of this process cannot be managed—no one actually configures init
!—there’s plenty you can do before the system finishes booting and dumps you at the login screen.
The OpenBSD boot loader lets you interrupt the boot process, configure the system before it boots, adjust kernel settings, and even boot an alternate kernel.
When the hardware hands control of the boot process over to the OpenBSD partition, you’ll see the boot loader prompt, which looks something like this:
>> OpenBSD/amd64 BOOT 3.18 boot>
The boot loader’s main purpose is to find the kernel, load it into memory, and start it. Because it runs before the kernel starts, the boot loader can pass instructions to the kernel itself.
Here are some of the things you can do before booting is complete:
Use built-in helpUse the
help
function to print a brief list of commands that the boot loader supports.boot> help commands: # boot echo env help ls machine reboot set stty time machine: boot diskinfo memory
Delay the boot processBy default, the loader waits five seconds for instructions, and then boots the kernel. To pause the boot at the prompt, press the spacebar.
Set the boot timeoutTo set a new boot idle timeout, specify a number of seconds with the
set timeout
command.boot> set timeout 10
After the boot prompt is idle for 10 seconds, the system should boot.
Boot the systemIf you’ve paused the boot process, the system won’t boot until you tell it to. When you’re ready to boot, use the
boot
command:> boot
We’ll use various permutations of boot
to configure the kernel, boot single-user mode, and so on. I’ll cover other boot commands in the appropriate sections. For full details on what you can do at the boot loader prompt, read the boot(8)
man page.