What Happens When You Power On a Computer? A Deep Dive into the Boot Process
This article explains the complete computer boot sequence—from BIOS initialization and MBR loading to the GRUB boot loader, kernel startup, initramfs handling, run‑level scripts, and finally the login prompt—providing a clear, step‑by‑step overview of each stage.
Boot Process Overview
The Basic Input Output System (BIOS) is firmware stored on a ROM chip on the motherboard that performs hardware initialization, self‑tests, and locates the first bootable device.
The Master Boot Record (MBR) is the first 512‑byte sector of a disk containing the pre‑boot information and partition table; the BIOS copies it into memory and hands control to the boot loader (e.g., GRUB or LILO).
The boot loader runs before the operating system kernel, setting up hardware mappings and preparing the environment. GRUB presents a menu for selecting a kernel or operating system, loads the chosen kernel into RAM, and decompresses it.
Detailed Steps
Step 1 – Load BIOS: Power on the computer; BIOS reads hardware information, performs self‑tests, and selects the first device with a boot program.
Step 2 – Read MBR: The BIOS locates the disk’s MBR, copies it to memory, and transfers control to the boot loader.
Step 3 – Start Boot Loader: The boot loader (e.g., GRUB) initializes hardware, creates memory mappings, and prepares to load the kernel.
Step 4 – Load Kernel: GRUB hands control to the Linux kernel, which probes hardware and attempts to mount the root filesystem.
The kernel relies on an initial RAM disk (initramfs) to provide essential drivers (e.g., USB, RAID, LVM) before the real root filesystem is available.
Step 5 – Run /sbin/init: After the kernel finishes loading, the first user‑space program /sbin/init reads /etc/inittab to set the system run level.
Step 6 – Init executes rc.sysinit: This script performs system initialization tasks such as setting hostname, mounting filesystems, configuring the clock, loading kernel parameters, activating LVM, RAID, swap, and loading additional drivers.
Step 7 – Load Kernel Modules: Modules listed in /etc/sysconfig/modules are loaded.
Step 8 – Execute run‑level scripts: Depending on the run level, scripts in rc0.d to rc6.d are executed to start services.
Step 9 – Run /etc/rc.d/rc.local: This file allows users to add custom startup commands after all standard initialization.
Step 10 – Start login program: The system launches /bin/login (or a graphical X server) and presents the login prompt.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
