ROM to systemd: The Boot Chain

A board prints a few lines, then goes quiet. The last line names which of six stages stopped, and what to measure next. Break the chain and read where the log ends.

Learn what runs from power on to the login prompt on an embedded Linux board, why each stage verifies the next, and how to read a dead boot from its last line.

Pick a break, then turn earlycon on and off. Watch the log stop in a different place each time. Then we build the chain stage by stage: ROM, SPL, DDR, TF-A, U-Boot, kernel, systemd.

You need a rough idea of what a program and a serial port are. We build the rest from zero. This page uses models, not real silicon: every log line here is illustrative.

Part of the Physical AI Systems series, Linux track. Built from primary sources: the Trusted Firmware-A docs, the U-Boot docs, the Linux kernel docs and the systemd manuals. Sources are listed in the Field Guide.

Break the boot chain

A model, not real hardware. The six stages and the kinds of message are real; the exact text, version numbers and timestamps are illustrative. Real strings such as “Starting kernel ...” and the invalid device tree message come from U-Boot and the Linux arm64 source.

Chapter 0

Where the Log Stops

Read the last line of a dead boot and name the stage that failed, before you touch any code

A new robot board sits on your bench. You apply power. The power light comes on. The screen stays black, and nothing moves. What failed?

You cannot guess from a black screen. Dozens of things could be wrong. But there is a second output that does not need a screen: the serial console. It is a plain wire pair, called a UART (a universal asynchronous receiver and transmitter), that sends text one character at a time. Each stage of the boot writes its messages there. You read them on your laptop with a USB serial cable.

A common default for this link is 115200 baud, 8 data bits, no parity, 1 stop bit, written 115200 8N1. Both ends must agree. If they do not, you see garbage or nothing, which is a real source of false alarms.

Six stages, six voices

Booting is a relay race. Boot means getting from a powered-off chip to a running operating system. No single program does that. A chain of six does, and each one starts the next.

  1. BootROM: a tiny program burned into the chip at the factory. It cannot change. It reads a few fuses (one-time switches inside the chip) to learn where to find the next stage.
  2. SPL (secondary program loader): a small first-stage loader. It must be tiny, because it runs from on-chip memory. Its main job is to wake up the big main memory.
  3. TF-A (Trusted Firmware-A): the secure-world firmware on Arm 64-bit chips. Part of it stays alive for as long as the machine runs.
  4. U-Boot: the full bootloader. It finds the kernel on storage or the network and starts it.
  5. The kernel: Linux itself. It sets up the drivers and mounts the root filesystem.
  6. init: the first user program, usually systemd. It starts every service you actually care about.

Each stage lives in a different memory. The ROM runs from read-only memory on the chip. The SPL runs from SRAM, a small fast memory that works the moment power arrives. Everything after it runs from DRAM, the large main memory. DRAM is useless until someone trains it, which Chapter 2 explains.

Each stage also checks the next one before it hands over control. Think of a relay race where each runner looks at the next runner’s badge first. The check is usually a hash or a signature. This is called a chain of trust, and Chapter 3 shows how it works in TF-A.

Last, each stage prints in its own voice. Most ROMs print nothing. SPL prints a short banner. TF-A prints lines that start with NOTICE:. U-Boot prints its banner and a countdown. The kernel prints lines that start with a timestamp in square brackets. Systemd prints lines that start with systemd[1]:.

The last line is the diagnosis

Now the key idea. When a board hangs, the stage that spoke last is not always the stage that failed. The failure is in the first stage that should have spoken next and did not. Either the last speaker failed to hand over, or the next stage crashed before it could print.

That turns debugging into a lookup. Find the voice of the last line. Then ask what that stage was about to do. Try it in the device below. Pick a stage to see what it runs from, what it verifies, and what its voice sounds like.

Meet the six voices

Each row is one stage. Choose a stage to light its row and see the line it prints. The bar on the right shows which memory it runs from.

Illustrative console lines. The memory column is the usual arrangement on a 64-bit Arm board; some chips differ. TF-A’s own docs say BL1 runs from trusted ROM and BL31 runs from trusted SRAM in the reference design.

The names inside TF-A

TF-A numbers its own pieces. BL1 is the first piece, in ROM. BL2 loads the others. BL31 is the runtime piece that stays resident. BL32 is an optional secure operating system such as OP-TEE. BL33 is the normal-world bootloader, usually U-Boot or UEFI. The letters “BL” mean boot loader. Chapter 3 gives each one its exception level.

Worked example. A log ends with Trying to boot from MMC1. That line is SPL’s voice. SPL was about to load the next image. So the suspects are the load itself (wrong storage offset, bad image) and the stage that follows, TF-A. You do not yet suspect the kernel. It never ran.

The failure you will meet first

The most common dead boot ends with Starting kernel .... That line is U-Boot’s last word. It means U-Boot found a kernel and jumped to it. After that, silence. The cause is in one of three places: the kernel got the wrong device tree, the load addresses overlap, or the kernel has no console driver yet. The fix is the same first step every time: turn on earlycon, a boot option that makes the kernel print through a bare-bones driver from its very first instructions. The hero at the top of this page lets you try exactly that.

The road

  1. BootROM and SPL: fuses pick the boot medium, SPL lives in SRAM.
  2. DDR training: waking the main memory, and the margin you cannot see.
  3. TF-A: BL31, OP-TEE and the exception-level handoff.
  4. U-Boot: environment, FIT images, standard boot.
  5. Kernel handoff: DTB, command line, earlycon.
  6. Power sequencing: why a cold boot fails when a warm one works.
  7. systemd: boot time and the watchdog.
  8. Field debugging: pstore, ramoops and reboot reason.
  9. Field Guide: numbers, checklist, code.

For the background, Embedded Linux introduces the pieces, From Vector Table to main shows the small-chip version of a boot, and Pipeline and Privilege explains exception levels.

A board’s log ends with TF-A’s NOTICE: lines and nothing from U-Boot. Which stage do you check first?

