i386-specific first-stage system
This small program (roughly 512 bytes of code) is responsible for loading the second-stage boot(8) program (typically /boot), which in turn will load the kernel.
biosboot must be installed by
installboot(8). As part of the installation,
information about the location of
disk. Specifically, it writes the filesystem block number of
inode, the offset within this block of the inode, and various filesystem
parameters (taken from the superblock) required to convert filesystem blocks
to disk sectors. Usually, boot(8) is loaded from the root filesystem of the boot disk.
If the boot disk is a softraid(4) volume,
installboot(8) arranges for a copy of
boot(8) to be
loaded from a dedicated single-inode filesystem located within the volume's
meta data area.
You must re-run installboot(8) whenever boot(8) is changed, as its inode may change. While it should not be necessary, it may also be advisable to re-run installboot(8) if you move your disk between machines and/or controllers.
biosboot receives control from either
the BIOS or the master boot record (MBR), it will print the message:
followed by a dot for every filesystem block it attempts to load.
If /boot is loaded successfully,
biosboot will put
the cursor on the next line just before transferring control to the
biosboot will read disk
sectors using calls detailed in the Phoenix Enhanced Disk Drive
Specification (EDD, sometimes known as LBA, reads). It will fall back to CHS
reads only if EDD calls are not available.
biosboot prints a ‘;’ after
the “Loading” message if it is going to use CHS reads for any
reason. For example, when booting from floppy or CD-ROM.
biosboot may fail with any of the
following error messages:
- Too many indirect blocks.
biosbootis capable of reading the direct blocks in boot(8)'s inode (the location of which is patched into
biosbootby installboot(8)) and the first indirect block, but it is not capable of reading further indirect blocks. This error indicates that further such indirect blocks were found. The system will not be able to boot.
This is unlikely to ever happen in practice, as boot(8) has to be quite large for this to be an issue. The smallest possible filesystem block size is 512 bytes (one sector per filesystem block). On such a system, there are 140 filesystem blocks that
biosbootcan read, so boot(8) can be up to 70 KB.
However, even on floppy disks the filesystem block size is 1024 bytes. This allows boot(8) to occupy up to 268 disk blocks, i.e. to be 268 KB. On hard disks (default filesystem block size 16 KB) 4,108 disk blocks are available, to allow boot(8) to be over 64 MB in size! (Only direct blocks are required for boot(8)s of up to 192 KB.)
- Bad magic. The ELF “magic number” \7fELF in boot(8)'s header was not found. This indicates that the first block of boot(8) was not read correctly. This could be due to disk corruption, failing to run installboot(8), giving an invalid boot(8) program as the boot argument to installboot(8), or incorrect geometry translation.
- Read error. The BIOS returned an error indication when
biosbootattempted to read a disk sector. This might be any media error, including bad sectors (common on floppy disks), and invalid sectors (can occur with bad geometry translations).
- Can't boot. Issued when trying to read sectors in CHS mode, but the BIOS
get drive parameters
failed or gave a value of 0 for the number of sectors per track. In either
case, it is not possible for
biosbootto calculate the (cylinder, head, sector) values required to read any sectors.
biosboot as the MBR, as has been
done in the past, is not recommended, and is not supported. Instead, create
a single fdisk(8) partition that spans the entire disk.
Despite the support for boot(8) over the 8 GB boundary, good disklabel(8) partitioning practices should still be followed.
- Master Boot Record block
- primary bootstrap
- secondary bootstrap
- PXE bootstrap
- OpenBSD kernel
- OpenBSD kernel for single processor machines
- OpenBSD kernel for multiprocessor machines
- OpenBSD kernel for installation/recovery
softraid(4), boot(8), boot_i386(8), disklabel(8), fdisk(8), installboot(8), pxeboot(8)
biosboot was originally written by Michael
Shalayeff for OpenBSD 2.1. However it was based on
bootstrap code from older versions of this operating system, other operating
systems, other programs, and other people's work.
It was significantly revised in December 2003 by Tom Cosgrove, in
order to support LBA disk access (via the Phoenix Enhanced Disk Drive
Specification API). At that time the internal table of disk blocks was
biosboot modified to read filesystem
block numbers from the inode.
biosboot should perform and verify a
checksum across the entire loaded
rather than just checking the magic number in the first block.
There is no BIOS error number reported nor is the location of the error reported.
You can pick your motherboard, and you can pick your BIOS, but you can't pick your motherboard's BIOS.