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

NAME

iMBR_editorinteractive editor for iMBR

SYNOPSIS

iMBR_editor <an iMBR bootcode file> <a device/file with an MBR to edit> <a device/file with the MBR to write>

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 into memory. 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 MBR also contains a bootcode, an indication of which partition is ‘active’ and (optionally, depending on the bootcode) an option to select a partition to be booted.

The bootcode present in the MBR typically examines the partition table with four entries, finds the partition that is marked ‘active’, loads into memory the first sector of that partition (this sector is called the Partition Boot Record or PBR), checks the signature of the PBR and passes control to the next stage bootcode stored in the PBR.

The traditional MBR bootcode can only boot from a single ‘active’ partition. iMBR(8) allows the user to interactively select a partition to boot from.

iMBR_editor is used to display or update the iMBR(8) options of the MBR.

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(8) 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_editor arguments

<an iMBR bootcode file>
A file with an iMBR bootcode program (see FILES).
<a device/file with an MBR to edit>
A device or file with an MBR to edit (see EXAMPLES).
<a device/file with the MBR to write>
A device or file with the MBR to write (see EXAMPLES).

Typical layout

iMBR_editor initial screen looks like this:

The iMBR bootcode file:			iMBR 
The device/file with an MBR to edit:	mbr.fd0 
The device/file with the MBR to write:	fd0.mbr 
+-----------+----------+-----------+---------+ 
| partition | ID,  hex | boot flag | OS name | 
+-----------+----------+-----------+---------+ 
|     0     |    00    |           |         | 
|     1     |    00    |           |         | 
|     2     |    00    |           |         | 
|     3     |    00    |           |         | 
+-----------+----------+-----------+---------+ 
+------------+------------+------------------+ 
|    iMBR    | default OS | timeout, seconds | 
+------------+------------+------------------+ 
|            |            |                  | 
+------------+------------+------------------+ 
  <1> read the MBR 
  <2> load the iMBR bootcode 
  <3> set an OS name 
  <4> switch a partition boot flag 
  <5> set the default OS 
  <6> set the timeout 
  <7> write the MBR 
  <8> print a partition geometry 
<Esc> exit 
 
press the key:

To configure iMBR(8) options (see Configurable options of iMBR) the existing MBR must be read and the iMBR(8) bootcode must be loaded (keys <1> and <2>):

+-----------+----------+-----------+---------+ 
| partition | ID,  hex | boot flag | OS name | 
+-----------+----------+-----------+---------+ 
|     0     |    xx    |           |         | 
|     1     |    xx    |           |         | 
|     2     |    xx    |           |         | 
|     3     |    xx    |           |         | 
+-----------+----------+-----------+---------+ 
+------------+------------+------------------+ 
|    iMBR    | default OS | timeout, seconds | 
+------------+------------+------------------+ 
|############|            |                1 | 
+------------+------------+------------------+

‘xx’ means a partition identifier (type) in hexadecimal notation (for example, ID for FAT32 is ‘0C’).

iMBR_editor keys functions are obvious from brief descriptions on the iMBR_editor screen (see above; for the key <7> see CAVEATS; for the key <Backspace> (or <BS>) see BUGS).

FILES

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

EXIT STATUS

The iMBR_editor utility exits 0 on success, and >0 if an error occurs.

EXAMPLES

For the following examples it is assumed that all necessary files are in the current directory.

To install and configure the iMBR(8) bootcode on OpenBSD with boot disk ‘sd0’ run:

# iMBR_editor ./iMBR /dev/rsd0c /dev/rsd0c

To install and configure the iMBR(8) bootcode on NetBSD-i386 (tested on v7.1) with boot disk ‘wd0’ run:

# iMBR_editor ./iMBR /dev/rwd0d /dev/rwd0d

To install and configure the iMBR(8) bootcode on GNU/Linux (tested on Debian GNU/Linux-amd64, v9.3) with boot disk ‘sda’ run:

# iMBR_editor ./iMBR /dev/sda /dev/sda

To install and configure the iMBR(8) bootcode on Windows run ‘cmd.exe’ as ‘Administrator’, then in the ‘cmd.exe’ window run:

C:\TMP>iMBR_editor iMBR \\.\PhysicalDrive0 \\.\PhysicalDrive0

To save the existing MBR (on OpenBSD, boot disk ‘wd0’) to the file “saved_MBR” run:

# iMBR_editor ./iMBR /dev/rwd0c saved_MBR

and press <1>, then <7>.

To restore saved MBR (on NetBSD-i386, boot disk ‘wd0’) from the file “saved_MBR” run:

# iMBR_editor ./iMBR saved_MBR /dev/rwd0d

and press <1>, then <7>.

To prepare new MBR (on Windows) with iMBR(8) options and save it to the file “new_MBR” run:

C:\TMP>iMBR_editor iMBR \\.\PhysicalDrive0 new_MBR

press <1>, <2>, configure iMBR(8) options, then press <7>.

To install previously prepared MBR (on GNU/Linux, boot disk ‘sda’) with iMBR(8) options from the file “new_MBR” run:

# iMBR_editor ./iMBR new_MBR /dev/sda

and press <1>, then <7>.

DIAGNOSTICS

iMBR_editor reports about the following problems:
the device/file reading error...
There are many reasons for such a message, but the most important is that there is no read permission for the device/file.
the device/file writing error...
There are many reasons for such a message, but the most important is that there is no write permission for the device/file.
load the iMBR bootcode...
To configure iMBR(8) options the iMBR(8) bootcode must be loaded.
0<= partition number <=3...
Partition number must be in the range 0-3.
this partition is empty...
Options for a partition with ID (type) 0 are not configurable.

SEE ALSO

iMBR(8), fdisk(8), dd(1)

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

It is recommended to run iMBR_editor once or twice to see how it works. This is completely safe as long as the key <7> is not used.

The device/file read/write permission is necessary to read/write the MBR.

Before any MBR modifications save (!) the original MBR somewhere so it can be easily restored in cases of unexpected events.

There are operating systems which do not use PBR for booting (for example, some GNU/Linux distributions with “GRUB” installed as MBR). In these cases iMBR(8) will not be able to boot such operating system. But it is possible to replace the appropriate empty PBR with the MBR installed by this operating system, and then install and use iMBR(8). For the above example, if the installed GNU/Linux operating system has the root filesystem in the first primary partition of the boot disk ‘hda’ and uses “GRUB” as MBR for booting (and the appropriate PBR is empty!), then the following GNU/Linux command will replace the empty PBR with the original MBR:

# dd if=/dev/hda of=/dev/hda1 bs=512 count=1

BUGS

If the key <Backspace> (or <BS>) does not work, use the key combination <Ctrl>+<H> (see also stty(1) manual about ERASE character).
January 28, 2018