Chapter 1

BootROM and SPL: Life in SRAM

See why the first code that runs must be tiny, and what it has to do before anything bigger can load

Imagine you wake in an empty room with a one-page note and a small desk. The note says: go and fetch the big toolbox from the warehouse. But the warehouse door is locked, and the key is on the desk. You must first unlock the door. Only then can you bring in the toolbox.

That is the first second of a boot. The chip has a small desk, the SRAM (static RAM: fast, small, and ready the instant power arrives). It has a locked warehouse: the DRAM (dynamic RAM: gigabytes of cheap memory that needs setting up before it works). And it has a note it cannot edit: the BootROM.

What the BootROM does

The BootROM is code burned into the chip when it was made. It is the same on every chip of that model, and nobody can patch it. That is why it is trusted. It runs first, and it does only three jobs.

  1. Read the boot mode. Boot pins and fuses (one-time programmable bits) tell it where to look: an SD card, an eMMC chip, a flash chip, USB, or the network.
  2. Load the first stage. It copies a small image from that place into SRAM.
  3. Check it, then jump. If the fuses ask for secure boot, the ROM verifies a signature on the image. A bad signature means no jump.

On NXP i.MX 8M chips, the ROM loads the SPL into on-chip RAM along with the DDR training firmware, and a feature called HAB (High Assurance Boot) checks the SPL signature. NXP’s secure boot guides then show HAB extending that trust to the next image, a FIT that holds U-Boot. On NVIDIA Jetson Orin the order is different in its names: the NVIDIA Developer Guide lists BootROM, then MB1, then MB2, then UEFI. Thor lists more early steps. The idea is the same: a fixed ROM starts a chain of larger and larger loaders.

The SPL and why it is small

The ROM can only load what fits in SRAM. SRAM is small because it is expensive in chip area. So the first stage that is real software has to be tiny. In U-Boot this stage is the SPL, the secondary program loader. The U-Boot docs describe it plainly: it sets up the SDRAM and loads U-Boot proper.

Look at what that means. The full U-Boot is too big for SRAM. It needs DRAM. DRAM needs to be configured: the right timings, the right voltage reference, the right delays on each data line. Only the SPL can do that, because nothing else is running yet. So the SPL has one mandatory job: initialise DDR. After that it loads the next stages into DRAM and jumps.

Here is a worked example with made-up round numbers. A chip has 256 KB of SRAM. The SPL image is 120 KB. That leaves 136 KB for the SPL’s stack and working data. Fine. Now your team adds a feature, and the SPL grows to 270 KB. It no longer fits. The ROM cannot load it. The board is dead at the first stage, with no message at all. Try the numbers below.

Fit the SPL in SRAM

Drag the SPL size. Then choose whether the SPL starts the DRAM. See what the next stage can do.

120 KB

Illustrative sizes: 256 KB of SRAM, 96 KB reserved for the SPL’s stack and data, and a 900 KB U-Boot proper. Real SRAM sizes differ by chip; read your reference manual for the number.

The silent failure

Here is the symptom. You power the board. The serial console shows nothing, not one character. Nothing printed means nothing ran far enough to print, or the printing wire is wrong. Most ROMs print nothing by design, so silence alone does not name the stage.

The measurement is simple. Put a scope or a logic analyzer on the board’s UART TX pin (the pin the board transmits on). Power on. If the line stays high and flat, no stage has sent a byte. If you see a burst of activity, something spoke, and the problem is on the cable side: the wrong baud rate, the wrong pin, or a pin that was never switched to its UART function. That switch is called pinmux (pin multiplexing), and it is set by the SPL or by a later stage.

Do this before you touch any software. It costs two minutes. It separates a boot that never started from a boot that is talking to the wrong place.

On real hardware. Take any Arm Linux dev board with a debug UART header, for example a Raspberry Pi or an i.MX 8M evaluation board, and a 3.3 V USB serial cable. Connect a logic analyzer to TX. Power on and measure the time from supply-on to the first byte. Repeat with a different SD card image, and note how the first byte moves.
Why must the SPL initialise DRAM before the full U-Boot can run?

Chapter 2

DDR Training and the Margin You Cannot See

Learn how the SPL teaches the memory controller when to listen, and why a memory that boots is not yet a memory that is stable

Two people shout numbers to each other across a noisy hall. Each number must be heard clearly. If the listener opens his ears too early, he hears the echo of the last number. If too late, he misses the start. He also needs a loudness setting: too sensitive and he hears noise as speech, too deaf and he misses quiet digits.

The memory controller and the DRAM chip are those two people. The shouts are voltage pulses on wires. At DDR5-4800 each wire carries 4,800 million transfers each second. One transfer lasts 1 / 4.8 GT/s, which is about 208 picoseconds (ps, one trillionth of a second). To catch a bit, the receiver must look at the wire in a window much narrower than that.

What DDR means, with real numbers

DDR is double data rate: the memory sends data on both the rising and the falling edge of its clock. DDR5-4800 has a 2,400 MHz clock, so one clock cycle lasts 1 / 2.4 GHz = 0.4167 ns.

Memory chips list their delays in clock cycles. The common JEDEC speed grade for DDR5-4800 modules is written 40-39-39. Kingston’s datasheets say their modules are programmed with that timing at 1.1 V. The first number is CL, the column access latency: how many cycles pass between a read command and the first data. Here is the arithmetic.

CL = 40 cycles × 0.4167 ns = 16.67 ns

Another delay, tRC, is the minimum time between two row activations in the same bank. At 117 cycles it works out to 117 × 0.4167 = 48.75 ns. Datasheets round differently: an Innodisk DDR5-4800 module lists tRC as 48 ns. The two differ by under one nanosecond, about two clock cycles. Treat 48 to 49 ns as the real figure, and read your own chip’s datasheet for the exact row.

These numbers are what the SPL’s DDR configuration encodes. They are the rules of the chip. Training is something else: it finds the wire delays of this one board.

