A bootloader, from the shortened form of the original word bootstrap loader), also known as a launcher, is a special piece of software that is usually installed by a computer’s system firmware (e.g., the BIOS, Open Firmware, or UEFI) from a bootable medium. loaded and then executed. The bootloader then loads other parts of the operating system, usually a kernel. This is why we often talk about boot code, the first program (machine code) that is loaded from a removable mutable data store after the immutable firmware. The process itself is called booting a computer.
The term “bootstrap” originally refers to the loop that is located at the back of a boot to make it easier to put on the boot. The process of booting (running a program on a computer that is not yet running an operating system) is partly reminiscent of the effort to pull oneself out of the mud by one’s own boot loop.
A first “bootstrap loader” is located in the hardware itself. Most of the time, it’s a boot ROM that initializes the hardware components that are essential for booting, searches for a launcher, and, if one is found, executes it. Where the bootloader should be located on the mutable data store and how it is loaded varies depending on the computer architecture and platform. On more modern architectures, it is usually stored as a file on a firmware-supported file system on a supported bootable medium, such as a specific partition on the hard drive, and is loaded and executed directly from it. This is the case, for example, with Open Firmware and UEFI, although the partition tables and file systems used may be different. The bootloader itself must also be in a specific executable file format. On the one hand, this can be due to the processor architecture and in particular its instruction set, such as PE/COFF in UEFI, or the firmware implements a cross-architecture intermediate code format such as Open Firmware with Forth FCODE. Some older architectures load the bootloader from a predefined block of bootable media, which is therefore also known as the boot block or, more commonly, the boot sector. On IBM PC-compatible computers with a BIOS, this is always located in the first block, block 0, which usually contains a Master Boot Record (MBR) as both a boot program and a partition table on partitioned disks such as hard drives. On floppy disks, block 0 is loaded and executed in the same way, but there is usually no partition table there, but a Volume Boot Record (VBR).
---

Solar charger made by Lukas, soldernerd.com
In the field of embedded systems, too, we speak of bootloaders. There, the bootloader often cannot be reloaded, but is located in the non-volatile memory of the control unit. It contains basic initialization routines and often communication protocols to enable the exchange of application programs.
For cost reasons, the Raspberry Pi only has a minimal boot ROM directly in the SoC. This first firmware stage can’t do anything other than access the SD card and load and execute the file from a FAT paritition. In the case of a Linux system, this second firmware stage initializes the rest of the hardware and then executes a third stage from the file. This bootstrap loader, in turn, now loads the firmware for the CPU and GPU into the RAM. Only then is the single-board computer ready to load the Linux kernel, applying the firmware configuration from file and kernel parameters from file. A boot manager is a utility that can be installed on an operating system and contains its own bootloader and offers advanced configuration options.
Multi-Stage Bootloaders
If a bootloader is divided into several successive stages, it is called a multistage bootloader. This division into stages is made, for example, if the program code of the bootloader does not fit in the boot sector; At this point, therefore, only the first stage is loaded and executed, which then loads and executes the second stage, of which the first stage only knows the length, the block number and the number of the medium. The second stage can now handle the specific file system of the medium and loads the third stage based on a file name. The third stage is now the actual bootloader and loads a configuration file that contains, for example, a selection menu. A menu item could contain an instruction to load a bootloader from another partition.
This multi-stage structure has several advantages: In the case described above, the file of the actual bootloader can be changed at will or even physically moved, since the second stage can handle the file system and can find the third stage based on the file name. In addition, such a bootloader is not subject to the limitations of the length of a boot block.
Chain-Loader
It is also possible for multiple bootloaders to call each other one after the other, as in a chain of command. Such calls – usually across multiple partitions – are also called chain-loading or chainloading. In this case, a bootloader can be loaded first, which is, for example, a boot menu for operating system selection, and then, depending on the selection in this menu, the corresponding (operating system-specific) bootloader. In this way, several different operating systems can be operated side by side on one computer in a so-called multi-boot system.