From 55a3356a74bc945ba84ad00a2aa9083006ade89f Mon Sep 17 00:00:00 2001 From: Daniel Rossier Date: Fri, 2 Oct 2026 16:10:46 +0200 Subject: [PATCH 1/2] qemu: stop reconfiguring, and so rebuilding, QEMU on every build `build.sh qemu` recompiled the whole of QEMU each time, even with nothing changed. do_configure is nostamp, so it re-ran ./configure on every invocation, and QEMU's configure starts with `rm -rf build` whenever build/ carries the auto-created-by-configure marker, which it always does after the first run. Every object was thrown away and the make that followed started from an empty build directory. do_configure now records the configure line it used in build/.ib-configure-args and skips ./configure when the line is unchanged. meson/ninja then rebuild incrementally, and still reconfigure themselves when a patch touches a meson.build. The record lives inside build/, so it goes away whenever configure recreates the directory. The target list is now emitted in a fixed order (arm-softmmu before aarch64-softmmu), so alternating virt32 and virt64 does not change the line and trigger a needless reconfigure once both targets are built. A second `build.sh qemu` with no change goes from a full rebuild (about 1m50s) to a few seconds. --- build/meta-qemu/classes/qemu.bbclass | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/build/meta-qemu/classes/qemu.bbclass b/build/meta-qemu/classes/qemu.bbclass index 7d267505cb..21294494c8 100644 --- a/build/meta-qemu/classes/qemu.bbclass +++ b/build/meta-qemu/classes/qemu.bbclass @@ -11,15 +11,32 @@ qemu_do_configure () { # per IB_PLATFORM), but PRESERVE any other arch already built in a prior # run — otherwise meson would drop it. So building arm-softmmu then # aarch64-softmmu (or vice-versa) keeps both qemu-system-* binaries. - tlist="${QEMU_TARGET}" + # The list is always emitted in the same order, so the same set of + # targets gives the same configure line whichever platform is current. + tlist="" for t in arm-softmmu aarch64-softmmu; do - if [ "$t" != "${QEMU_TARGET}" ] && ls build/$t/qemu-system-* >/dev/null 2>&1; then - tlist="$tlist,$t" + if [ "$t" = "${QEMU_TARGET}" ] || ls build/$t/qemu-system-* >/dev/null 2>&1; then + tlist="${tlist:+$tlist,}$t" fi done + # QEMU's configure starts with "rm -rf build" whenever build/ was created + # by a previous configure, so running it again throws away every object + # and forces a full recompile. Only run it when build/ is missing or the + # options changed; otherwise meson/ninja rebuild incrementally on their + # own, including when a patch touches a meson.build. The stamp lives in + # build/, so it disappears whenever configure recreates the directory. + args="--target-list=$tlist ${QEMU_OPTS}" + stamp=build/.ib-configure-args + + if [ -f $stamp ] && [ "$(cat $stamp)" = "$args" ]; then + echo "QEMU already configured (target-list=$tlist), skipping configure" + return + fi + echo "Configuring QEMU (target-list=$tlist)..." - ./configure --target-list=$tlist ${QEMU_OPTS} + ./configure $args + echo "$args" > $stamp } From 87426b4554b53943ca910da1c2dafaa02025cf17 Mon Sep 17 00:00:00 2001 From: Daniel Rossier Date: Sat, 3 Oct 2026 20:21:09 +0200 Subject: [PATCH 2/2] qemu: shorten the configure comments, and set them apart from the code Comment layout only, no change in behaviour. --- build/meta-qemu/classes/qemu.bbclass | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/build/meta-qemu/classes/qemu.bbclass b/build/meta-qemu/classes/qemu.bbclass index 21294494c8..b9062ffa94 100644 --- a/build/meta-qemu/classes/qemu.bbclass +++ b/build/meta-qemu/classes/qemu.bbclass @@ -11,8 +11,9 @@ qemu_do_configure () { # per IB_PLATFORM), but PRESERVE any other arch already built in a prior # run — otherwise meson would drop it. So building arm-softmmu then # aarch64-softmmu (or vice-versa) keeps both qemu-system-* binaries. - # The list is always emitted in the same order, so the same set of - # targets gives the same configure line whichever platform is current. + # + # Fixed order, so the same targets always give the same configure line. + tlist="" for t in arm-softmmu aarch64-softmmu; do if [ "$t" = "${QEMU_TARGET}" ] || ls build/$t/qemu-system-* >/dev/null 2>&1; then @@ -20,12 +21,9 @@ qemu_do_configure () { fi done - # QEMU's configure starts with "rm -rf build" whenever build/ was created - # by a previous configure, so running it again throws away every object - # and forces a full recompile. Only run it when build/ is missing or the - # options changed; otherwise meson/ninja rebuild incrementally on their - # own, including when a patch touches a meson.build. The stamp lives in - # build/, so it disappears whenever configure recreates the directory. + # QEMU's configure wipes build/, so re-running it means a full rebuild. + # Only run it when the options changed; meson/ninja handle the rest. + args="--target-list=$tlist ${QEMU_OPTS}" stamp=build/.ib-configure-args