Walkthrough of x86_64 Linux boot sequence from bootloader handoff through early C init, covering decompression, KASLR, page table fixup, and IDT setup.
Key Takeaways
Boot starts with a tiny decompressor in arch/x86/boot/compressed/ that unpacks the bzImage and applies KASLR base randomization before jumping to the real kernel.
startup_64 builds identity-mapped page tables, installs a minimal GDT/IDT, then calls __pi___startup_64 to patch page table entries for the KASLR offset mismatch.
SME/SEV/TME memory encryption must be enabled before any RAM is written in the clear; sme_early_init() finalizes this wiring before KASAN setup.
KASAN is bootstrapped by pointing its entire shadow region at a single zero page until a real allocator exists, avoiding crashes while tracking nothing yet.
idt_setup_early_handler() installs a minimal IDT early to prevent silent triple-fault reboots if a page fault or GPF occurs before a console is available.