What is the ARM64 boot flow?
Short answer: Platform firmware initializes hardware and loads the next stage. A typical Linux flow is Boot ROM, platform firmware/bootloader, kernel entry, MMU setup and userspace init. Exact stages vary by SoC.
// Linux arm64 boot protocol: X0 = DTB physical address
// X1–X3 = 0 at kernel entry
1. Boot ROM: Executes platform-defined immutable startup code and locates the next boot stage.
2. Firmware / bootloader: Initializes required clocks, DDR and devices, configures security state, and loads the kernel and DTB. Some platforms use TF-A, U-Boot SPL or U-Boot proper.
3. Kernel entry: Bootloader passes the DTB physical address in X0 according to the ARM64 Linux boot protocol. Linux performs early architecture setup, builds translation tables, enables the MMU and initializes drivers.
4. Userspace: The kernel mounts or prepares the root filesystem and executes the initial userspace program, typically systemd, /sbin/init or Android /init.
Interview takeaway: Boot flow progresses from platform firmware to kernel initialization to PID 1. Exact stages, exception levels and DDR initialization vary by SoC.
Detailed boot flow with typical firmware stages
Reset -> Boot ROM
-> early platform firmware / SPL
-> DRAM and security initialization
-> trusted firmware / bootloader, as configured
-> Linux Image + DTB + optional initramfs
-> early ARM64 kernel entry
-> start_kernel()
-> rest_init() / kernel_init()
-> execute PID 1 userspace program
Boot ROM locates and verifies the next image according to platform policy, often using on-chip RAM before external DDR is available. Early firmware prepares clocks, power and DRAM. A platform may use TF-A BL31 at EL3 and a non-secure bootloader at a supported exception level. The exact chain differs by SoC; for example, i.MX8QM/QXP configurations may use system-controller firmware and platform-specific boot containers rather than the same SPL sequence as an i.MX8M board.
For direct ARM64 Linux DT boot, load the kernel image and DTB in suitable memory, supply the DTB physical address in X0, set X1–X3 to zero, establish required exception-level/interrupt/cache state, and enter with the MMU off as specified by the arm64 boot protocol. Linux then establishes its early mappings and initializes its own MMU configuration.
Early kernel assembly and architecture setup lead into start_kernel, which initializes core subsystems; initcalls initialize built-in drivers and related services. The kernel's init path prepares the root filesystem and executes an initial userspace init program. Function names and ordering details vary by kernel release.
For debugging, isolate the last successful stage using serial logs, bootloader image/address checks, earlycon, device-tree validation, initcall diagnostics and root-filesystem checks.