</>EmbeddedInterview

Walk through the complete boot process of an embedded Linux system, from power-on to the login prompt.

MediumEmbedded Linux & Boot

Short answer: Boot ROM → first-stage loader (SPL/FSBL) in on-chip SRAM, which initialises DRAM → full bootloader (U-Boot) in DRAM → kernel + device tree (+ initramfs) loaded and started → kernel initialises the CPU, memory, interrupts, scheduler and drivers → mounts the root filesystem → starts /sbin/init as PID 1 → init starts services and a getty/login or the product application.

Stage by stage (typical ARM SoC)

Stage Runs from Main job
1. Boot ROM on-chip ROM (mask ROM) read boot pins/fuses, pick boot device (eMMC, SD, SPI NOR, USB, UART), load first stage into SRAM, optionally verify its signature
2. SPL / FSBL on-chip SRAM (tens–hundreds of KB) clocks, PMIC, DRAM controller init and training, load the next stage into DRAM
3. (ARM64) TF-A BL31 secure DRAM/SRAM EL3 secure monitor, PSCI (CPU on/off, suspend), sometimes OP-TEE (BL32)
4. U-Boot proper DRAM console, storage, network, environment, bootcmd; loads kernel, DTB, initramfs
5. Kernel DRAM decompress (zImage) or run directly (Image), head.S → start_kernel() → drivers → mount root
6. init (PID 1) user space systemd / BusyBox init / SysVinit starts services, mounts other filesystems, starts getty or the app

Why so many stages? At power-on DRAM does not work yet: its controller must be configured and trained, which needs code. The boot ROM is tiny and fixed, and on-chip SRAM is small, so a small stage that fits in SRAM brings up DRAM and then loads the large bootloader.

What gets passed along

  • Boot ROM → SPL: nothing much; the SPL image header tells the ROM where to load it.
  • U-Boot → kernel: the kernel command line (bootargs), the device tree blob address and, optionally, the initramfs address. On ARM64 the DTB address is in register x0.
  • Kernel → init: the command line options it did not consume, and the environment.

What to say if asked "where would you look if it hangs?"

  • No output at all: boot ROM did not find a valid image (check boot pins, image header, signature).
  • SPL prints then stops: DRAM init or the next-stage load.
  • U-Boot works but "Starting kernel ..." is the last line: wrong load address, wrong DTB, wrong console=, or the kernel crashed before the console driver started. Enable earlycon on the command line.
  • Kernel panics with "VFS: Unable to mount root fs": wrong root=, missing storage driver or filesystem driver.
  • "No working init found": /sbin/init missing, wrong architecture binary, or missing shared libraries.