iMBR(8) System Manager's Manual (x86) iMBR(8)

NAME

iMBRinteractive Master Boot Record bootcode program

DESCRIPTION

x86 booting

The BIOS of the IBM PC and compatible computers attempts to boot the operating system from a disk by loading its first sector (at physical location: cylinder 0, head 0, sector 1) into memory. If the last word (i.e. two bytes) in this sector matches the signature of AA55 (this is a number in hexadecimal notation), the BIOS considers that disk as bootable. The BIOS then proceeds to call the machine code in this sector. For a hard disk, the 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).

The code present in the MBR typically examines the partition table with four entries, finds the partition that is marked ‘active’, and boots from it. Booting from a partition simply means loading the first sector of that partition (called Partition Boot Record or PBR) into memory, checking the PBR's signature and executing the code in the PBR, as is done for the MBR itself.

The boot disk is usually specified in the BIOS setup program.

Geometry and disk addressing modes

MBR disk addressing is based on 512-byte sectors.

The PC BIOS has an API to manipulate any disk that the BIOS happens to support. The API (known as CHS disk addressing) uses 10 bits to address the Cylinder, 8 bits to address the Head, and 6 bits to address the track Sector of a disk. This restricts any application (including MBRs and PBRs) using the BIOS to being able to address only 1024 cylinders, 256 heads, and 63 sectors (since the sectors are numbered from 1) on a disk. CHS disk addressing has the maximum address limit for a PBR placement on a disk. This limit equals to 8064 Megabytes (C*H*S*sector_size = 1024*256*63*512 bytes).

Modern disks have many more cylinders than the CHS disk addressing BIOS API can support, and likely more sectors per track as well. So the BIOS has to ‘re-map’ the cylinder/head/sector of the real disk geometry into something that would allow the applications using the BIOS to access these large disks, still using the restricted BIOS API. This geometry ‘re-mapping’ is disk controller and computer specific.

Note about the difference beetween tracks and cylinders. A hard disk is usually made up of multiple platters, each of which use two heads to record and read data, one for the top of the platter and one for the bottom (this is not always the case, but usually is). The heads that access the platters are locked together on an assembly of head arms. This means that all the heads move in and out together, so each head is always physically located at the same track number. It is not possible to have one head at track 10 and another at track 100. Because of this arrangement, often the track location of the heads is not referred to as a track number but rather as a cylinder number. A cylinder is basically the set of all tracks that all the heads are currently located at. So, for example, if a disk had four platters, it would (normally) have eight heads, and cylinder number 17 would be made up of the set of eight tracks, one per platter surface, at track number 17. Such a statement is valid for any cylinder. Each track is uniquely defined by the cylinder number and the head number of the disk.

To support larger addressing modes, an interface known as “INT 13h Extensions” was introduced. It uses Logical Block Addressing (LBA). LBA is a linear addressing scheme where only one number is used to address a disk sector. Sectors are sequentially numbered as integer indexes starting with 0. MBR partition tables use 32 bits for storing LBA numbers and size information. LBA extends the address limit for a PBR up to (512*(2**32)) bytes or 2 Terabytes.

iMBR features

iMBR is a bootcode program. Default (unconfigured) iMBR has the same functionality as MBR bootcode programs supplied by other operating systems: it picks the ‘active’ partition and boots from it. iMBR supports LBA (tried first) and CHS disk addressing (tried if LBA is not supported by the BIOS). iMBR can be installed with iMBR_editor(8) and fdisk(8).

Also iMBR can be configured so as it will present the user with a prompt, allowing a choice between partitions to boot from. The choices and default settings can be set through iMBR_editor(8).

Configurable options of iMBR

OS names
Any partition may be assigned a name up to 7 ASCII characters.
boot flags
The partition must be ‘active’ to be bootable.
default OS
The default partition to boot from.
timeout
The number of seconds that iMBR will wait for the user to press a key, typing an OS name. It must be in the range of 1-1799 (i.e. 30 minites maximum), or 0 when it will wait forever.

iMBR outputs the prompt “OS: ”. The user can then type via the keyboard an OS name (which has been assigned to a partition) to boot.

The <Enter> key (and the expired timeout) causes iMBR to find the ‘active’ partition, and boot from it. If no key is pressed, the default OS is picked.

FILES

iMBR
The iMBR bootcode program image.
iMBR.LBA
The iMBR bootcode program image (which supports only “BIOS INT 13h extensions”).
iMBR.CHS
The iMBR bootcode program image (without support of “BIOS INT 13h extensions”).

DIAGNOSTICS

In case of an error, iMBR displays one of the ASCII characters:

Character
Explanation
?
No such OS name, or the partition is not ‘active’, or the PBR has an invalid signature.
!
The PBR reading error has been detected.

iMBR will await further input.

SEE ALSO

iMBR_editor(8), fdisk(8)

STANDARDS

There is no published standard for MBR and PBR.

HISTORY

The first working version 1.3 was released on August 05, 1997.

AUTHORS

Alexei G. Malinin <Alexei.Malinin@mail.ru>

http://am1225.narod.ru/software/iMBR/

CAVEATS

iMBR is used on systems with PC-platform (x86) style MBR partitioning.

BUGS

The iMBR bootcode has constraints because of the limited amount of available space. The MBR bootcode size must not be greater then 440 bytes to preserve the NT disk signature (an optional 32-bit value that is located in bytes 441-444) which uniquely identifies disks for Microsoft operating systems. The diagnostics is necessarily terse.
January 28, 2018