Skip to content

Add MicroBlaze support, QEMU build, and board-listing fixes#4

Merged
sjg20 merged 17 commits into
masterfrom
emp
Apr 3, 2026
Merged

Add MicroBlaze support, QEMU build, and board-listing fixes#4
sjg20 merged 17 commits into
masterfrom
emp

Conversation

@sjg20
Copy link
Copy Markdown
Owner

@sjg20 sjg20 commented Apr 3, 2026

Summary

This series adds support for running MicroBlaze tests and improves the
board-listing and test infrastructure.

The main change is a new qemu-build setup component that builds QEMU from
source. Ubuntu's QEMU packages (currently 8.2) do not include the
amd-microblaze-v-generic machine type, which was added in QEMU 10.0.
Running uman setup qemu-build clones the QEMU repo, builds it with all
the targets needed for U-Boot testing, and places the binaries in
~/dev/qemu/build. This path is automatically added to PATH during test
runs, so no manual configuration is needed.

Along the way, several issues with the pytest board-listing and test-launch
flow were fixed:

  • buildman was called by name in some places instead of via
    get_buildman(), so it failed when not on PATH but available via
    $UBOOT_TOOLS
  • um py -l now includes MicroBlaze boards and bails early with a useful
    error when the board database is empty, instead of repeating "No matching
    boards found" three times
  • OPENSBI firmware is now set for MicroBlaze boards (they use a RISC-V QEMU
    emulator) and passed to the build step so u-boot.itb can be linked
  • The QEMU binary check is skipped when the hook config contains unexpanded
    shell variables (e.g. qemu-system-riscv${VERSION})
  • When pytest fails with a "Lab failure", the test log is parsed and a hint
    is shown pointing to the actual error (e.g. "unsupported machine type")
    with a suggestion to run uman setup qemu-build

sjg20 and others added 17 commits March 16, 2026 14:15
Some places use a bare 'buildman' command which fails when buildman
is not on the PATH but is available via $UBOOT_TOOLS.

Use get_buildman() consistently so the UBOOT_TOOLS path is always
used when set.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Some test hook configs (e.g. MicroBlaze) use shell variables in the
qemu_binary setting like 'qemu-system-riscv${VERSION}'. These cannot
be resolved without evaluating the full shell script.

Skip the QEMU binary check when the name contains unexpanded shell
variables rather than failing with a confusing error.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
MicroBlaze boards use a RISC-V QEMU emulator and need OPENSBI
firmware, but the board name does not contain 'riscv' so the
OpenSBI environment setup is skipped.

Match 'mbv' in addition to 'riscv' to set OPENSBI, and use the
32-bit firmware for mbv32 boards. Pass the pytest environment to
the build step so OPENSBI is available during compilation.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
The Ubuntu QEMU packages do not include all machine types needed
for U-Boot testing (e.g. amd-microblaze-v-generic).

Add a 'qemu-build' setup component that clones the QEMU git repo
to ~/dev/qemu, installs build dependencies, configures with the
targets needed for U-Boot testing, and builds. The binaries are in
~/dev/qemu/build.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Container creation involves several slow steps (downloading the image,
installing packages, setting up Claude Code) with no feedback.

Add tout.progress() calls for each major step so the user can see what
is happening. These show as green transient status lines on TTYs and
are cleared before launching the shell.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When debugging U-Boot with 'um py -G', a restart causes GDB to lose
the remote connection. The user must then manually type the reconnect
and continue commands each time.

Add a gdb_monitor() function that runs GDB in a pseudo-terminal to
monitor its output. When 'Remote connection closed' appears, it
automatically sends 'target remote' and 'c' to resume the session.
This replaces the previous os.execvp() approach, and also handles
terminal resizing (SIGWINCH) properly.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test subcommand has no way to debug tests under gdb. The py
subcommand supports -g for gdbserver, but for direct sandbox tests a
simpler approach works: run the sandbox executable directly under
gdb-multiarch with the test arguments passed via -ex 'run ...'.

