Lab 3
Boot ROM and the SRAM stage
See the first code your board runs, change the order in which it looks for boot media, start the board over USB with no help from its own firmware, then build the open first stage yourself, change it, and boot your build.
Modules this lab uses
What you need
- Your station's board, power supply, boot media and serial console from lab 1, and your lab 1 log
- The bench PC with the Libre Computer app, and a USB cable to the board's USB Type-C port
- The bench PC with libretech-builder-simple, which builds Libre Computer's open boot chain from source
Before you start
Read the rules that keep the board alive. Nothing in this lab writes to your board's storage: the first stage you build is loaded into the chip's SRAM over USB, and is gone at the next power-off.
Steps
- In a copy of your lab 1 log, mark the lines printed before any code from the SPI flash or the boot media ran. These are the boot ROM's.
- Mark where the boot ROM stops printing and the first stage starts.
- With the board unplugged, flip the boot select switch. Power on with the console open, watch the boot ROM try its sources in a different order, and write down what you observe. Power the board off (shut it down with
sudo poweroffif Linux is running, wait for the halt, then unplug it) and put the switch back. - Read the boot settings from the chip itself. With the switch in its normal position, stop at the U-Boot prompt (press
cduring its one-second countdown) and runlc bootrom print. It printsbootrom_order=(the boot ROM's order),bootrom_straps=,bootrom_fuses=and onebootrom_raw_<register>=line per register, read from the chip;printenv bootsourcenames the medium this boot came from. (Firmware from before 28 November 2026 haslc bootsettings printinstead, withboot_*lines.) In the other position the boot ROM skips the SPI flash. Das Frite's boot ROM does not read a USB drive, so with no eMMC module it ends in USB boot mode instead of reaching U-Boot; Solitude's does too unless its card carries a bootloader of its own. So you read that position in the next step, at the prompt of a USB start. Save the output for each position and comparebootrom_order=with the order you observed. - With the board unplugged, flip the boot select switch again (on Das Frite this is its USB position, named for where a board with no other medium ends up) and put the board in USB boot mode for power-on: on Solitude hold the USB boot button; on Das Frite the flipped switch is enough when no eMMC module carrying a bootloader is fitted. Connect the bench PC to the board's USB Type-C port, so the board powers on in that mode; your TA shows how your station powers the board in this mode. Release Solitude's button, let the Libre Computer app send the published open first stage, and watch it start on the serial console without the board's own firmware. Its boot menu opens with no countdown: press
cfor the prompt and runlc bootrom printfor the flipped position (printenv bootsourcenames USB). On Solitude the button you held is part of this reading, so say so when you compare it with step 3's order. Then power the board off, unplug it and put the switch back. - Reach USB boot mode a second way, with no button. Power the board on with the bench PC connected, stop at the U-Boot prompt, and run
lc bootrom check, which printsbootrom: available, thenlc bootrom reset, which printsbootrom: forced: the board restarts in USB boot mode, and the app can send the first stage as before. The power-on way in (the button, or Das Frite's switch) stays the way when U-Boot does not start. - On the bench PC, build the first stage for your board with libretech-builder-simple, following its instructions.
- Add one line of your own to the first stage's console output, rebuild, and start the board over USB with your build: put it in USB boot mode as in step 5 or step 6, then send your build from the bench PC with the app's
lccommand:lc listnames your board's USB port, thenlc boot --port PORT --target aml-s805x-ac-v2 --art OUTsends your build (on Solitude,--target aml-s905d3-cc), with OUT the builder'soutdirectory. Find your line in the console output. - Write one paragraph on what the first stage had to do before anything bigger could load.
What to measure
- The boot order with the switch flipped (step 3), the source your lab 1 log shows booting in the normal position, and what the board printed at each.
- The
lc bootrom printoutput for each switch position, and whether itsbootrom_order=matches what you observed. - Which lines of the log come from the boot ROM and which from the first stage.
The annotated boot log
An annotated boot log for each board is in preparation. Until it is published, annotate from your own log, the two modules and what you observed when you changed the boot order.
What you hand in
- The boot order as observed with the switch flipped, and the source your lab 1 log shows booting in the normal position, with the
lc bootrom printoutput for each switch position and a sentence comparing the two. - Your log with the boot ROM's and the first stage's lines annotated.
- Your build's console output, with the line you added.
- The paragraph on what the first stage had to do.
- Your own short report: what you did, what you measured, and one problem you met and how you solved it.
If it goes wrong
If the board boots differently after this lab, check that the boot select switch is back where it was. If it will not boot, work down when it will not boot on your bench page; starting it over USB is step 4 there.