The Boot Process
How It All Connects · Assembly & OS track
5 min read
In this module
From Power Button to Desktop
Press the power button and a tightly choreographed chain of events drags your computer from inert silicon to a running system. Each stage hands the baton to the next, building up from bare metal to a fully loaded operating system. The whole sequence ties together everything you've seen about hardware, memory, and the OS.
Here's the route on a typical x86-64 PC booting Linux through UEFI, with what's sitting in RAM and which mode the CPU is in at each stage. Keep it handy as you read the four stages below.
Stage 1: Power On and BIOS/UEFI
The instant power hits the motherboard, the CPU starts executing code at a hardwired memory address. That address points to the BIOS (Basic Input/Output System) or its modern replacement, UEFI (Unified Extensible Firmware Interface). This firmware lives in a tiny flash chip on the motherboard itself, separate from your hard drive or RAM.
First task: a Power-On Self-Test (POST), where the firmware checks that the essentials are present and working — CPU, RAM, storage, peripherals. If something critical is missing, you'll get a sequence of beep codes or a hex error on screen.
BIOS/UEFI firmware is the very first software that runs when your computer powers on. It lives in non-volatile memory on the motherboard, so it's already in place before any disk or operating system gets involved. Its job is to wake up the hardware and locate the next stage of the boot.
This BIOS/UEFI story is the PC version. Phones and most ARM and RISC-V boards follow the same shape with different parts: a boot ROM burned into the chip runs first, loads vendor firmware (on many 64-bit ARM chips that includes Trusted Firmware-A, which stays resident at the most privileged exception level, EL3) and a bootloader such as U-Boot, and the kernel learns what hardware exists from a device tree rather than by asking PC-style firmware.
Stage 2: The Bootloader
Once the firmware finishes its hardware checks, it goes hunting for a bootloader on your storage devices. UEFI systems read the EFI System Partition. Older BIOS systems read the Master Boot Record (MBR) from the very first sector of the disk.
The bootloader itself is a small program: GRUB on Linux, the Windows Boot Manager on Windows. Its only job is to find the OS kernel on disk, drag it into RAM (on Linux, along with an initramfs, a small temporary root file system holding the drivers needed to reach the real one), and hand over control. With Secure Boot switched on, UEFI checks the bootloader's cryptographic signature before running it, and the bootloader checks the kernel's in turn.
Predict: Secure Boot is on, and malware swaps the kernel file on disk for a modified copy. Which stage notices, and what happens?
The bootloader. Firmware checked the bootloader's signature and it passed, because the bootloader wasn't touched. When the bootloader loads the new kernel and checks its signature, the check fails (the attacker can change the file but can't sign it with the vendor's key), so it refuses to jump to it and the machine stops with a signature error. Nothing the attacker wrote ever runs.
Measured boot answers a different question. Instead of blocking unsigned code, each stage computes a hash of the next stage before running it and records it in a TPM (Trusted Platform Module) chip. The TPM keeps running totals in Platform Configuration Registers (PCRs): recording a measurement sets a PCR to the hash of its old value joined with the new one, so the final value depends on every stage and on their order. A disk-encryption key can be sealed to those values; boot something different and the TPM won't release the key. Trusted Platform Modules goes further.
Stage 3: The Kernel
The kernel takes the wheel. It sets up its own data structures, configures memory management, probes and configures hardware through drivers, and mounts the root file system. At this point the system is technically running, but no user-space programs exist yet; the kernel has the machine to itself.
Stage 4: Init and User Space
The kernel spawns the very first user-space process, traditionally called init (PID 1). On modern Linux systems that's usually systemd. Init starts all the background services your OS needs — networking, display managers, login screens — and eventually drops you at a desktop or login prompt.
Every process on your system descends from that first init process.
Worked Example: Reading Your Own Boot
A Linux machine keeps a record of its own boot, and you can match each line to a stage. systemd-analyze reports how long each stage took (the numbers here are illustrative):
$ systemd-analyzeStartup finished in 5.1s (firmware) + 2.3s (loader) + 1.6s (kernel) + 2.9s (initrd) + 8.4s (userspace) = 20.3sRead left to right, that's the boot in order: 5.1 seconds in UEFI (stage 1), 2.3 in GRUB (stage 2), 1.6 for the kernel to set itself up and 2.9 running from the initramfs (stage 3), and 8.4 for systemd to start services (stage 4). The firmware and loader figures only appear on UEFI systems whose bootloader reports them.
The kernel's own log, from dmesg, fills in stage 3 (trimmed, timestamps illustrative):
[ 0.000000] Linux version 6.8.0-45-generic ...[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-6.8.0-45-generic root=UUID=... ro quiet[ 1.612004] Run /init as init process[ 4.497331] systemd[1]: Inserted module 'autofs4'The first line is the kernel announcing itself at time zero. The second is the command line GRUB passed across: which kernel file it loaded and where the real root file system lives. Run /init as init process is the kernel starting the program inside the initramfs. Once that has found and mounted the real root, it hands over to systemd, and every later line tagged systemd[1] comes from PID 1 in user space.