DEV Community

PGD
PGD

Posted on

Linux Booting process

First of all, once a user turn the power on, the BIOS (Basic Input/Output System) is loaded from the ROM embedded on the motherboard. BIOS is responsible for initializing hardware such as screens, keyboard and testing the memory.
BIOS is not a part of OS (Operating System), but a component of hardware. After BIOS completes its tasks, the system control is passed to boot loader, which is responsible for loading and initializing operating system.
For BIOS/MBR system, the boot loader is stored in the boot sector, also known as MBR (Master Boot Record), which is the first sector of a disk, while for EFI ((Unified) Extensible Firmware Interface) system, the boot loader is stored in a partition of a storage (usually SSD or HDD), which is called ESP (EFI System Partition).
There are several boot loaders can be used

  • GRUB (GRand Unified Boot loader) for most of the Linux system
  • ISOLINUX for booting Linux system from removable disk
  • DAS U-Boot for booting Linux system in embedded devices

At the beginning of tasks the boot loader will do, the boot loader prompts the user to choose options for booting Linux or even alternative operating systems. In case of booting Linux, the boot loader is responsible for loading the kernel image and the initial RAM disk or filesystem (contains critical files and device drivers necessary for starting the system) into memory.

The boot loader is executed on the two distinct stage.
At the first stage, for BIOS/MBR system, the boot loader looks up partition table and finds a bootable partition. Once it finds a bootable partition, then it finds and loads the second stage boot loader, such as GRUB. For EFI/UEFI system, UEFI firmware reads the Boot Manager data which describes which UEFI application is to be launched and which partition the EFI exists. The UEFI firmware launches UEFI application, GRUB for instance, as defined in the boot entry in the firmware's boot manager. EFI/UEFI method is more versatile than the old BIOS/MBR method.
At the second stage, the GRUB allows the user to choose which operating system or kernel to be launched. Once an OS or kernel is selected, GRUB loads kernel on the memory and passes control to it. The kernel is usually compressed such that the first thing the kernel should do is uncompressing itself. And then, the kernel will analyze and check the state of hardware, and initialize hardware driver built into the kernel.

[TODO]

Top comments (0)