Linux Load Process (boot)
Understand how Boot Managers work on Linux
Any PC computer when turned on initiates a series of complex hardware testing actions programmed by a special memory called BIOS.
This memory has the function of starting the machine, recognizing the installed devices and loading the operating system.
During boot, the BIOS performs a series of tests whose function is to determine exactly the hardware components installed in the system. This test is called POST (power-on self test).
It is through the POST that the computer searches for information on the numbers and types of cards, CD-Rom drives, hard drives, serial and parallel ports and USBs, monitors, mice, keyboards, etc.
Soon after the hardware tests, the BIOS searches the devices of hard drives and CD-ROM one special address called the boot sector.
On motherboards that adopt the EFI or UEFI system, the operating system loading process involves reading a special load file from a file system on a special partition called EFI System Partition (ESP).
This special partition uses the FAT (File Allocation Table) format. On Linux it is typically mounted on /boot/efi.
This scheme used by EFI is more complex than in the BIOS, allowing each operating system installed on the computer to have its own separate boot load system.
Thus, EFI has a “boot manager” that allows the user to choose which boot load system they want to start when they turn on the computer.
For this EFI “boot manager” system to work, it is I need the boot load systems to be properly registered in firmware through EFI’s own utility or through the efibootmgr program on Linux.
Kernel Load Process
Depending on the type of disc used, the boot sector, or load sector, is located at a location specific with a certain signature defined by industry standards.
It is in the boot sector that the operating systems write the software responsible for initiating the loading of the operating system.
In this way, the BIOS or motherboard firmware searches the boot sector of the disk for the boot manager.
On Linux, the most common managers are GRUB and GRUB 2. They are responsible for the Kernel’s memory load.
During the kernel load, Linux loads a special file system called initramfs, which contains a minimalist version of the file system, so that the init process (parent of all processes on Linux) can be loaded.
This allows various tasks to be performed before the actual file system is loaded.
After loading the Kernel, it starts a special process called init (for SystemV-based systems) or systemd (for Systemd-based systems).
Both init and systemd are the parent of all processes and are responsible for the rest of the Linux boot load.
After the boot load, init calls another special program called Getty, which is responsible for authenticating users and starting the shell process.
Here’s how Grub works on Linux:
Learn much more about Linux in our online course. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.