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
- An Android phone with the Libre Computer app and its USB cable, or the bench PC
- 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. - With the board unplugged, hold the USB boot button and connect the phone or the bench PC to the board's USB Type-C port, so the board powers on with the button held; your TA shows how your station powers the board in this mode. Release the button, let the app send the open first stage, and watch it start on the serial console without the board's own firmware. From the bench PC, the Amlogic USB boot tool does the same job (module 3's resources link its guide).
- 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, sent from the bench PC with the Amlogic USB boot tool (your build is on the bench PC, not on the phone). 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 you observed with the switch in each position, and what the board printed at each.
- 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.
- 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.