Loading the Linux Kernel

When you power on a computer, a carefully orchestrated sequence of events occurs to load the operating system. For Linux users, understanding this process—especially the roles of bootloaders, kernels, and critical components like initrd—can demystify how your machine springs to life. Let’s break it down step by step.

But before we start with this we need to define what a kernel is?

Think of the kernel as the core "bridge" between your computer’s hardware (physical components like the CPU, RAM, and hard drive) and the software (apps, files, and the operating system itself). Without the kernel, your operating system couldn’t function—it’s like the conductor of an orchestra, ensuring every part works in harmony.

1. The Hardware Foundation: BIOS vs. UEFI

Every operating system, including Linux, relies on hardware to function. Before any software runs, your computer’s firmware—either BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface)—kicks into action. These systems initialize hardware components (like your disk drives or RAM) and prepare the machine to load software.

  • BIOS: The older standard, which uses a simple interface and boots from a predefined disk location.

  • UEFI: A modern replacement that supports faster boot times, larger disks, and secure booting.

UEFI is now the default for most systems. Once it finishes initializing hardware, it hands control over to a bootloader.

2. The Bootloader: GRUB, GRUB2, and LILO

The bootloader’s job is to locate and load the Linux kernel into memory. On Linux systems, common bootloaders include:

  • GRUB (Grand Unified Bootloader): The classic bootloader, identified by files like menu.lst in the /boot/grub directory.

  • GRUB2: An updated version of GRUB, now the standard for most Linux distributions. Look for a grub.cfg file in /boot/grub2.

  • LILO (LInux LOader): An older, less common option today.

To check which bootloader your system uses:

ls /boot/grub  # Look for menu.lst (GRUB) or grub.cfg (GRUB2)

The bootloader not only loads the kernel but also provides a menu to choose between installed operating systems or kernel versions.

3. Loading the Linux Kernel (But Not the Whole Story)

Once the bootloader selects a kernel, it loads the core Linux kernel into memory. However, this kernel is not fully functional yet. Modern Linux systems rely on hardware drivers and filesystem modules stored on the disk—but if the kernel can’t access the disk yet, how does it load those modules?

This is where initrd (Initial RAM Disk) comes in. The initrd is a temporary filesystem loaded into memory alongside the kernel. It contains just enough drivers and tools (e.g., for disk encryption or network access) to help the kernel mount the real root filesystem. Once the full system is accessible, the initrd is discarded, and the kernel takes over completely.


4. Booting Over the Network: PXE and iPXE

Linux can also boot without physical media using network-based methods:

  • PXE (Preboot Execution Environment): A standard for booting from a network server. Here’s how it works:

    1. The client machine sends a DHCP request.

    2. The DHCP server responds with the IP address of a TFTP (Trivial File Transfer Protocol) server hosting the boot files (kernel, initrd).

    3. The client downloads these files and proceeds with booting.

  • iPXE: An advanced version of PXE that replaces TFTP with HTTP, enabling faster, more reliable transfers over modern networks.

This method is widely used in data centers or for deploying Linux on multiple machines simultaneously.


5. Bringing It All Together

To recap, the Linux boot process follows this sequence:

  1. Firmware (UEFI/BIOS) initializes hardware.

  2. Bootloader (GRUB2) locates and loads the kernel + initrd.

  3. initrd provides temporary drivers to access the root filesystem.

  4. The full kernel takes over, initializing the rest of the system.


Why Does This Matter?

Understanding the boot process helps troubleshoot issues like:

  • Bootloader errors (e.g., GRUB rescue prompts).

  • Kernel panics due to missing drivers.

  • Network boot failures in enterprise environments.

Whether you’re booting from a USB drive, a DVD, or a server halfway across the world, these components work together to turn hardware into a functioning Linux system. Next time you reboot your machine, you’ll know exactly what’s happening behind the scenes!

10
Subscribe to my newsletter

Read articles from Oyetunji ibukunoluwa directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Oyetunji ibukunoluwa
Oyetunji ibukunoluwa