Linux Boot process: Simplified


The Linux boot process is a sequence of events that starts when the computer is turned on and ends when the Linux operating system is fully loaded and ready to use. Here’s a simplified overview:
BIOS/UEFI: The system’s firmware initializes the hardware and checks for basic functionality.
Bootloader: The bootloader (like GRUB) is loaded from disk, which then loads the kernel.
Kernel: The Linux kernel is loaded into memory and starts initializing system components and drivers.
Initramfs: An initial RAM filesystem may be loaded, which contains tools and scripts to mount the real root filesystem.
Root Filesystem: The root filesystem is mounted, and the kernel hands over control to the init system.
Init System: The init system (like systemd or SysVinit) runs startup scripts to set up all necessary services and user space programs.
Login: Finally, the system reaches a login prompt or graphical login screen, ready for user interaction.
BIOS/UEFI boot
The BIOS/UEFI firmware is stored in a special type of non-volatile memory chip on the motherboard of a computer, often referred to as ROM (Read-Only Memory). When you power on your computer, BIOS/UEFI performs POST to check the hardware components like memory, keyboard, and storage devices for any errors. It initializes all connected hardware devices and prepares them for use by the operating system. BIOS/UEFI locates and runs the bootloader from the storage device to start the boot process.
Here are a few differences between BIOS and UEFI.
BIOS vs UEFI
Bootloader
A bootloader is a small program that runs when a computer starts up, before the main operating system begins to load. The bootloader is activated after the BIOS/UEFI has completed its initial checks and setup routines. It locates the kernel on the storage device, loads it into memory, and passes control to it. In systems with multiple operating systems, the bootloader presents a menu for users to select which OS to boot. Common bootloaders for Linux include GRUB (GRand Unified Bootloader), LILO (Linux Loader), and systemd-boot.
Kernel
The kernel is the core component of an operating system. It acts as the bridge between applications and the actual data processing done at the hardware level.
Initramfs
Initramfs (initial RAM filesystem) is a temporary root file system that is loaded into memory when the Linux system boots. It’s used during the initial boot process before the real root file system is mounted. Initramfs provides an early userspace environment where the kernel can execute helper scripts and utilities. It can contain the necessary drivers required to mount the real root file system, especially if those drivers are not built into the kernel. Initramfs facilitates the mounting of the real root file system by performing tasks like decrypting encrypted partitions or assembling RAID arrays.
Root Filesystem
It’s the first file system that gets mounted during boot and contains all the other directories and files necessary for the system to run. The root file system is crucial because it contains all the necessary applications and files to boot and run the system. It’s typically located on a physical storage device but can also be on a network or a logical volume.
Init system
The init system is the first process started by the Linux kernel and is responsible for controlling the startup, running, and shutdown of all other processes. Common init systems include systemd, which is widely used in modern Linux distributions, and SysVinit, which was used in older distributions.
Subscribe to my newsletter
Read articles from Elavarasan A directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
