Fundamentals 11 min read

How systemd‑boot Boots Linux: From Power‑On to the First Kernel Instruction

This article explains the complete boot sequence from powering on a PC, through UEFI firmware and the boot manager, to loading systemd‑boot as the boot loader and finally transferring control to the Linux kernel’s first executable code, detailing each component and its role.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How systemd‑boot Boots Linux: From Power‑On to the First Kernel Instruction

Boot Process Overview

The article walks through the entire boot flow starting with the UEFI firmware that runs immediately after power‑on, initializes hardware, and invokes the UEFI boot manager to locate and start a UEFI application.

UEFI Firmware and Boot Manager

UEFI firmware (firmware) is embedded software that sits between hardware and the operating system. After hardware initialization, the boot manager searches for a UEFI application stored in the PE32+ format, which is the same format used by Windows executables. Linux kernels are also compiled as PE32+ files, allowing them to be executed directly by UEFI, though a boot loader is typically inserted for flexibility.

The boot manager reads the BootOrder variable, which contains an ordered list of Boot#### variables (e.g., Boot0004, Boot0003). Each Boot#### variable stores the file path of a UEFI program, such as /boot/EFI/systemd/systemd-bootx64.efi. The manager loads the selected program with EFI_BOOT_SERVICES.LoadImage() and starts it with EFI_BOOT_SERVICES.StartImage(). Successful loading transfers control to the program’s entry point.

UEFI boot flow diagram
UEFI boot flow diagram

Choosing a Boot Loader

Two mainstream boot loaders are discussed: GRUB and systemd‑boot. GRUB is feature‑rich but complex, while systemd‑boot is simpler, integrated into systemd, and automatically available on systems that use systemd as the init system.

Because most modern Linux distributions ship with systemd, the article selects systemd‑boot to illustrate the boot sequence.

systemd‑boot Execution

systemd‑boot is itself a UEFI application whose entry point is efi_main. Its workflow includes:

Scanning /boot/loader/entries/ for .conf files, each defining a boot entry.

Reading /boot/loader/loader.conf to determine the default entry (e.g., nixos-generation-292.conf).

Loading the initrd specified in the selected entry into memory and binding it to a fixed UEFI device path.

Using EFI_BOOT_SERVICES.LoadImage() to load the Linux kernel image specified in the entry.

Applying kernel parameters from the entry to the loaded image.

Starting the kernel with EFI_BOOT_SERVICES.StartImage().

The initrd is a packaged root filesystem that the kernel extracts during early boot. The first user‑space program executed by the kernel is an init script (often a shell script or systemd) that mounts the real root filesystem and hands over control to the true init process.

Thus, systemd‑boot’s role ends once the kernel image is started; control flow then proceeds inside the Linux kernel.

Key Takeaways

systemd‑boot and the UEFI boot manager share the same mechanism—loading and starting UEFI applications via LoadImage and StartImage. Consequently, systemd‑boot can launch any UEFI application, not just Linux kernels, which is why its documentation refers to it as a UEFI boot manager rather than a traditional boot loader.

efibootmgr output
efibootmgr output
efivar output
efivar output
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

UEFILinux kernelboot loaderfirmwaresystemd-boot
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.