xref: /netbsd-src/share/man/man8/man8.x86/mbr.8 (revision b2e48ae44074e69d15940b8e7e666221b01f9c3e)
1.\"	$NetBSD: mbr.8,v 1.5 2021/06/22 03:30:06 gutteridge Exp $
2.Dd February 17, 2017
3.Dt MBR 8 x86
4.Os
5.Sh NAME
6.Nm mbr ,
7.Nm bootselect
8.Nd Master Boot Record bootcode
9.Sh DESCRIPTION
10An IBM PC boots from a disk by loading its first sector and executing
11the code in it.
12For a hard disk, this first sector usually contains a table of
13partitions present on the disk.
14The first sector of a disk containing such
15a table is called the Master Boot Record (MBR).
16.Pp
17The code present in the MBR will typically examine the partition
18table, find the partition that is marked active, and boot from it.
19Booting from a partition simply means loading the first sector in
20that partition, and executing the code in it, as is done for the
21MBR itself.
22.Pp
23.Nx
24supplies several versions of the MBR bootcode:
25.Bl -tag -width 20
26.It Sy Normal boot code Pa /usr/mdec/mbr
27This version has the same functionality as that supplied by DOS/Windows and
28other operating systems: it picks the active partition and boots from it.
29Its advantage over other, older MBRs, is that it can detect and use
30extensions to the BIOS interface that will allow it to boot partitions
31that cross or start beyond the 8 Gigabyte boundary.
32.It Sy Bootselector Pa /usr/mdec/mbr_bootsel
33The bootselecting MBR contains configurable code that will present
34the user with a simple menu, allowing a choice between partitions to
35boot from, and hard disks to boot from.
36The choices and default settings can be configured through
37.Xr fdisk 8 .
38.It Sy Extended Bootselector Pa /usr/mdec/mbr_ext
39The extended bootselecting MBR additionally allows
40.Nx
41to be loaded from an Extended partition.
42It only supports systems whose BIOS supports the extensions to
43boot partitions beyond the 8 Gigabyte boundary.
44.It Sy Serial Bootselector Pa /usr/mdec/mbr_com0
45This has the same features as
46.Pa mbr_ext
47but will read and write from the first serial port.
48It assumes that the BIOS has initialized the baud rate.
49.It Sy Serial Bootselector Pa /usr/mdec/mbr_com0_9600
50This has the same features as
51.Pa mbr_com0 .
52Additionally, it initializes the serial port to 9600 baud.
53.El
54.Pp
55The rest of this manual page will discuss the bootselecting versions of
56the MBR.
57The configurable items of the bootselector are:
58.Bl -tag -width Er
59.It timeout
60The number of seconds that the bootcode will wait for the user to
61press a key, selecting a menu item.
62Must be in the range 0-3600, or \-1 when it will wait forever.
63.It default
64The default partition or disk to boot from, should the timeout
65expire.
66.El
67.Pp
68The bootselector will output a menu of the
69.Em bootmenu
70names for each partition (as configured by
71.Xr fdisk 8 ) .
72The user can then select the partition
73or drive to boot from via the keyboard.
74.Pp
75The numeric keys
76.Sy 1
77upwards will initiate a startup from the corresponding partition.
78.Pp
79Function keys
80.Sy F1
81through
82.Sy F8
83(keys
84.Sy a
85through
86.Sy h
87for the serial versions)
88will boot from hard disks 0 through 7 (BIOS numbers 0x80 through 0x87).
89Booting from a drive is simply done by reading the MBR of that
90drive and executing it, so the bootcode present in the MBR of the
91chosen drive determines which partition (if any) will be booted in
92the end.
93.Pp
94The
95.Sy Enter
96key will cause the bootcode to find the active partition, and boot from it.
97If no key is pressed, the (configurable) default selection is picked.
98.Sh DIAGNOSTICS
99The following errors are detected:
100.Bl -column Code "No active partition"
101.It Em Code Ta Em "Text message" Ta Em Explanation
102.It 1 Ta "No active partition" Ta
103The MBR has a partition table without an active partition.
104.It 2 Ta "Disk read error" Ta
105There was an error reading the bootsector for the partition or
106drive selected.
107.It 3 Ta "No operating system" Ta
108The bootsector was loaded successfully, but it was not valid (i.e.,
109the magic number check failed, or it contained no code).
110.It L Ta "Invalid CHS read" Ta
111The boot partition cannot be read using a CHS read and the system BIOS
112doesn't support LBA reads.
113.It ? Ta "" Ta
114Unknown key.
115.El
116.Pp
117The standard boot code will output the text message and stop.
118It may be necessary to reset to the system to continue.
119.Pp
120The bootselect code will output 'Error <code>' and await further input.
121.Sh SEE ALSO
122.Xr disklabel 8 ,
123.Xr fdisk 8 ,
124.Xr installboot 8 ,
125.Xr mbrlabel 8 ,
126.Xr x86/boot 8
127.Sh BUGS
128The bootselect code has constraints because of the limited amount of
129space available.
130The only way to be absolutely sure that a bootselector will always
131fit on the disk when a partition table is used, is to make it small
132enough to fit into the first sector (512 bytes, 404 excluding
133the partition table and bootselect menu).
134.Pp
135The error messages are necessarily terse.
136