NetBSD-5.0.2/share/man/man8/man8.i386/mbr.8

.\"	$NetBSD: mbr.8,v 1.3 2008/01/20 15:05:15 dsl Exp $
.Dd January 20, 2008
.Dt MBR 8 i386
.Os
.Sh NAME
.Nm mbr ,
.Nm bootselect
.Nd Master Boot Record bootcode
.Sh DESCRIPTION
An IBM PC boots from a disk by loading its first sector and executing
the code in it.
For a hard disk, this first sector usually contains a table of
partitions present on the disk.
The first sector of a disk containing such
a table is called the Master Boot Record (MBR).
.Pp
The code present in the MBR will typically examine the partition
table, find the partition that is marked active, and boot from it.
Booting from a partition simply means loading the first sector in
that partition, and executing the code in it, as is done for the
MBR itself.
.Pp
.Nx
supplies serveral versions of the MBR bootcode:
.Bl -tag -width 20
.It Sy Normal boot code Pa /usr/mdec/mbr
This version has the same functionality as that supplied by DOS/Windows and
other operating systems: it picks the active partition and boots from it.
Its advantage over other, older MBRs, is that it can detect and use
extensions to the BIOS interface that will allow it to boot partitions
that cross or start beyond the 8 Gigabyte boundary.
.It Sy Bootselector Pa /usr/mdec/mbr_bootsel
The bootselecting MBR contains configurable code that will present
the user with a simple menu, allowing a choice between partitions to
boot from, and hard disks to boot from.
The choices and default settings can be configured through
.Xr fdisk 8 .
.It Sy Extended Bootselector Pa /usr/mdec/mbr_ext
The Extended Bootselecting MBR additionally allows
.Nx
to be loaded from an Extended partition.
It only supports systems whose BIOS supports the extensions to
boot partitions beyond the 8 Gigabyte boundary.
.It Sy Serial Bootselector Pa /usr/mdec/mbr_com0
This has the same features as
.Pa mbr_ext
but will read and write from the first serial port.
It assumes that the BIOS has initialised the baud rate.
.It Sy Serial Bootselector Pa /usr/mdec/mbr_com0_9600
This has the same features as
.Pa mbr_com0 .
Additionally it initialises the serial port to 9600 baud.
.El
.Pp
The rest of this manual page will discuss the bootselecting versions of
the MBR.
The configurable items of the bootselector are:
.Bl -tag -width Er
.It timeout
The number of seconds that the bootcode will wait for the user to
press a key, selecting a menu item.
Must be in the range 0-3600, or \-1 when it will wait forever.
.It default
The default partition or disk to boot from, should the timeout
expire.
.El
.Pp
The bootselector will output a menu of the
.Em bootmenu
names for each partition (as configured by
.Xr fdisk 8 ) .
The user can then select the partition
or drive to boot from via the keyboard.
.Pp
The numeric keys
.Sy 1
upwards will initiate a startup from the corresponding partition.
.Pp
Function keys
.Sy F1
through
.Sy F8
(keys
.Sy a
through
.Sy h
for the serial versions)
will boot from harddisks 0 through 7 (BIOS numbers 0x80 through 0x87).
Booting from a drive is simply done by reading the MBR of that
drive and executing it, so the bootcode present in the MBR of the
chosen drive determines which partition (if any) will be booted in
the end.
.Pp
The
.Sy Enter
key will cause the bootcode to find the active partition, and boot from it.
If no key is pressed, the (configurable) default selection is picked.
.Sh DIAGNOSTICS
The following error are detected:
.Bl -column Code "No active partition"
.It Em Code Ta Em "Text message" Ta Em Explanation
.It 1 Ta "No active partition" Ta
The MBR has a partition table without an active partition.
.It 2 Ta "Disk read error" Ta
There was an error reading the bootsector for the partition or
drive selected.
.It 3 Ta "No operating system" Ta
The bootsector was loaded successfully, but it was not valid (i.e.,
the magic number check failed, or it contained no code).
.It L Ta "Invalid CHS read" Ta
The boot partition cannot be read using a CHS read and the system BIOS
doesn't support LBA reads.
.It ? Ta "" Ta
Unknown key.
.El
.Pp
The standard boot code will output the text message and stop.
It may be necessary to reset to the system to continue.
.Pp
The bootselect code will output 'Error \*[Lt]code\*[Gt]' and await further input.
.Sh SEE ALSO
.Xr boot 8 ,
.Xr disklabel 8 ,
.Xr fdisk 8 ,
.Xr installboot 8 ,
.Xr mbrlabel 8
.Sh BUGS
The bootselect code has constraints because of the limited amount of
space available.
The only way to be absolutely sure that a bootselector will always
fit on the disk when a partition table is used, is to make it small
enough to fit into the first sector (512 bytes, 404 excluding
the partition table and bootselect menu).
.Pp
The error messages are necessarily terse.