The training steps

Every board is different. A trace on the circuit board that is 2 mm longer adds about 13 ps of delay (a rough rule of 6.7 ps per millimetre in typical board material, an illustrative value). So the SPL measures instead of assuming. It runs DDR training, a sequence of tests it repeats while it moves one setting at a time.

  1. Write leveling. The DRAM compares the clock and a strobe signal called DQS. The controller shifts DQS until the two line up at the chip.
  2. Read gate training. The controller finds when to open its listening window, so that it catches the start of the DQS burst and not the quiet before it.
  3. Delay and Vref sweep. The controller writes a pattern, reads it back, and records pass or fail. It does this at many delay values and many Vref values. Vref is the reference voltage that decides whether a wire level counts as a 1 or a 0.

The pass and fail results form a shape called the eye: a blob of passing settings. The best setting is the centre of the eye, where you are farthest from failing on every side. Training ends by writing that centre into the controller.

Hunt for the eye

The green blob is the eye. Drag the delay and Vref to move your dot. Press Train to jump to the centre. Then change the temperature and watch the eye move.

100 ps
50.0%
25 °C

A toy channel, not a measurement. The eye is an ellipse centred near 100 ps and 50% at 25 °C; its size shrinks and its centre drifts as the temperature moves away from 25 °C. The 208 ps width of one transfer is real for DDR5-4800 (1 / 4.8 GT/s). The shrink rate is invented to show the shape of the problem.

Boots is not stable

Here is the trap. Training runs once, at boot, at whatever temperature the board has at that moment. Say you power the board in a cool lab at 25 °C. Training puts your dot in the middle of a wide eye. Everything works. Later the board sits in a hot enclosure at 85 °C. The eye is smaller and has moved. Your old setting is now near the edge. Most reads pass. A few flip a bit.

The symptom is the nastiest one in this chapter: the board boots every time, and then it segfaults at random. The crash happens in different programs. It is worse when hot, or when cold. A flipped bit in memory looks like a software bug, so people lose weeks reading code.

The measurement is a stress test across temperature. Run memtester or stressapptest (both are real Linux memory-stress tools) for hours while the board sits in a thermal chamber, or with a heat gun and cold spray. Use your chip vendor’s margin scan tool too, which sweeps delay and Vref and plots the real eye. The fix is in the board or the configuration: a better trace length match, a termination setting, a lower speed grade.

On real hardware. Pick a Linux dev board with DDR. Run memtester 512M 1 at room temperature, then again with the board warmed by a hair dryer to a measured surface temperature. Record how many loops pass at each temperature, and the first error you see.
A board trains its DDR at 25 °C, then runs fine for an hour and starts to crash randomly at 85 °C. What is the most likely cause?

Chapter 3

TF-A and the Exception-Level Handoff

Follow control down a ladder of privilege, and see which piece of firmware stays behind after Linux starts

A bank has a vault, a manager’s office, and a public counter. Clerks at the counter can ask the manager for things. The manager can ask the vault guard. But a clerk can never walk into the vault. The building is built so that a mistake at the counter cannot reach the money.

A 64-bit Arm chip is built the same way. It has four levels of privilege, called exception levels, from EL0 (ordinary programs) up to EL3 (the most powerful). It also has two worlds: a normal world, where Linux lives, and a secure world, for keys and trusted code. Pipeline and Privilege explains these in detail. This chapter uses only four facts:

  1. EL3 is the top. Code here can see everything. It is the secure monitor.
  2. S-EL1 is the kernel level of the secure world. A small trusted operating system runs here.
  3. EL2 and EL1 in the normal world run the hypervisor and the Linux kernel.
  4. The only doors between worlds are special calls to EL3, named SMC (secure monitor call).

Who is who in TF-A

Trusted Firmware-A (TF-A) is the open reference code for EL3 and the secure boot flow. Its documentation names each piece. Read the table as a timeline, top to bottom.

PieceRuns atJob
BL1EL3, from trusted ROMLoads BL2 and checks its hash.
BL2Secure-EL1 (the TF-A default on AArch64)Loads and verifies BL31, BL32 and BL33.
BL31EL3, residentStarts the runtime services, such as PSCI. Stays after boot.
BL32S-EL1, optionalA trusted OS such as OP-TEE.
BL33EL2 if present, else EL1The normal-world bootloader: U-Boot or UEFI.

The table comes from the TF-A firmware design and trusted-board-boot pages. Notice the verification. BL1 checks BL2. BL2 checks all the rest. Each check uses certificates and hashes, so the chain of trust from Chapter 0 is real code you can read.

Now the idea that surprises people. After BL33 starts, the other pieces do not disappear. BL31 stays resident at EL3. It keeps a small footprint in secure memory and waits for SMC calls. The most important service is PSCI, the Power State Coordination Interface. When Linux wants to turn on its second CPU core, it does not poke the hardware. It sends an SMC call, CPU_ON, to BL31. BL31 powers the core and returns. The same goes for suspend and for system reset.

That is why the Linux device tree has a psci node. Linux is a polite client of firmware it cannot see into. If BL31 is missing or broken, Linux boots on one core, or hangs when it tries to start the others.

Step through the whole handoff below. Watch BL31 stay on the top rung while control moves down.

Step down the ladder

Press Next step to move control from BL1 to Linux. Turn on the TZPC mistake to see what happens when Linux touches a peripheral the secure world owns.

A diagram of the TF-A reference flow with OP-TEE as BL32. Boards differ: some skip BL32, some run BL2 at EL3, and some SoCs use their own ROM instead of BL1. The peripheral fault is a model of the idea.

The peripheral that bites back

Every peripheral on the chip, such as a UART or an SPI controller, can be marked Secure or Non-secure. On many chips a block called a TZPC (TrustZone protection controller) holds those marks. If a peripheral is marked Secure, Linux in the normal world may not touch it.

