A boot loader (or a boot manager) is a program that runs on a computer when it first starts up before the operating system is loaded. The boot loader is typically stored in firmware or on a hard drive and is responsible for initializing the system, performing hardware tests, and giving control to the operating system.
This article aims to explain the boot loader, its purpose, and its usage in Linux systems.
Let’s start with the purpose of the bootloader.
What is the Purpose of a Boot Loader?
The boot loader allows the user to select between operating systems or kernel versions if multiple are present. It can also provide a user interface for configuring boot-time options, such as selecting the operating system to boot.
Why do we Need a Boot Loader?
The boot loader is necessary because the operating system cannot be loaded directly by the computer’s BIOS or firmware. The boot loader loads the OS kernel and initializes the system. In addition, boot loaders can also provide advanced features such as disk encryption, disk partitioning, and boot-time debugging.
How Does Boot Loader Work in Linux?
In Linux, the boot process starts with the BIOS or UEFI firmware, which performs a power-on self-test (POST) and then looks for a boot loader on the hard drive or other bootable media.
One of Linux’s most commonly used bootloaders is GRUB (GRand Unified Bootloader). When the system starts, GRUB is loaded by the BIOS or UEFI firmware and presents a menu of available operating systems or kernel versions to boot. The user can select an option from the menu or wait for a timeout to pass, after which the default option will be automatically selected.
Once the user has selected an option, GRUB loads the kernel into memory. After that, the kernel initializes the hardware and starts the initial process. The init process then starts other system services and daemons, and eventually, a login prompt is presented to the user.
The boot loader loads the system into existing memory and begins it. It initializes the system, performs hardware tests, and controls the operating system. This article has demonstrated the purpose, need, and working of a boot loader in Linux.