A boot loader is a piece of software designed to load an operating system kernel during the process of booting a computer. On a PC, the boot loader is read from disk and generally loads the kernel from the disk, while on other computer architectures it may be built into the boot firmware. Most operating systems come with their own boot loader, but a few 'multiboot' boot loaders are available.
The boot loader is necessary due to a paradox inherent in starting a computer: computers run code; code must be loaded to be run; code is loaded by other code. This problem is sidestepped by the processor beginning execution at a particular memory location, and that location being used by firmware in ROM to provide an initial set of code. Unfortunately, modern operating systems are too large and change too often to be placed in ROM, hence a boot loader becomes necessary.
Most boot loaders are run by the initial firmware or BIOS, though there are exceptions. On some systems, including PCs, the boot loader, rather than being monolithic, can actually be a chain of boot loaders, each existing to load the next until the kernel is finally loadable. Whatever the form, the boot loader needs to read the kernel off of a disk or from a network, a task requiring reasonable complexity. Disk-based boot loaders must be able to operate the disk controller and read the filesystem which the kernel is stored under. Network-based boot loaders must be able to drive the network interface, initialize a network connection, and communicate via some network protocol with the boot server (usually TFTP or PXE).
On a PC, the boot loader is read off disk by the BIOS and handed control of the machine. The BIOS is limited in its ability to understand disk structures, so it merely hands control to a valid boot sector, the first sector of a bootable disk. Due to the BIOS's method of verifying that this sector is indeed intended to be a boot sector, the boot loader in this sector is limited to 512 bytes in length. This is not enough space to implement a proper filesystem driver or networking stack, so this boot loader instead loads a second stage from a known location on the disk which can be larger and thus more capable, although DOS loads directly from the boot sector.
This is more complicated on a partitioned device, such as a hard disk. Each partition, as well as the disk as a whole, has its own boot sector. The BIOS, knowing nothing of partitions, cannot pick out the boot sector of a partition. Thus, it falls to the main boot sector, or master boot record (MBR), to choose among the partitions. PC hard disks generally have simple MBRs that simply read the partition table to find the partition marked as "Active" or as the "boot partition", and load its boot sector to serve as the next boot loader stage. This does not always happen, as some more advanced boot loaders can also install into the MBR.
On non-PC platforms, the hardware is often specifically built for a single operating system, so the boot loader can be built into the firmware. Many systems, including modern Macintosh computers, include the Open Firmware system that can serve as a boot loader. Older Macintoshes, Amigas, and Risc OS machines, among others, include significant parts of the operating system in ROM and thus do not need bootloaders in the same sense as more general computers.
The most common boot loaders on PCs are NTLDR, Microsoft's boot loader for their modern (Windows NT-based) operating systems; and GRUB, an advanced multiboot boot loader used with most newer Linux systems. Both of these can boot other operating systems by loading their respective boot loaders, GRUB being the more flexible by including a versatile command line similar in concept to Open Firmware. Other boot loaders used with the Linux kernel include the original Linux bootloader LILO, loadlin, which loads Linux kernels from DOS, SYSLINUX and its variants that are designed for boot floppies, LiveCDs, and other Linux boots that do not involve a hard disk, and yaboot, which works with Open Firmware to boot Linux on PowerPC systems.
The boot loader is an important, if relatively small, piece of software used to maintain the basic operation of a computer. While most users are content to take it for granted, the boot loader is important in itself for users of dual-boot systems, especially when such systems break down.
This writeup is copyright 2005 D.G. Roberge and is released under the Creative Commons Attribution-NonCommercial-ShareAlike licence. Details can be found at http://creativecommons.org/licenses/by-nc-sa/2.0/ .