Here is the symptom. The kernel boots. Its driver for a peripheral loads. At the first register read, the kernel crashes with an SError (a system error: the bus told the CPU the access was refused). The crash points at the driver, so you open the driver. The driver is fine.

The fix is in TF-A, not in the driver. The platform code in TF-A sets the TZPC marks during boot. Change the mark to Non-secure there, rebuild BL2 and BL31, and the driver works untouched. The measurement is the fault address: look it up in the chip’s memory map. If it falls inside a peripheral, suspect the secure mark first.

Here is a worked example of one service call. Linux wants to start core 1. It cannot write to the power controller, because the secure world owns it. So it loads a function number and three arguments into registers: the target core, the address where that core should begin, and one value to pass along. Then it runs the SMC instruction. The CPU jumps to EL3. BL31 reads the function number, powers the core, sets its start address, and returns a result code in a register. Zero means success. The whole round trip is two privilege changes and only a short stretch of code (the exact count depends on the chip). Linux then carries on as if it had done the work itself.

The secure boot checks use certificates. TF-A’s trusted-board-boot page says BL1 loads and verifies the BL2 content certificate and then checks the BL2 hash. BL2 then verifies the trusted key certificate, the key and content certificates for the BL3x images, and those for BL33, and checks each image hash. If one hash fails, boot stops there, usually with an ERROR: line from BL1 or BL2. So a TF-A log that ends with a certificate error tells you the image on flash is not the one the keys expect.

On real hardware. On any Arm 64-bit dev board with a TF-A build, read the boot log for the BL31 version line, then run dmesg | grep -i psci in Linux. Note the PSCI version printed, and compare it with the TF-A release notes.
After Linux is running, where does the PSCI code that starts a second CPU core live?

Chapter 4

U-Boot: Environment, FIT Images, Standard Boot

Learn how U-Boot finds, checks and starts a kernel, and how to read its settings when a boot goes wrong

U-Boot is the first stage you can talk to. Press a key during the countdown and you get a prompt, =>. You can list files, load them into memory, print memory, and start anything. It is the workshop in the middle of the boot chain: a place to inspect and change things before Linux takes over.

The environment: a bag of named strings

U-Boot keeps its settings in the environment: a list of names and text values, stored in flash or a file. Three matter most. bootcmd holds the commands to run after the countdown. bootargs holds the kernel command line (Chapter 5). bootdelay sets the countdown in seconds.

Environment values can themselves be small scripts, and they can refer to each other. A typical bootcmd says: load the kernel into the address in kernel_addr_r, load the device tree into fdt_addr_r, then call booti (for an arm64 Image) with both addresses. Break one name, one address, or one file name, and the boot ends at the prompt with an error such as ERROR: can't get kernel image!. That is the U-Boot row of the hero.

Standard boot: let U-Boot look around

Old setups hard-coded bootcmd. Newer U-Boot has standard boot, called bootstd. It splits the job into three ideas. A bootdev is a place that may hold an operating system: an SD card, an eMMC chip, a network port. A bootmeth is a way of reading one, such as the extlinux method, which looks for a file named extlinux/extlinux.conf. A bootflow is one bootable thing that was found. The command bootflow scan -lb scans, lists and boots. The variable boot_targets sets which devices are searched and in what order.

The FIT image: one file, many parts, with hashes

Loading a kernel, a device tree and a ramdisk as three loose files is fragile. Any one can be the wrong version. A FIT (flattened image tree) packs them into one file, built with the same format as a device tree. Its specification lives at the FIT spec site. Its shape is simple:

  1. An images node holds each part: the kernel, the device tree (type flat_dt), a ramdisk. Each has data, type, arch, os, compression, and for a kernel a load and entry address.
  2. Each image has a hash-1 node with an algo such as sha256 and the digest in value.
  3. A configurations node lists named boot setups. Each names a kernel and an fdt and may carry a signature-1 such as sha256,rsa2048. A default property picks one.

When U-Boot boots a configuration, it hashes each part and compares the result with the stored digest. A hash is a short fingerprint of a file. Change one byte of the file and the fingerprint changes completely. So a corrupted or tampered kernel is caught before it runs. If the configuration is signed, U-Boot also checks the signature with a public key it carries. That is the next link in the chain of trust.

Try it. The kernel below is a 64-byte stand-in. The page hashes it with real SHA-256. Flip one byte and watch the hash check fail.

Inspect a FIT image

Choose a configuration. Flip a byte in the kernel. Turn the overlay on or off. Then press Run bootm.


    

    

The hash is a real SHA-256 computed in your browser over a 64-byte stand-in for the kernel. The node names follow the FIT specification. The U-Boot output lines are illustrative paraphrases, not copied from one build.

Overlays and bootcount

A device tree overlay is a small patch for the device tree: it adds a node for a daughter board, for example. It must be applied before the kernel starts, with a command such as fdt apply, or listed in the FIT configuration. The failure looks like this. You add a camera node in an overlay. The camera driver never loads. In Linux you look at /proc/device-tree and the node is simply absent. The overlay was never applied. Check it at the U-Boot prompt first.

One more tool matters for field units. Bootcount counts failed boots. After a reset, U-Boot raises the counter. If it passes bootlimit, U-Boot skips bootcmd and runs altbootcmd, a fallback such as the previous kernel. After a good boot, a user program in Linux must write the counter back to zero. Without that reset, a healthy unit will eventually fall back by itself.

A moving target

U-Boot ships on a fixed rhythm: about every three months, normally on the first Monday of the month. The release page lists v2026.07 on 6 July 2026 and v2026.10 on 5 October 2026. The next planned release is v2027.01, due on 4 January 2027, and its first candidate was scheduled for 26 October 2026. Vendor boards often lag. Always print your own version with version before reading release notes.

On real hardware. On a U-Boot board, stop the countdown and run printenv bootcmd bootargs, version and bootflow scan -l. Write down each value, then change boot_targets and repeat the scan to see the order change.
You add a camera node in a device tree overlay, but /proc/device-tree in Linux has no such node. Where do you look first?

