What is a bootloader and how does it work?
Bootloaders ensure that all relevant operating system data is loaded into the main memory when a device is started. During the boot process, the firmware transmits the required information.
What is a bootloader?
Data of an operating system must be loaded into the working memory during device start-up. This is made possible by a so-called bootloader, also known as a boot program or bootstrap loader. For this purpose, immediately after a device starts, a bootloader is generally launched by a bootable medium like a hard drive, a CD/DVD, or a USB stick. The boot medium receives information from the computer’s firmware (e.g. BIOS) about where the bootloader is. The whole process is also described as “booting”.
The term “bootloader” is a shortened form of the words “bootstrap loader”. The term stems from the fact that the boot manager is the key component in starting up the computer, so it can be likened to the support of a bootstrap when putting a boot on.
How does a bootloader work?
When you press the start button on a computer, the very first thing you see on the screen is information about the hardware installed. The software responsible for this notification is the device firmware mentioned above, which is usually implemented by manufacturers in flash memory on the computer’s motherboard. With most desktop PCs and notebooks this will be the BIOS (Basic Input/Output System) or the more modern UEFI (Unified Extensible Firmware Interface). Both applications collect the most diverse hardware data and create a complete list of all of the device’s available drives.
When this process is complete, the firmware goes through the data carriers found in sequence, checking for a bootloader by means of a special signature – the so-called boot signature (or “boot record”). The search always starts on the removable media (CD/DVD, USB stick, external hard drive, etc.), followed by the hard-coded drives. With the latter, the bootloader and its signature is generally in the Master Boot Record (MBR), which also contains the data carrier’s partition tables. When a bootloader is found, it is loaded and the system start is initiated. If the search is unsuccessful, the firmware will return an error message.
As soon as you have installed an operating system properly it will launch via a bootloader, which is typically located on the main partition. If the system is damaged, however, and ought to be installed again, you are dependent on the bootable removable media mentioned previously. This also applies if no operating system is installed. You can find out how to transform a standard USB stick into a fully functional boot medium in our guide.
Where exactly are bootloaders stored?
Bootloaders can be stored in two different places:
- The bootloader is stored in the first block of the bootable medium.
- The bootloader is stored on a specific partition of the bootable medium.
The first variant is closely connected to the principle of master boot records, which don’t just contain the link to the bootloader required by the firmware, but the boot software itself. The first available memory block or sector in the medium is always reserved for the record. Because of this important function, it is also known as the boot block or boot sector.
In the second case, the operating system uses a selected partition as the storage location for the bootloader, though the underlying file system and the partition tables used can vary greatly. The decisive factor here is always the firmware, which stipulates a specific file format for the boot manager in this bootloader storage model. For devices with UEFI, for example, the format is PE/COFF (Portable Executable / Common Object File Format).
Bootloaders can also be spread across several layers that build upon each other. These multi-stage bootloaders consist of up to three different levels that are launched in sequence. They are typically used if the boot program is too big for the boot sector.
A summary of a bootloader’s functions
Bootloaders serve as a mediator between hardware and the operating system. As soon as a bootloader has been initialized by the respective firmware, it has system responsibility to get the boot process going. The first task is to load the main memory, which is essential for the processor to work.
In the second step, the bootloader loads the kernel of the operating system, that is, the primary component of the system software that controls all storage and processor permissions and contains all important drivers. The bootstrap loader also processes different routine tasks and commands, e.g. integrating data storage. Some bootloaders also perform tasks beyond starting up software, including:
- Identifying and starting other available bootloaders
- Launching application programs (frequently used in the 1980s to launch computer games directly from a disk)
- Correcting or expanding missing functions and entries in the firmware
- Loading alternative firmware
After successfully completing all tasks, the bootloader returns the system responsibility to the kernel.
What well-known bootloaders are there?
The following table lists the most important bootloaders:
Name of the bootloader | Description |
---|---|
Bootmgr | boot program for Microsoft systems since Windows Vista and Windows Server 2008 |
NT loader (NTLDR) | boot program for Microsoft systems until Windows XP and Windows Server 2003 |
barebox | bootloader for embedded systems in printers, cameras, cars, airplanes, and more |
boot.efi | EFI bootloader that has been used in Mac devices since 2006 |
BootX | former bootloader for Mac operating systems |
Grand Unified Bootloader (GRUB) | free boot program for Unix-like operating systems such as Linux |
ARM Core Bootloader | bootloader for microcontrollers (used in iPhones among others) |
OpenBIOS | free, portable boot manager under a GNU-GPL license |