tgamblin's boardfarm repo, built primarily for testing RISC-V development boards (plus QEMU targets) with Labgrid and Forgejo Actions.
This repository relies on the labgrid-boardkit Python module, which was originally implemented as part of boardgarden to support generic test strategy/suite re-use.
As part of the RISE Project, BayLibre is improving support for RISC-V hardware and software within the Yocto Project. This manifests in two main categories:
- Triaging issues discovered while building and performing runtime testing of
RISC-V systems using the
openembedded-core layer
(which supports RISC-V via QEMU-based
qemuriscv32andqemuriscv64MACHINEoptions) - Improving the meta-riscv layer's support for widely-available RISC-V development boards, and ensuring it remains compliant with Yocto Project compatibility standards
boardgarden was built to address these challenges in an automated fashion, and
to serve as a useful reference to others who may want to build out their own
automated testing infrastructure.
- Broadly compatible with GitHub Actions (therefore familiar to many users)
- Convenient features for a forge (repository mirroring and sync, container registry, issue tracking, statistics, wiki)
- Lightweight
- Mature project with existing support for automated remote control of many devices, including USB-to-UART bridges, power switches, and USB SD Mux
- Hardware details abstracted away from user
- Simple YAML configuration files
- Uses
pytestfor test suites
The diagram and docs/bom.md are generated from
docs/network.yaml by docs/generate_diagram.py (see its docstring for the
Mermaid rendering steps) - edit the YAML rather than the outputs.
These should mostly just work on a sufficiently-resourced Forgejo instance with Actions enabled. The workflows fall into a few groups:
- Scheduled (nightly or weekly) Yocto build and board test pipelines
- Scheduled recipe upgrade jobs (
upgrade-linux-mainline,upgrade-u-boot,upgrade-opensbi), which use the external recipe-upgrade actions - On-demand comparisons such as
ptest-kvm-compare - Repository checks run on push (
lint-board-files,lint-workflows,unit-tests,validate-manifests)
The build and test pipelines target some combination of:
- Packages whose test suites are known to have intermittent failure issues when
run on
qemuriscv64in the Yocto Project Autobuilder - Board support packages (BSPs) provided by the meta-riscv layer for various RISC-V development boards
The actions directory holds local composite actions shared by the workflows
(machine discovery, TFTP deployment, running board tests, etc.), and
scripts/machine-info queries boards/machines.tsv from workflow steps.
The bitbake-configs directory contains templates for running Yocto-specific
workflows, while the dockerfiles directory contains definitions for the
container-builder, kernel-builder, labgrid-operator, qemu-builder, and
yocto-builder container images
stored in the registry.
For the list of runners, repository secrets, and repository variables these workflows expect, see docs/runners.md. It also contains a migration checklist for spinning boardgarden up on a fresh Forgejo instance.
The Labgrid strategies, pytest fixtures, manifest schema and templates shared
by every board come from
labgrid-boardkit, a separate
package that pyproject.toml depends on. The fundamental actions used (such
as setting a TFTP server's IP address on the U-Boot prompt) are more or less
the same across boards, so they live there rather than here. To work on both
at once, point the labgrid-boardkit source in pyproject.toml at a local
clone with { path = "<clone>", editable = true }.
Assuming you have uv installed, you can set up the Python virtual environment
with all of the necessary modules by doing uv sync.
Each board is described by a boards/<name>/board.yaml manifest, which is the
source of truth. It names a strategy family (tftp, sdmux, fastboot, or
qemu) and can inherit shared SoC defaults from boards/families/. The
Labgrid client.yaml (plus client-<variant>.yaml for any variants) and the
boards/machines.tsv index used by the workflows are generated from it, so
don't edit those by hand:
uv run boardkit-validatechecks manifests against the JSON schemauv run boardkit-renderregenerates the outputs (--checkfails if anything is out of date, as CI does)
See docs/onboard-a-board.md for adding a new board end-to-end.
Using the board configurations will depend on how you have structured your
Labgrid deployment (see the docs
for more details). In addition, you may need to make some basic changes to the
default bootloaders and operating systems in place before beginning to use the
Labgrid configurations for automation. For example, muse-pi-pro keeps an
Armbian installation on eMMC as a fallback
even though it boots test images from an SD Mux. Vendor U-Boot environments
include default settings (such as autoboot wait times) that you may want to
change before deployment - please ensure that you review them.
As an example, once you have created a place called
tg-muse-pi-pro and exported the corresponding resources in
boards/muse-pi-pro/exporter.yaml with an appropriate matching pattern, you
should be able to invoke the labgrid CLI using uv run, e.g.:
uv run labgrid-client -p tg-muse-pi-pro acquireuv run labgrid-client -p tg-muse-pi-pro -c boards/muse-pi-pro/client.yaml -s sd con
Or, if you want to run the test suite, you can do:
uv run labgrid-client -p tg-muse-pi-pro acquireuv run pytest -vvv --html=report.html --self-contained-html boards/muse-pi-pro
These same general concepts are employed by the pipelines inside the
.forgejo/workflows directory, so that should be considered a more complete
reference.
Unit files for running the Labgrid coordinator and exporter processes on one or more systems. See systemd_services/README.md for install steps and configuration.
Provisioning for boardgarden's container hosts — the start of migrating bare-metal services (tftpd-hpa, the report file server, the Labgrid coordinator, Forgejo) to containers, one service at a time. See ansible/README.md.
udev rules for the Labgrid exporter hosts:
90-copilot.rules: GPIO and tty symlinks for the BayLibre Copilot board, which provides remote power control and the serial console (UART) for boards under test90-spacemit-fastboot.rules: access to SpacemiT devices in USB download mode, for fastboot flashing99-gpio.rules: sysfs GPIO permissions, and a flag for selecting the legacy sysfs gpiochip node in board match rules
These have only been deployed thus far on Debian-based systems, where the
/sys/class/gpio path exists and the necessary Linux kernel configuration is
enabled.
- onboard-a-board.md: adding a new board, from manifest to CI
- k3-fastboot-setup.md: hardware and exporter setup for fastboot-flashing the K3 Pico-ITX
- runners.md: Forgejo runners, secrets, and variables
- bom.md: machines and services in the farm (generated)
Unit tests for the common package (manifest loading, rendering, validation,
strategies) live in tests/ and don't need hardware:
uv run pytest testsLinting uses ruff (in the dev dependency
group) via pre-commit; run pre-commit install to
enable the hooks locally.