Chapter 5

Kernel Handoff: DTB, cmdline, initramfs

Learn the three things the kernel needs at the instant it starts, and why a missing one gives you silence

U-Boot has printed Starting kernel .... After this line U-Boot is gone. It will not help. The kernel has to find everything on its own, and it can only use what U-Boot left in memory. If you get this handoff wrong, the board goes quiet.

What the kernel is given

The Linux documentation for 64-bit Arm sets out the contract. At entry the CPU registers must hold these values: x0 is the physical address of the device tree blob, or DTB. Registers x1, x2 and x3 must be zero. The MMU (the unit that maps addresses) must be off. The CPU must be in the normal world, at EL2 (recommended) or EL1, and all interrupts must be masked.

The DTB is a data file that describes the hardware: which UARTs, how much memory, which interrupt goes where. The kernel cannot discover these things by itself on Arm. The DTB must sit on an 8-byte boundary and must not exceed 2 megabytes. The kernel image needs its own placement rule: it goes at a fixed offset from a 2 MB aligned address.

Inside the DTB is a node called /chosen. U-Boot writes the kernel command line there, taken from the bootargs variable. The command line is a string of options. Four matter:

  1. console=ttyS0,115200: where kernel messages go. The kernel docs describe the form ttyS<n>[,options], with the options as baud rate, parity, bits and flow control.
  2. earlycon: a bare-bones polled console that works before real drivers load. The docs show a form like earlycon=pl011,<addr> or uart8250,mmio32,<addr>.
  3. root=/dev/mmcblk0p2: which storage partition holds the root filesystem.
  4. init= or rdinit=: which first program to run.

Two console phases

The kernel starts without any driver for your UART. It has to load that driver as part of its setup, and that takes a few hundred milliseconds. During that time, plain console= prints nothing. The kernel does keep the messages in a memory buffer. They appear later, when the console driver wakes up. But if the kernel crashes first, or the console name is wrong, the buffered text never leaves the machine.

That is what earlycon fixes. It writes the characters to the UART by direct register pokes, with no driver needed. It prints from the first kernel instructions. When the real console takes over, the kernel prints a line such as printk: bootconsole [...] disabled and the early console stops.

This gives a sharp diagnostic. If the log shows kernel lines and then stops right after that “bootconsole disabled” line, the kernel is running and the real console is wrong. If the log is silent from Starting kernel ... even with earlycon, the failure is before the kernel can read its command line: a bad DTB or a bad load address.

Here is the worst case, from the Linux arm64 source. If the DTB at x0 is not a valid blob, the kernel tries to print Error: invalid device tree blob, then The dtb must be 8-byte aligned and must not exceed 2 MB in size and Please check your bootloader. Then it spins in a loop. But those lines only appear if a console exists, and the bootargs that name the console live inside the DTB that just failed. The message exists; you often cannot see it. So check the DTB at the U-Boot prompt before you boot: fdt addr and fdt print.

Build the command line

This board’s debug UART is ttyS0 at 115200, and its root partition is mmcblk0p2. Choose values. The log below shows how far the boot gets.


    

    

A model of one board. The terminal on your laptop is set to 115200 baud. Messages are illustrative paraphrases of real kernel messages; your board will print different text.

initramfs or a real root

The kernel needs a root filesystem to run any program. There are two ways to provide one. An initramfs is a small archive loaded into RAM beside the kernel; it holds just enough tools to find the real storage. A real rootfs sits on a partition and is named by root=. A wrong root= ends in a kernel panic that says it was unable to mount the root filesystem. That panic is a good sign for your debugging: the whole kernel ran, so every stage before it is cleared.

Which kernel

Read the kernel version before you read anything else. As of 2 November 2026, kernel.org lists mainline 7.4-rc1 (1 November), stable 7.3.1 (30 October), and long-term releases including 6.18.60 and 6.12.115 (both 30 October). Vendor board support packages normally freeze an older long-term kernel. Run uname -r and compare. A bug fixed upstream may still be in your tree.

On real hardware. On any Linux dev board, read cat /proc/cmdline and cat /proc/device-tree/chosen/bootargs. Reboot with earlycon added in U-Boot, and note how many extra lines appear before the normal console starts.
The log ends at Starting kernel ... and stays silent even with earlycon on. Which is the most likely problem?

Chapter 6

Power Sequencing and the Cold-Boot Peripheral

See why chips need their power rails to rise in a set order, and why a unit can die at cold start yet look fine on a warm reboot

Think of a factory floor at the start of a shift. The lights must come on before the machines. The machines must be warm before the conveyor runs. If the conveyor starts first, parts fall on the floor. Nobody did anything wrong with any single machine. The order was wrong.

A circuit board has the same rule. A modern chip is fed by several power rails: separate supply lines, each at its own voltage. A typical processor board has a core rail for the logic, a memory rail for the DRAM, and an I/O rail for the pins. A chip called the PMIC (power management integrated circuit) makes all these rails from one input and decides when each one rises.

The contract

Each chip’s datasheet states a power-up sequence. It tells you which rail must rise first, how long each may take, and how long you must wait before releasing reset. Reset is a wire that holds the chip silent. While it is low, the chip does nothing. When it goes high, the chip starts to boot.

Why does order matter? Imagine the I/O rail comes up while the core rail is still at zero volts. The pins are powered but the logic behind them is not. Current can flow backwards through protection diodes into the unpowered core. That can lock the chip in a strange state, or damage it over many cycles.

The PMIC’s configuration table is therefore a contract between the board design and the chip. A new PMIC firmware version, a different capacitor, or a faster supply ramp can break it. The software does not matter yet. Nothing has run.

The rules below are an invented but typical set. They show the shape of a real datasheet table. Your chip will list different times.

Check the power-up order

Each coloured ramp is a rail. Drag the delays. Rules: core first, then memory, then I/O, and reset released at least 5 ms after the last rail is good.

