Module 14 · Lesson 75 of 92

LAVA architecture and boot methods

Trace how LAVA assigns a board, stages boot artifacts, controls the bootloader, and starts a test definition in Linux.

  • Beginner to advanced
  • 10 min read
  • 13 min lab
What you will need

Ubuntu 24.04 in WSL2 or a VM for the written exercises. Running the example requires a LAVA instance with a registered BeagleBone Black, a serial console, remote reset control, and working TFTP and NFS services.

Your place in the module
By the end you can 4 objectives
  • Distinguish the LAVA server, worker, dispatcher, and device under test.
  • Identify which settings belong in the device dictionary, job definition, and test definition.
  • Trace how U-Boot, GRUB, and fastboot consume artifacts prepared during deployment.
  • Explain how a custom U-Boot job reaches the Linux shell and identify the last successful stage from its log.
Video coming soonLAVA architecture and boot methods
The video for this lesson is being recorded. Read the lesson below in the meantime.
Recall first from What to test and how to automate it
  • Functional validation checks an actual operation on every supported peripheral.
  • Performance and thermal results depend on the workload, fixture and measurement conditions.
  • KUnit tests kernel code internally, kselftest checks kernel features and LTP tests Linux system behavior.
01

From a submitted job to a physical board

4 min read

Automation needs a harness, and LAVA is the standard one for board farms. This lesson answers the dispatcher, worker and device dictionary, and how a LAVA job boots through U-Boot and reaches its test shell.

A board can start Linux and still time out in LAVA. For example, U-Boot can print on the UART connected to the worker while Linux uses a different console. The worker sees the bootloader start the kernel and then receives no shell prompt. The Linux serial-console documentation describes how console= chooses where kernel messages go and how a login service is configured separately. That distinction matters because an automated job needs both a way to observe boot and a way to issue commands after boot.

The LAVA server accepts a job and schedules it on an eligible device. The job commonly requests a device type, such as beaglebone-black. A device type describes a class of boards. A device is one registered physical board with its own connection and control settings. The scheduler can select an available instance of the requested type, so a job can run on different boards of the same type without naming a serial port or a power controller.

A has access to the equipment needed to control those boards. That access can include a network serial console, a remotely controlled power outlet, or a USB connection. The dispatcher is the software on the worker that executes the job's actions. It fetches files, invokes the lab's configured control commands, reads console output, sends input, and reports logs and results. The is where the kernel and userspace being evaluated execute.

Who runs a LAVA jobLAVA serverWorker dispatcherDUTAssign scheduled jobReset and bootStart test runnerConsole and resultsReport job results1. LAVA server → WorkerdispatcherAssign scheduled job2. Worker dispatcher → DUTReset and boot3. Worker dispatcher → DUTStart test runner4. DUT → Worker dispatcherConsole and results5. Worker dispatcher → LAVAserverReport job results
The server schedules the device, the worker runs the dispatcher, and the dispatcher controls the DUT

Three kinds of configuration are involved in a typical shell-test job.

  • The device dictionary describes how LAVA handles a registered device. In LAVA deployments that use Jinja templates, its settings are combined with the device-type template. The resulting configuration can provide a console connection command, power or reset commands, and parameters for supported boot methods. If one BeagleBone Black moves to a different serial-server port, the lab operator updates that device's configuration.
  • The job definition is the YAML submitted for a run. It requests a device type, lists artifact URLs, and orders the actions. An ordinary boot-and-test job uses deploy, boot, and test. To run a new kernel build on the same hardware, the job author can change the kernel URL there.
  • The test definition describes the test program and the commands it executes on the target. A job's test action can point to a definition stored in a repository. A test definition can also be supplied inline. In a definition, run.steps lists commands for the target shell. A command such as lava-test-case kernel-release --shell uname -r runs uname -r on the DUT and reports a named case based on the command's exit status.

LAVA prepares its test scripts during deployment for the relevant test method. After boot, the dispatcher uses the target shell to start the runner. The runner executes the test definition in Linux and emits output that LAVA can associate with the job and named test cases. The kernel-release example proves that the command executed successfully and prints a release string. Checking that the release matches the submitted build requires an explicit comparison in the test.

02

How deployment and boot work together

4 min read

