What makes bootable media bootable?

Out of curiosity, what makes media bootable? Links to explanations would be appreciated.


Solution 1:

Maybe a few details about how bootable media are organized could help define "what makes bootable media bootable".

The boot procedure differs depending on architectures, so I'll just stick to standard PC (i.e. x86 architecture).

First, to be effectively "booted", a medium needs to be selected by the BIOS after the later's power-on self test (POST). For this to happen, the medium must be marked as bootable, which means that it must have a boot signature in its first sector. This is the very first thing that makes a medium bootable.

Then, the BIOS loads and gives the hand to this boot sector (whatever is stored there... so it could well directly be a fitting real-mode program, but let's stick to a "normal" scheme). So, to be bootable, a medium must have such functioning boot sector.

If the medium is partitioned, then a Master Boot Record (MBR) is installed in this sector. This code will be responsible for checking the partition table and finding the partition with the bootable flag set. Then, the MBR will load the first sector of this partition, which contains what is referred to as Volume Boot Record (VBR). Note that in the case of an unpartitioned medium, a VBR is located in the first sector of the medium and is therefore directly called by the BIOS.

A VBR contains a bootstrapping program. This program must initialize the machine (i.e. activation of extended memory through the A20 Gate, switch from real mode to protected mode, etc) to set an environment proper for "modern" code to run, load this code in memory, and then "jump" to it. The above-mentioned code can be either an OS kernel in the case of a bootloader program, or a multiboot system (e.g. GRUB, LILO) in the case of chain-loading. Anyway, in the end, some executable code to run is needed for the medium to boot.

What follows (e.g. kernel decompression, initial ramdisk mounting, modules loading in the case of hybrid kernels or servers starting for microkernels, etc) is not strictly relevant from the viewpoint of bootable media organization.

Note: What I described is the process for hard-disks and floppies. The case of CDs is very similar though. In addition, to be bootable, a CD must follow the El-Torito specification, which is an extension of the ISO9660 standard. Originally, the CD was required to contain a bootable floppy disk image (i.e. a 1.44M image actually), which was treated by the BIOS as a floppy and was booted accordingly. More recent hardware allow to boot directly without this workaround.

Solution 2:

What makes a bootable medium bootable is

  • standards for bootable media which define things such as:
    • hardware platform for which the boot-loader is applicable.
    • location on media of boot-loader software.
    • the process by which that software will be loaded.
  • implementation of those standards in the hardware to which media is attachable.

Wikepedia has an article that describes the boot process.