Skip to content
Libre Computer
Platform

Modules

From power-on to the 40-pin header

The course follows your board through everything it does after power reaches it. Each module is one stage, and each stage only depends on the ones before it. You learn what has to be true before the next thing can happen, and you see it happen on your own board.

  • 13 modules
  • One boot log
  • Das Frite or Solitude
  • Observe, change, recover

The modules

ModuleStageLabWhat you see on your board
0. First bootAn OS image on boot media; the serial console1The full boot log, captured and kept for later
1. What a board isSystem-on-chip, memory, storage, regulators, clock, I/O2Every major part, on the board and in its layout
2. First power-on and voltage railsRegulators, rails, sequencing, reset2Rails measured, the power budget measured
3. The boot ROMCode fixed in the chip runs first3The boot order, and a board started over USB
4. Loading the bootloader into SRAMA small first stage in on-chip memory3An open-source first stage loaded over USB and running
5. Memory bring-upTimings, training, size detection4The memory lines of the log; a memory clock change and its effect
6. Software in DRAMSecure monitor, U-Boot, the memory map4The U-Boot prompt; a kernel booted by hand
7. UEFIA standard firmware interface5A stock generic distribution booting unmodified
8. Linux bootsKernel, drivers, root filesystem, init5The kernel's lines annotated; the boot timed
9. Device tree and pin multiplexingHow the OS learns the hardware6The live device tree; an overlay that binds a driver
10. I/OGPIO, I2C, SPI, UART, PWM6–8Parts on the 40-pin header, decoded on a logic analyser
11. DriversUser space and the kernel8A userspace driver; a minimal kernel module
12. A whole systemBoot as a service, survive a power cut, recover9–10The final project, and a broken board brought back

The boot chain

The boot chain: each stage loads the nextBoot ROMfixed in the chipmodule 3First stageclocks, consolemodule 4Memory bring-uptimings, trainingmodule 5Secure monitorTF-A, stays residentmodule 6U-Bootstorage, USB, networkmodule 6UEFIstandard interfacemodule 7Linux kerneldrivers, rootmodule 8initsystemd, servicesmodule 8runs from On-chip ROMruns from On-chip SRAMruns from DRAMPower and reset come first (module 2); I/O, drivers and your project run on the finished system (modules 9 to 12).
The boot chain at a glance; the table below says what each stage does.

Where each stage runs

The boot is a chain of handovers. Each stage runs from the only memory that is working at that moment, and its last job is to load the next stage and jump to it.

StageRuns fromLoaded byIts job
Boot ROMROM inside the system-on-chipNothing: it is the first instruction after resetFind a first stage on a boot medium or over USB, check it, copy it into SRAM
SRAM stageOn-chip SRAMThe boot ROMSet up clocks and the console, bring up DRAM, load the next stages into DRAM
Secure monitor (TF-A)DRAM, stays residentThe SRAM stageRun at the highest privilege level; power CPUs on and off for the OS
U-BootDRAMThe SRAM stageDrive storage, network and USB; provide UEFI; load the kernel and device tree
Linux kernelDRAMU-Boot, directly or through UEFITake over the hardware, probe drivers, mount the root filesystem
init (systemd)DRAM, as the first processThe kernelStart every service, including the login prompt on the serial console

One boot log, explained module by module

In lab 1 you capture the full boot log of your own board, without any explanation. Each module then explains the lines its stage prints, until every line is accounted for. By the end you can take the log of a board that did not boot and say where it stopped, and why.

LabLines explainedModules
1None: the whole log, unexplained0
3The boot ROM's lines, before any code from flash or boot media has run3
3–4The SRAM stage and memory bring-up4–5
4–5The secure monitor, U-Boot and UEFI6–7
5The kernel and init8
6–8Driver probe lines for each bus you enable9–11

Start here