HeadlinesBriefing favicon HeadlinesBriefing.com

Inside the Linux kernel boot process: from GRUB to init

Hacker News •
×

Pressing power starts a hidden sequence that transforms raw hardware into a usable system. The author launches a series on Linux kernel internals, beginning with the boot process on x86_64. Though not a kernel guru, they aim to map the main stages—from bootloader handoff to early memory layout—so readers can follow each piece as it unfolds.

When GRUB hands control over, the kernel receives only a CPU in a low‑level mode, a rough memory map, and a compressed bzImage. An assembly‑level decompressor unpacks the image, optionally randomizing its base address with KASLR to foil attackers. After establishing a minimal stack, GDT and IDT, the kernel verifies essential CPU features before proceeding.

If the hardware supports Secure Memory Encryption, the kernel enables it immediately, protecting RAM from physical inspection. It then reconciles the loaded address with the compiled virtual base via a page‑table fixup, effectively aligning the system’s view of memory. With these foundations in place, higher‑level subsystems can start, eventually handing control to init and presenting the login screen.

The walkthrough demystifies why early boot feels opaque: each tiny routine prepares the processor for the complex multitasking environment Linux is known for. Understanding this sequence helps developers troubleshoot boot failures, evaluate security features like KASLR, and appreciate the engineering discipline that turns a silent power‑on into a responsive workstation.