Skip to content
Libre Computer
Platform

Lab 5

UEFI and Linux boot

Boot a stock generic arm64 distribution, unmodified, through the UEFI bootloader in your board's SPI flash. Then finish your boot log: by the end of this lab every line of it, from power-on to the login prompt, has its stage named.

What you need

  • Your station's board, power supply and serial console, and your annotated log from labs 3 and 4
  • Your station's spare boot media (you write the course image back to it after the lab)
  • The bench PC with its card and drive reader and the desktop imager, to write the stock image and, after the lab, the course image back
  • The stock generic arm64 distribution your instructor chose, whose image and checksum are on the bench PC (module 7's resources link the Debian, Fedora and openSUSE builds for Libre Computer boards)

What you need

  • Your station's board, power supply and serial console, and your annotated log from labs 3 and 4
  • Your station's spare boot media (you write the course image back to it after the lab)
  • The bench PC with its card and drive reader and the desktop imager, to write the stock image and, after the lab, the course image back
  • The stock generic arm64 distribution your instructor chose, whose image and checksum are on the bench PC (module 7's resources link the Debian, Fedora and openSUSE builds for Libre Computer boards)

Steps: UEFI

  1. With the desktop imager on the bench PC, write the stock distribution image to your station's spare boot media, and check its checksum against the published one. After the lab, write the course image back to it, so the station keeps a working spare.
  2. With the board unplugged, swap in the spare. Power on with the console open and let the bootloader in SPI flash boot it.
  3. Log in on the serial console with the login your TA gives you for this distribution (some distributions ask you to create one on first boot).
  4. Find the EFI system partition (for example with lsblk -f), and look for the fallback loader at \EFI\BOOT\BOOTAA64.EFI.
  5. List the boot entries with efibootmgr -v.
  6. Compare this boot with the one you did by hand in lab 4: who chose each file and each address?

Steps: Linux boot

  1. Annotate the kernel and init lines of your log, using the timestamps to find where the time goes.
  2. On the stock distribution you booted through UEFI, read /proc/cmdline, change one boot argument in that distribution's boot-loader entry (not U-Boot's bootargs, which a UEFI boot does not use; your TA shows how for the section's distribution), reboot, and see what changes.
  3. Measure the boot with systemd-analyze, and find the slowest services with systemd-analyze blame.
  4. Write a systemd service that starts a program of your own at boot, and enable it (module 8 shows the unit file and the commands). Reboot and show that it started, with its log from journalctl.
  5. Go through the whole log once more and make sure every line has its stage named.
  6. Before the spare media is re-imaged, copy what you hand in off the board with scp: your service unit, its journalctl log, and the systemd-analyze and systemd-analyze blame output.

What to measure

  • The boot time, split the way systemd-analyze reports it, and the slowest services.
  • Where the kernel's own timestamps show the time going.

The annotated boot log

An annotated boot log for each board is in preparation. Until it is published, your own fully annotated log is the one you hand in.

What you hand in

  • The fully annotated boot log, every stage named.
  • A boot-time breakdown.
  • Your service unit, and its journalctl log from the reboot showing it started.
  • 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 a changed boot argument stops the boot, at the boot menu, edit the entry for this one boot and remove the change, boot, then undo it for good in the boot-loader entry under /boot (your TA shows where; on these distributions it is not on the EFI system partition), or write the stock image to the spare again; then carry on from the systemd-analyze step. Your first boot media was not changed. Otherwise work down when it will not boot on your bench page.