Deploy makes the job's artifacts available through the delivery method the board will use. Depending on the method, the dispatcher might download a kernel and device tree to a TFTP area, unpack a root filesystem for NFS, or use fastboot to write images to storage. For a TFTP job, a successful deploy action can mean the files are ready to serve while the DUT is still powered off. The transfer to board RAM occurs later, when the bootloader requests the files.

Boot uses the method chosen in the job and supported by the device configuration. It brings the board into the expected state, starts the selected software, and, for a shell-test job, waits for the configured Linux prompt. Deployment and boot must agree on how the images will be read. A kernel staged on a TFTP server still needs a bootloader command that fetches the right file. A kernel loaded successfully can still fail when it attempts to mount the root filesystem.

From artifacts to testsPrepareartifactsDeployactionControlbootloaderStart LinuxMatch shellpromptRun testdefinitionPrepareartifactsDeployactionControlbootloaderStart LinuxMatch shellpromptRun testdefinition
Artifact preparation, bootloader control, kernel startup, and the shell test are distinct stages

U-Boot. On a BeagleBone Black configured for network boot, the dispatcher opens the serial console and resets the board. It watches for the configured autoboot interruption text and sends the configured input while the countdown is active. At the U-Boot command prompt it issues commands from the selected boot sequence. In a TFTP and NFS flow, U-Boot fetches the kernel and device tree into RAM and starts the kernel. Linux configures networking and mounts its root filesystem from an NFS export. The U-Boot network transfer and the Linux NFS mount take place at different stages and can fail independently.

GRUB. On a Raspberry Pi 4 with suitable UEFI firmware, a lab can arrange for that firmware to start GRUB. For an interactive GRUB flow, the dispatcher uses the configured console to reach the GRUB command line. GRUB can use linux to select a kernel and set its command line, initrd to load an initial RAM filesystem when the boot setup uses one, and boot to start Linux. The kernel and initial RAM filesystem must be reachable by GRUB through the device or network path the lab configured. The device configuration must also make GRUB's console available to the worker.

Fastboot. Fastboot is a protocol a host can use to communicate with a bootloader that implements it. A lab can configure a BeagleBone Black with a U-Boot build that exposes USB fastboot over its USB device connection. The board must enter fastboot mode first, for example through a U-Boot command sent over serial in a lab configured for that sequence. The worker then uses the host fastboot tool over USB. In a flashing flow, it writes the named partitions supported by that setup and reboots the DUT to start from storage. Some implementations also support downloading and immediately booting a compatible image with fastboot boot. The configured target determines which operations are available. USB fastboot carries the host requests, while a shell-test job can still use serial to observe Linux and run its tests.

The serial interaction depends on matching the right text at the right time. U-Boot's autoboot message indicates when the dispatcher should send the interrupt input. The bootloader command prompt indicates when it can accept a command. After Linux starts, a userspace login service may print a login prompt. When the image requires a login, the job can use auto_login to match that prompt and send the configured credentials, including a password when required. With a test image that already opens a shell on the console, the boot action can wait directly for one of the values listed under prompts.

A prompt should identify the state reliably. A short string such as # can also occur in unrelated console output. An image configured to print a distinctive shell prompt gives the dispatcher a more useful match. If Linux output appears but the expected prompt never arrives, inspect the console setting, the userspace login service, and the actual text the image emits. If the U-Boot prompt never appears, start with the console connection, reset, and autoboot interruption settings.

03

Write an interactive U-Boot job

4 min read

The example below uses a BeagleBone Black that already starts U-Boot after reset. Its lab configuration supports TFTP deployment and interactive U-Boot boot. The worker serves the staged kernel and device tree over TFTP and exposes the unpacked root filesystem over NFS. The target image provides a root shell on the serial console with the literal prompt lava-target#. The kernel has the built-in networking and NFS root support needed to mount that root filesystem during boot. The artifact URLs are placeholders for the lab's actual files.

Serial stages in the U-Boot jobInterruptautobootMatchU-BootpromptFetch bootfilesIssue bootzMatch LinuxpromptStart testrunnerInterruptautobootMatchU-BootpromptFetch bootfilesIssue bootzMatch LinuxpromptStart testrunner
The dispatcher waits for bootloader readiness, starts Linux, and waits again for userspace readiness
yaml
device_type: beaglebone-black
job_name: BeagleBone Black interactive U-Boot
visibility: personal
timeouts:
  job:
    minutes: 15