4 ms after core
8 ms after core
20 ms after core starts

Invented rules and a 3 ms ramp per rail, to show how a sequence table works. A warm reboot leaves the rails up and only pulses reset, so the rail order is never tested again. Copy real limits from your chip’s datasheet.

The peripheral that is dead only when cold

Here is a classic symptom. A sensor board works every time after you press the reset button. But after a power cycle, once in ten starts, the camera or the Ethernet chip is not found. The kernel log says the device did not respond. A second power cycle might fix it.

This pattern, dead from cold and fine when warm, points at power. A warm reboot keeps every rail on. The rail order is not tested at all, so the fault hides. A cold start tests it fully, every time.

The measurement is a scope, not a debugger. Probe the rails and the reset line on one time axis. Trigger on the first rail rising. Compare each edge to the datasheet table. In the device above, a memory rail that starts before the core rail turns the verdict red; so does a reset released too soon. Those are the faults a scope shows in seconds.

The forced bring-up order

This chapter also gives the order in which to bring up a brand-new board, because each step needs the one before it.

  1. Rails. Measure every supply with a meter or scope before you plug in the chip.
  2. Clocks. Check the crystal oscillates at the right frequency.
  3. Resets. Confirm reset releases at the right time.
  4. JTAG. Connect a debug probe, so you can look inside a stuck chip.
  5. UART. Get one serial line to print one byte.
  6. DDR. Run a memory test.
  7. Storage. Read and write the flash or card.
  8. One peripheral at a time. Add each, test it, then add the next.

Skipping ahead is the usual mistake. If you debug Ethernet before the DDR is stable, you will chase a ghost for a week. For the small-chip version of this idea, see Hardware Interfacing.

Work one case by hand with the device’s defaults. The core rail starts at 0 ms and takes 3 ms to rise, so it is good at 3 ms. The memory rail starts at 4 ms and is good at 7 ms. The I/O rail starts at 8 ms and is good at 11 ms. The last rail is good at 11 ms. The rule asks for 5 ms of quiet before reset releases, so the earliest safe release is 16 ms. The default release is at 20 ms, which gives 9 ms of quiet after the last rail, 4 ms more than the rule needs. Now suppose a larger capacitor slows each ramp from 3 ms to 9 ms. The last rail is then good at 17 ms, the earliest safe release is 22 ms, and the 20 ms release breaks the rule by 2 ms. Nothing in the software changed. The board now boots on some days and not on others.

On real hardware. On any dev board, probe the 3.3 V rail and the reset line with an oscilloscope, triggering on the supply. Measure the time from supply-good to reset release in milliseconds, over 20 power cycles, and record the spread.
A camera chip is missing about one cold start in ten, but never after a warm reboot. What do you measure first?

Chapter 7

systemd on Embedded: Boot Time and the Watchdog

Find out why a robot takes a minute to be ready, and how to make a stuck service restart on its own

The kernel mounts the root filesystem and starts one program: PID 1, the first process. On most embedded Linux systems it is systemd. Its job is to start everything else, in the right order, as fast as it can. A robot’s camera, its motor bridge and its network all start from here.

Picture a restaurant opening. The cook can start the soup the moment the stove is lit. The waiter needs the tables laid. Nobody needs to wait for the delivery truck unless the menu uses its food. Systemd works the same way: it starts anything that has all its needs ready, many at once.

Units, targets and ordering

Systemd describes the work as units, small text files. A service unit runs a program. A target unit is a named milestone, such as basic.target or multi-user.target. A unit says what it needs with Wants= or Requires=, and when to start with After=. Units with no order between them run in parallel.

One milestone causes most of the pain: network-online.target. It means “the network is really up”. Services that say After=network-online.target wait for it. A helper such as systemd-networkd-wait-online.service holds that milestone closed until a link comes up or a timeout ends. On a robot with no cable plugged in, that wait can be tens of seconds.

Reading a slow boot

Systemd gives you two tools. systemd-analyze blame lists services by how long each took to start. systemd-analyze critical-chain prints the chain of units that set the finish time. In its output, @ is the time after boot when a unit became active, and + is how long it took to start. The man page warns that both can mislead. A slow unit may just be waiting for another, and parallel start hides some delays. So use critical-chain to find the path, and blame to see the heavy items on it.

Take a worked example with invented numbers. The kernel takes 3.1 s. Then sysinit takes 0.9 s and basic.target follows after 0.2 s, so userspace is at 1.1 s. The network daemon needs 0.6 s, so it is ready at 1.7 s. With the cable plugged in, wait-online finishes in 1.2 s: 2.9 s. The camera service takes 1.5 s after the network: 4.4 s. Total: 3.1 + 4.4 = 7.5 s. Now unplug the cable. Wait-online runs for its 30 s timeout: the camera starts at 31.7 s and the robot is ready at 3.1 + 33.2 = 36.3 s. One line in one unit file makes a 29-second difference.

Find the critical chain

Each bar is a unit. The yellow bars form the critical chain. Unplug the cable, then change what the camera service waits for.

Invented durations for a small robot image: kernel 3.1 s, sysinit 0.9 s, basic.target 0.2 s, networkd 0.6 s, wait-online 1.2 s (or a 30 s timeout), camera 1.5 s, logger 0.8 s. The chain is computed by the longest path through the dependencies, which is what critical-chain reports.

The fix is a design question, not a trick. Does the camera need the network to start? If the camera only needs it later to upload, drop After=network-online.target and let the service retry. If it truly needs the network, accept the wait, but make the timeout short and the failure visible.

The watchdog: a service that must keep talking

A watchdog is a timer that restarts something unless it is told, again and again, that all is well. Systemd has one for services. You set WatchdogSec=10 in the unit. The service must call sd_notify(0, "WATCHDOG=1") regularly, the keep-alive ping. If the gap passes ten seconds, systemd treats the service as failed, stops it with SIGABRT, and, with Restart=on-watchdog or on-failure, starts it again. Restarts are rate limited by StartLimitIntervalSec= and StartLimitBurst=, so a crash loop does not spin forever.

