Fundamentals 16 min read

Unraveling Linux Boot: From BIOS Power‑On to Init Process Explained

This article provides a step‑by‑step technical walkthrough of the Linux boot sequence, covering BIOS POST, MBR and GRUB stages, kernel loading, initrd/initramfs handling, and the init system scripts that bring the operating system to a usable state.

ITPUB
ITPUB
ITPUB
Unraveling Linux Boot: From BIOS Power‑On to Init Process Explained

BIOS Self‑Test and Runtime Services

The boot process begins when the user powers on the machine; the BIOS (Basic Input/Output System) stored in Flash EPROM performs a Power‑On Self‑Test (POST) to verify critical hardware such as CPU, memory, and I/O devices. After POST, the BIOS provides runtime services and hands control to the boot device selected in its configuration.

Master Boot Record (MBR) and GRUB Stages

The BIOS reads the first 512‑byte sector of the boot disk, the Master Boot Record, which contains the bootloader code, the partition table, and the boot signature (55AA). Common bootloaders like GRUB install their first stage (stage1) in these 446 bytes. Stage1 loads the next sector (stage1.5 or stage2) into memory and transfers execution.

GRUB’s boot process is split into two main stages:

Stage1 – resides in the MBR, loads the next sector (often called stage1.5) into memory at address 0x7c00 and jumps to it.

Stage2 (and optional stage1.5) – contains the full GRUB code, reads its configuration file /boot/grub/grub.conf, and loads the selected kernel image and an optional initrd image into memory.

Kernel Loading and Initrd/Initramfs

When stage2 executes, GRUB parses the configuration, loads the Linux kernel image, and optionally an initrd (initial RAM disk) image. The initrd (or initramfs in newer kernels) provides a temporary root filesystem containing essential drivers and scripts needed before the real root filesystem can be mounted.

Initrd is an ISO‑9660 image that can be mounted directly with a command such as mount -o loop initrd.img /mnt/test. Initramfs, introduced in kernel 2.5, embeds a cpio archive inside the kernel image, which is unpacked early in the boot process to supply a minimal filesystem.

System Initialization (init)

After the kernel has unpacked the initrd/initramfs and executed its /init script, control passes to the real /sbin/init process, the parent of all user‑space processes. /sbin/init reads /etc/inittab (or the equivalent systemd configuration on modern distributions) and runs the following key steps:

Execute /etc/rc.d/rc.sysinit to perform basic system setup, mount the root filesystem read‑write, configure networking, load kernel modules, set SELinux mode, and initialize hardware such as USB, RAID, and LVM.

Run the appropriate run‑level scripts located in /etc/rc.d/rc*.d, where files prefixed with S start services and those with K stop services during shutdown.

Execute user‑defined commands in /etc/rc.d/rc.local for custom startup actions.

Start the login terminals (tty1‑tty6) or the X‑Window system, completing the boot sequence.

Reference Diagrams and Sources

BIOS POST diagram
BIOS POST diagram
MBR layout
MBR layout
GRUB stage diagram
GRUB stage diagram
Initrd mounting
Initrd mounting
Complete boot flowchart
Complete boot flowchart

References

http://www.cnblogs.com/scnutiger/archive/2009/09/30/1576795.html

http://www.it.com.cn/f/edu/0411/24/51090.htm

http://bbs.chinaunix.net/thread-2046548-1-1.html

http://space.itpub.net/8111049/viewspace-680043

http://dongdiy.blog.51cto.com/1908223/366909

http://icarusli.iteye.com/blog/625755

http://www.54sa.net/?p=549

http://roclinux.cn/?p=1301

BIOSBoot ProcessgrubSystem InitializationInitramfs
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

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.