actions:
  - deploy:
      to: tftp
      os: debian
      kernel:
        url: https://artifacts.example.org/beaglebone/zImage
        type: zimage
      dtb:
        url: https://artifacts.example.org/beaglebone/am335x-boneblack.dtb
      nfsrootfs:
        url: https://artifacts.example.org/beaglebone/rootfs.tar.gz
        compression: gz
  - boot:
      method: u-boot
      commands:
        - "setenv serverip {SERVER_IP}"
        - "dhcp ${loadaddr} {KERNEL}"
        - "tftpboot ${fdtaddr} {DTB}"
        - "setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot={NFS_SERVER_IP}:{NFSROOTFS},tcp rw ip=dhcp"
        - "bootz ${loadaddr} - ${fdtaddr}"
      prompts:
        - "lava-target#"
  - test:
      definitions:
        - from: inline
          name: boot-smoke
          path: inline/boot-smoke.yaml
          repository:
            metadata:
              format: Lava-Test Test Definition 1.0
              name: boot-smoke
              description: Run a command in the booted kernel's userspace
            run:
              steps:
                - lava-test-case kernel-release --shell uname -r

The deploy action declares the kernel format, the BeagleBone Black device tree, and the compressed root filesystem. Here os: debian assumes a Debian target image. The worker's Ubuntu installation is independent of the distribution in that archive. Use an archive with the expected root filesystem contents and a test environment that supports the LAVA runner.

In boot, the list under commands provides the commands to send after the dispatcher reaches the U-Boot prompt. LAVA substitutes {SERVER_IP}, {NFS_SERVER_IP} (both aliases of the worker's address), {KERNEL}, {DTB}, and {NFSROOTFS} using the deployment details. LAVA's documentation recommends custom boot commands only for corner cases and logs a warning each time they are used. Normally the job says commands: nfs and uses the predefined command set from the device-type template. The custom list is shown here so every stage is visible. U-Boot expands ${loadaddr} and ${fdtaddr} on the board. Those two variables must already be set to suitable, non-overlapping load addresses by the board's U-Boot environment. The DHCP setup must preserve or supply the correct TFTP server address. These assumptions are worth checking against a known-good boot of the lab's actual board before submitting the job.

The dhcp command acquires network configuration and requests the kernel. tftpboot fetches the device tree to its own address. The next command sets bootargs for the kernel, including the serial console and NFS root. The ip=dhcp argument makes Linux obtain its own network configuration for boot. bootz starts the ARM zImage, with - in the initramfs position because this setup uses NFS root without an initramfs. Once Linux starts, U-Boot stops accepting commands. The dispatcher now waits for lava-target#, then starts the test runner. An image with a login prompt would need an auto_login configuration before that final shell match.

Read a failed job from the last confirmed stage. If the dispatcher reaches the U-Boot prompt and the kernel transfer fails, compare the filename, server address, and network path with what deployment prepared. A return to the U-Boot prompt after a command establishes that the command finished, and the command's output tells you whether it succeeded. If Linux reports an NFS mount failure, inspect the Linux network configuration and the exported path. If the shell prompt appears and the named case fails, inspect the test output from the target. Before opening the job log, ask what evidence would establish that the test command actually ran. A matching shell prompt establishes readiness, and the named case output establishes execution.

The next lesson, labgrid and hardware-in-the-loop, looks at how automated tests control and observe lab equipment when the test needs to interact with hardware during the run.

Key takeaways

  • The scheduler assigns an eligible board and the dispatcher executes the job on its worker.
  • Deployment prepares artifacts for a chosen delivery method, and boot starts the target with those artifacts.
  • A bootloader prompt, a login prompt, and a shell prompt mark different stages of a serial boot.
  • The LAVA test shell runs the test definition on the board after Linux reaches a usable shell.
Reflect
  1. Explain to a colleague, in two sentences: distinguish the LAVA server, worker, dispatcher, and device under test.
  2. Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
  3. What surprised you when you ran the commands yourself?
On a real board

Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.

References and further reading

Find your next step

↑ ↓ to move · Enter to open · Esc to close