ini# /etc/systemd/system/perception.service
[Unit]
Description=Perception pipeline
After=basic.target

[Service]
Type=notify          # service sends READY=1 when it is up
ExecStart=/usr/bin/perception
WatchdogSec=10       # must send WATCHDOG=1 at least this often
Restart=on-watchdog
StartLimitIntervalSec=60
StartLimitBurst=3

The service tells systemd it is alive from inside its main loop. A hung loop stops the pings, which is exactly what you want: the watchdog catches a hang that a plain process check would miss. The related hardware watchdog, a chip timer that resets the whole board, is the last line of defence; Chapter 8 uses it.

Systemd also splits the wait into phases. The man page for systemd-analyze time shows a line such as “Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace)”. The three parts are the time in the kernel before userspace, the time in the initial ramdisk, and the time normal userspace took. Read that line first. If the kernel part is large, the problem is below systemd and Chapters 1 to 5 apply. If userspace is large, critical-chain is your tool.

On real hardware. On a systemd Linux board, run systemd-analyze time, then systemd-analyze critical-chain. Unplug the network cable, reboot, and run both again. Record the difference in total boot time in seconds.
Boot takes 36 s with the cable unplugged and 7 s with it plugged in. What does critical-chain most likely show?

Chapter 8

Field Debugging: pstore, ramoops, Reboot Reason

Keep the last words of a crashed unit, so a robot that rebooted in a warehouse still tells you why

A delivery robot reboots in a warehouse three time zones away. When you see it, it is running fine. The log on disk starts at the new boot. The crash that caused the reboot left no trace. You have no serial cable, no scope, and no way to repeat it.

On the bench, the serial console showed you the last words of a dying kernel. In the field there is no one to read it. The answer is to make the machine write its own last words somewhere that survives the reboot.

Why a crash log is lost

When the kernel panics, it prints a trace to the console. If the console is a serial port with nobody attached, the text is gone. The log files on the disk may not have been written yet. And the system then resets. Anything held only in normal RAM is overwritten by the next boot.

But a warm reset, one where the board keeps its power, does not erase RAM by itself. The bytes stay in the DRAM chips for a while. If the next boot knows where to look and does not touch that area, it can read the old data. That is the idea behind pstore, the persistent store. The kernel saves the oops and panic text into a store that survives restarts. After the reboot, the saved records appear as files in the pstore filesystem, mounted at /sys/fs/pstore.

ramoops: a reserved piece of RAM

One pstore backend is ramoops. The kernel documentation describes it as logging oopses and panics to a predefined RAM area that survives a restart. You pick the area's start address and size. It is divided into records of record_size bytes, and each dump writes one record. Two settings must be sound: the area must be reserved so nothing else uses it, and the bootloader must not wipe it.

Here is the device tree form from the kernel docs. The node reserves 1 MB at 0x8f000000, with 16 KB records:

dtsreserved-memory {
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;

    ramoops@8f000000 {
        compatible = "ramoops";
        reg = <0 0x8f000000 0 0x100000>;
        record-size  = <0x4000>;
        console-size = <0x4000>;
    };
};

The size check: 0x100000 is 1,048,576 bytes, which is 1 MiB. Records of 0x4000 = 16,384 bytes mean the 1 MiB area could hold at most 1,048,576 / 16,384 = 64 records of that size. The real count is lower, because the console log takes some of the space too. After a crash and a reboot you list the files. Dump records are named dmesg-ramoops-N, where N is the record number. Unlinking a file deletes that record from RAM, which frees the slot. For a simpler setup, the kernel docs also show reserve_mem on the command line, though they call it a best-effort approach.

Reboot reason: the second clue

Most chips keep a reset-cause register: a few bits that record why the last reset happened. Typical causes are power-on, a watchdog timeout, a software reset, and a brown-out (the supply dipped too low). The register is cleared when you read it or on the next cold start, so the first thing a boot should do is read it and save the value. Write it into the log, and send it with your telemetry. Now each boot starts with a line such as “last reset: watchdog”.

Put the two clues together and you can sort most field reboots without a cable. A panic leaves a ramoops record and a software reset. A hang that a hardware watchdog broke leaves no record but a watchdog reset. A power cut leaves nothing in RAM and a power-on reset. Each cause points at a different part of this lesson.

Crash a unit in the field

Choose a kind of failure. Turn the capture tools on or off. Press Crash it, then read what survived.

A model of the rules, not a measurement. In practice RAM contents can also survive a very short power dip, but you cannot rely on that, so the model wipes RAM on every power cut.

Watch the silent hang with everything off. The unit freezes and stays frozen: no record, no reset, no clue. Turn on the hardware watchdog and the same hang becomes a reboot with a known reason. That is the difference between a lost robot and a diagnosed one.

Two more settings finish the job. First, tell the kernel to reboot after a panic by adding panic=5 to the command line, so it waits 5 seconds and restarts instead of freezing forever. Without it, a panicked unit sits dead and the ramoops record is never read. Second, give the hardware watchdog a driver, and let systemd feed it. Setting RuntimeWatchdogSec= in the systemd configuration makes PID 1 ping the hardware timer. If PID 1 itself hangs, the timer expires and the chip resets the board. The three tools then cover different layers: the service watchdog from Chapter 7 for one program, the hardware watchdog for the whole system, and ramoops for what the kernel knew at the end.

On real hardware. On a Linux board with ramoops configured, trigger a test panic with echo c > /proc/sysrq-trigger (this crashes the machine on purpose). After it reboots, run ls /sys/fs/pstore and read the first dmesg-ramoops file. Then cut power instead and note that the files are gone.
A field unit froze with no panic message, then a hardware watchdog reset it. What can you read after the reboot?

Chapter 9

Field Guide

Keep the numbers, the checklist and the triage rules, and carry them to the next dead board

