Fundamentals 25 min read

Unraveling Linux Boot: From BIOS Power‑On to Kernel Init

This article explains the complete Linux startup sequence, covering BIOS power‑on self‑test, interrupt vector initialization, MBR and partition table layout, multi‑stage bootloaders such as GRUB, kernel decompression, transition to protected mode, and the init system with runlevels.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Unraveling Linux Boot: From BIOS Power‑On to Kernel Init

Linux System Startup Overview

The Linux boot process can be divided into several stages: BIOS initialization, loading the bootloader from the Master Boot Record (MBR), loading a secondary bootloader (e.g., GRUB), loading and decompressing the kernel, switching to protected mode, and finally starting the init system.

BIOS Phase – Real‑Mode Initialization

When power is applied, the CPU starts at address 0xFFFF0 in the BIOS ROM. BIOS performs a Power‑On Self‑Test (POST) to verify hardware, then builds an interrupt‑vector table (256 entries, each 4 bytes) and associated service routines in the first kilobyte of RAM.

POST checks CPU, memory, video, and other devices.

BIOS enumerates and initializes local hardware.

It creates the interrupt‑vector table and BIOS data area.

Boot Device Search and MBR Loading

BIOS runtime services search bootable devices according to the boot sequence set in CMOS. The first 512‑byte sector of a bootable device is the Master Boot Record (MBR), which contains:

Bytes 0‑445: primary bootloader code.

Bytes 446‑509: partition table (four 16‑byte entries).

Bytes 510‑511: signature 0x55AA.

The primary bootloader loads the secondary bootloader (often located in the active partition) into RAM and transfers control to it.

Multi‑Stage Bootloaders (GRUB Example)

Modern Linux systems use a three‑stage bootloader:

Stage 1 (in the MBR) loads Stage 1.5 , which understands file‑system formats such as ext2/3.

Stage 1.5 loads Stage 2 (GRUB), which presents a menu of kernel options.

GRUB reads /boot/grub.conf (or menu.lst) to select and load the chosen kernel image.

Loading the Linux Kernel

The kernel image is typically a compressed zImage (≤ 512 KB) or bzImage (> 512 KB). The bootloader copies the image into memory, then the decompression routine (e.g., decompress_kernel in arch/i386/boot/compressed/misc.c) expands it to a high‑address location.

After decompression, the kernel starts execution at start_kernel(), which performs:

Hardware detection and driver initialization.

Setup of virtual devices, LVM, RAID, etc.

Mounting the root filesystem.

Spawning the first user‑space process /sbin/init.

Init Process and Runlevels

/sbin/init

reads /etc/inittab to determine the default runlevel (0‑6). Typical runlevels are:

0 – halt

1 – single‑user

2 – multi‑user without networking

3 – multi‑user with networking

5 – multi‑user with X‑Window

6 – reboot

Based on the runlevel, init executes scripts such as /etc/rc.d/rc.sysinit (sets PATH, network, swap, mounts /proc, etc.), runs the appropriate rc?.d directories, and finally runs /etc/rc.d/rc.local for user‑defined commands:

# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff here if you don’t
# want to do the full Sys V style init stuff.

After all init scripts finish, the system starts /bin/login, allowing the user to log in.

Key Takeaways

BIOS performs hardware checks and sets up a real‑mode interrupt vector table.

The MBR holds a tiny primary bootloader and a partition table.

GRUB (or similar) provides a flexible, multi‑stage bootloader capable of loading kernels from modern filesystems.

The kernel is decompressed, switches the CPU to protected mode, and initializes core subsystems.

Init orchestrates user‑space startup according to runlevels and custom scripts.

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.

KernelLinuxBIOSBoot ProcessMBRinitGRUB
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.