What happens when you turn on a computer system? At the most basic level, we know that the computer’s components power on, and the operating system “boots up” so users have a way of interacting with the systems – whether that is to play games, run a web server, set up in-depth applications or otherwise. But how does a computer know what to boot? If a processor pulls data from the system’s memory, how can it work with a freshly booted computer that does not have any processes within its memory stores? For this, the computer uses a boot loader, which is a small amount of code designed to prepare the system and then pass it to the more complex kernel, which in turn manages the operating system itself.
Boot loaders live at a predefined location within a hard drive (persistent memory); it is from this location that code is pulled into random-access memory for the processor to run. From here, the boot loader prepares the system environment, then either hands off control to the kernel or a boot sector. From the kernel, the operating system runs; from the boot sector, the new boot loader prepares the system for the next stage of the boot process – whether this is another boot sector or the final process to run in the chain. Having the boot loader taken over by another booting process one or more times is called chain loading.
Certain boot loaders, particularly those used by Linux distributions, are often capable of dual or multi-booting. This is used when one computer has multiple operating systems from which to boot. These boot launchers often feature simple terminal-style interfaces from which to select an operating system.
Master Boot Record
Initially, the master boot partition organizational schema was the only option for booting into Linux (and other) systems. This is the boot section at the beginning of a computer partition that contains the executable code for booting into the operating system. The master boot record can work with up to four partitions with boot disks up to two terabytes in size*. These limitations are removed when using the alternative GUID partition table.
GUID Partition Table
The GUID partition table is a UEFI partition organizational schema and can coexist with MBR partitions. Unlike MBR, it does not contain partition amount or size limitations. Because of this, some BIOS systems use GPT, and the greater technological community tends to be moving away from MBR.
Many Linux-compatible boot loaders work with both MBR and GPT, including GNU GRUB, an oft-used boot loader.
A common boot loader among Linux users and distributions is GRUB, created by the GNU Project, with GRUB 2 being the most-recent version of GRUB, and GRUB 1 considered the legacy version. GRUB 1 is no longer under active development and is being phased out of usage.
GRUB uses chain loading with its two-step loading process. Step 1, located in the MBR, loads the first section of core.img and contains what is needed to boot into GRUB. Stage 1.5 finishes loading the image. The second stage, finally, boots GRUB from the /boot menu and prompts the user in a terminal interface to select an operating system. Once selected, GRUB hands off the system to the kernel.
As implied, GRUB features multi-boot, in line with the Free Software Foundation’s Multiboot Specification. This allows the user to boot from any number of compliant operating systems and makes switching between systems fairly easy.
GRUB also provides users with a BASH-like interface to interact with the subsystem, allowing users to have more control over GRUB usage and configuration.
Boot loaders, overall, can be as simple as immediately passing control to a kernel or almost as complex as certain operating systems it is made to launch; GRUB, for example, is particularly complex as a boot loader, whereas others, such as gummiboot, focus on being configuration-less and “just working.” And boot loaders for Linux do not stop with GRUB, as many systems still use LILO (the Linux Loader) or others. With a selection of boot loaders available – and even the possibility of making your own – there are options available for those looking to configure their system head-to-toe, or even just explore the possibilities.
* Note that this does not prevent the system from accessing hard drives larger than two terabytes in size. It is only the boot partition that cannot be excess of 2TB.