A board boots through six stages: ROM, SPL, TF-A, U-Boot, the kernel and init. Each lives in a different memory, checks the next, and speaks in its own voice. The last line of the log names the last speaker. The failure sits at the first stage that should have spoken next. The rest of this page is a reference to keep open while you debug.

Triage a log

Paste a log or choose a sample. The classifier below applies the rules from this lesson in a fixed order, starting from the last line. The same rules appear as Python further down.

Name the failing stage

Choose a sample, or edit the text. The verdict updates as you type.

Rule based and deliberately simple. Real logs vary by board and version, so treat the verdict as the first place to look, not the final answer. Sample text is illustrative.

The numbers

FactValueSource
Common console setting115200 8N1A common default; confirm on your board
DDR5-4800 clock period0.4167 ns; one transfer is about 208 psArithmetic from 2,400 MHz and 4.8 GT/s
CL 40 cycles16.67 ns40 × 0.4167 ns; timing 40-39-39 in Kingston datasheets
tRC 117 cycles48.75 ns (datasheets may list 48 ns)117 × 0.4167 ns; an Innodisk datasheet lists 48 ns
DTB handed to arm64 Linux8-byte aligned, at most 2 MB, in x0Linux arm64 booting document
TF-A levelsBL1 EL3, BL2 S-EL1, BL31 EL3, BL32 S-EL1, BL33 EL2 or EL1TF-A firmware design
U-Boot releasesv2026.07 on 6 Jul 2026; v2026.10 on 5 Oct 2026; v2027.01 planned 4 Jan 2027U-Boot release cycle page
Linux, read 2 Nov 2026mainline 7.4-rc1; stable 7.3.1; long-term 6.18.60 and 6.12.115kernel.org front page
Yocto 6.0 “Wrynose”Long-term support until April 2030Yocto Project releases wiki
Jetson early bootOrin: BootROM, MB1, MB2, UEFI. Thor lists more early steps.NVIDIA Jetson Linux Developer Guide
ramoops example1 MiB at 0x8f000000, 16 KiB recordsLinux ramoops document

Treat the kernel and release lines as a snapshot. Re-read the pages before you plan around them. For the Jetson Thor generation, take kernel and JetPack details from NVIDIA’s own release notes for your exact release, not from memory.

The bring-up checklist, as a chain of dependencies

  1. Rails measured, then clocks, then reset release (Chapter 6).
  2. Debug UART prints one byte. If not, scope TX (Chapter 1).
  3. SPL banner prints, DDR trains, and survives a stress test hot and cold (Chapter 2).
  4. BL31 notice prints; peripherals have the right Secure marks (Chapter 3).
  5. U-Boot environment, FIT hashes and overlays check out at the prompt (Chapter 4).
  6. Kernel gets a valid DTB, console=, root= and earlycon (Chapter 5).
  7. Critical chain is short; the watchdog is on (Chapter 7).
  8. ramoops and reset reason are saved on every boot (Chapter 8).

The core as code

pythondef triage(log: str) -> tuple[str, str]:
    """Name the stage to check from where the console log stops."""
    lines = [l for l in log.splitlines() if l.strip()]
    if not lines:
        return ("BootROM or early SPL", "Nothing printed: scope TX, check boot pins, fuses and pinmux.")
    last, text = lines[-1], log
    if "login:" in last:                     return ("none", "Booted to a login prompt.")
    if "Unable to mount root" in text:      return ("kernel root=", "Whole kernel ran. Fix root= or the storage driver.")
    if "Kernel panic" in text:             return ("kernel", "Read the panic trace above the last line.")
    if "bootconsole" in last:            return ("kernel console=", "Kernel runs; real console is wrong: name, baud, driver.")
    if "Starting kernel" in last:         return ("kernel handoff", "Turn on earlycon; check DTB address, DTB board, console=.")
    if "can't get kernel image" in text or "Wrong Image Format" in text:
                                              return ("U-Boot", "Check bootcmd, load addresses and the image name.")
    if "systemd[" in last:                return ("init", "Userspace started: read journalctl and the critical chain.")
    if "U-Boot 20" in text:               return ("U-Boot", "U-Boot spoke last: check the step it was about to take.")
    if "NOTICE:" in text:                return ("TF-A to BL33 handoff", "BL31 spoke, U-Boot did not: check the BL33 image and address.")
    if "SPL" in text:                    return ("SPL or TF-A load", "SPL spoke last: DDR, or loading the next image.")
    return ("unknown", "Unrecognised text: check baud rate and wiring.")

And the keep-alive that makes the watchdog from Chapter 7 work, in C with the systemd library:

c/* link with -lsystemd; the unit sets Type=notify and WatchdogSec=10 */
#include <systemd/sd-daemon.h>
#include <unistd.h>

int main(void) {
    setup_camera();
    sd_notify(0, "READY=1");               /* startup done */
    for (;;) {
        grab_and_process_frame();         /* if this hangs, pings stop */
        sd_notify(0, "WATCHDOG=1");          /* keep-alive ping */
    }
}

Where it sits in the field

This lesson is the Linux-board counterpart to the small-chip boot in From Vector Table to main, where one program runs on bare metal. It prepares the ground for Real-Time Linux, which assumes a board that boots cleanly, and for benchmarking and root-cause work. Background reading: Embedded Linux, Embedded Systems Intro, RTOS, Real-Time Systems, Advanced C, Sensor and Actuator Integration and Robot Real-Time Performance. Later lessons on cameras, networking and edge accelerators in this series build on the same boot chain.

Sources

The takeaway. The last line of the log is a clue about the last speaker, not the culprit. Ask which stage should have spoken next, then measure at that handoff: a wire, an address, a hash, a rail, or a command line.

Now press Teach and explain, from memory, how a board gets from power on to a login prompt and what you would check for each place the log can stop. Then go back to the top of the page and break each stage again.

ROM to systemd: The Boot Chain and Where the Log Stops
Embedded Linux · From Vector Table to main · Back to Gleams