Add a -g/--gdb flag to the test subcommand that launches gdb-multiarch
with quiet mode, auto-load safe path, debuginfod disabled, SIGUSR2
handling, and a 'run' command pre-loaded with the sandbox arguments.
This supports dry-run mode as well.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When debugging a crash it is useful to get an automatic backtrace
without having to interact with gdb. Also, other gdb commands may be
useful after a test stops.

Add --bt to automatically run 'bt' and 'quit' after the program stops,
providing a quick backtrace on segfault. Add --gdb-cmd as a repeatable
option to pass arbitrary -ex commands to gdb after the 'run'. Both
options imply -g.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When debugging or navigating a U-Boot build, it is useful to quickly
find where a function is defined without searching the source tree
manually.

Add -f/--find to the config subcommand. It uses nm to find matching
symbols in the u-boot binary and addr2line to resolve each to a source
file and line number. The pattern is a substring match, so '-f do_mem'
shows all functions containing 'do_mem'.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The config subcommand cannot trigger a build before its actions, so the
user must manually build first before using -f or -g.

Add -b/--build and the common build options (via add_build_opts()) to
the config subparser. This allows e.g. 'um cfg -b -f do_version' to
build and then look up the function in one step.

The add_build_opts() helper gains a skip_short parameter so that
subparsers with conflicting short flags (here -f is used by --find) can
exclude them while keeping the long form available.

The config-specific --build-dir is replaced by the common -o/--output-dir
from add_build_opts() to avoid duplication.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The DWARF paths in the binary come from the build environment, which
may differ from the local source tree (e.g. when building in a
container). This makes the output hard to use for navigation.

Strip the build prefix by finding the longest relative suffix of each
addr2line path that exists as a file in the local source tree. When no
source tree is available, the full path is shown as before.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test subcommand supports --bt and -x/--gdb-cmd for passing extra
commands to gdb, but the py subcommand does not.

Add the same options to the py subparser. Since -x is already taken by
--exitfirst in the shared test options, only the long form --gdb-cmd is
available for py. Both --bt and --gdb-cmd imply -G, so a separate -g
session is still needed in another terminal.

Also fix make_args() in tests to include leak_check, bt, and gdb_cmd
fields, fixing 7 pre-existing test failures.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CI remote is hardcoded to 'ci', so pushing to a different GitLab
instance (e.g. mainline U-Boot) requires manually specifying the remote
each time.

Add a multi-level lookup for the CI remote: first -r/--remote on the
command line, then the ci_remote setting, then auto-detection from the
branch's ancestry. Auto-detection checks the branch's upstream tracking
ref, then walks the commit history looking for the nearest remote
tracking branch on a well-known branch (next, master, main).

Since the detected upstream remote may not be the one to push to (e.g.
'us' is read-only), add a ci_remote_map setting that maps upstream
remotes to push remotes (e.g. 'us:dm'). Falls back to 'ci' if nothing
is found.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The -b/--build flag is defined separately in each subparser (test, py,
cfg), so it appears in the main options section of the help output
rather than with the other build options.

Move it into add_build_opts() so it appears in the 'build options'
group alongside -a, -f, -F, -j, -L, -o, -T and --no-trace-early.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The help text for -l says 'List available QEMU boards' but it actually
lists QEMU, MicroBlaze, m68k, and sandbox boards.

Update the help text to say 'List available QEMU and sandbox boards'.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These commands only accept numeric arguments, so editing a specific
commit requires counting its position from HEAD or upstream.

Allow a commit hash to be used instead:

- rf <hash>: rebase from the parent of that commit, editing it first
- rp <hash>: rebase to upstream, editing the matching commit
- rn <hash>: during a rebase, skip to the matching commit in the todo
- rd <hash>: diff against that commit directly

For rp, a sequence editor matches the hash against todo lines. For rn,
the hash is matched against the todo file inline. For rd, the hash is
used directly with git difftool.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Running 'um git' with no action shows an error message, giving no
indication of what actions are available. The -h output lists them
but in a dense, hard-to-read format.

Show a formatted table of all actions with their short name, long name,
and description when no action is given.

Co-developed-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sjg20 sjg20 changed the title Emp Add MicroBlaze support, QEMU build, and board-listing fixes Apr 3, 2026
@sjg20 sjg20 merged commit cc3cdc5 into master Apr 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant