build: auto-build QEMU on a virt BSP build when its binary is missing#298
Merged
Conversation
A fresh tree needed a separate `build.sh qemu` before `st.sh` would run; forgetting it produced a bare "qemu-system-* not found". Make a BSP build bootstrap the emulator instead. build.sh now, before building bsp-so3/bsp-linux on virt32/virt64, checks for qemu/build/qemu-system-<arch> and runs `bitbake qemu` first when it is absent. It is a bootstrap only: an already-built emulator is left untouched, so the inner build loop pays nothing and the qemu-hacking loop stays the explicit `build.sh -x qemu`. Hardware platforms (verdin, rpi4) never run under QEMU and are skipped. Opt out with IB_BUILD_QEMU="0". The check lives in build.sh, not a bitbake dependency: a parse-time os.path.exists() is not part of bitbake's parse-cache key (so it goes stale), and qemu's do_build is nostamp (so a hard dependency would reconfigure+rebuild qemu on every BSP build). A wrapper check reads the real FS state each run. CI sets IB_BUILD_QEMU="0" (it only builds+deploys, never runs the emulator); the lvperf Dockerfiles drop the now-redundant `build.sh -x qemu` step. Docs and local.conf document the knob.
The attach guard's "local modifications not captured" branch called bbwarn and bbfatal, which are not defined as shell functions in the task environment, so the branch exited 127 (command not found) — turning the intended diagnostic into a hard task failure with no message printed. Use echo to stderr for the warning and echo + exit 1 for the abort, matching the codebase convention (bb* shell logging helpers are unavailable here).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the QEMU-emulated platforms (
virt32/virt64), a full BSP build now builds the emulator automatically when it is missing, so a fresh tree is runnable withst.shwithout a separatebuild.sh qemustep.Before this, a fresh checkout hit a bare "qemu-system- not found"* at
st.shunless you remembered tobuild.sh qemufirst (the two-stepbuild.sh -x qemu && build.sh bsp-so3seen in the lvperf Dockerfiles / docs).Behaviour
build.sh, before buildingbsp-so3/bsp-linuxonvirt32/virt64, checks forqemu/build/qemu-system-<arch>and runsbitbake qemufirst when it is absent.build.sh -x qemu.verdin,rpi4) never run under QEMU → skipped.IB_BUILD_QEMU="0"inbuild/conf/local.conf.Why a
build.shcheck and not a bitbake dependencyTwo dead ends ruled out the recipe-level approach:
os.path.exists()in a.bbclassis not part of bitbake's parse-cache key, so the decision goes stale (moving the binary doesn't re-trigger the check — verified).do_build/do_configurearenostamp(for the in-tree updiff hacking workflow), so a hardqemu:do_builddependency would reconfigure + rebuild QEMU on every BSP build.A wrapper check reads the real filesystem state on each invocation — deterministic, and free once QEMU is built.
Other changes
.github/workflows/build.yml) setsIB_BUILD_QEMU="0"in the build+deploy step (it never runs the emulator, so it skips the multi-minute QEMU compile).build.sh -x qemustep.local.conf,build.sh -h,docker/README.mdanduser_guide.rstdocument the knob.Test
sh -n scripts/build.shpasses;build.sh -hrenders.build.sh bsp-so3runs (withbitbakestubbed) confirm: binary absent →bitbake qemuthenbitbake bsp-so3; binary present →bitbake bsp-so3only;IB_BUILD_QEMU=0→bitbake bsp-so3only.bitbake -g bsp-so3parses cleanly.