diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-06-12 03:12:36 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-06-12 13:35:03 +0000 |
| commit | 6fc1aa83552713dc03933115890badebb297e4ae (patch) | |
| tree | 67b3518cce15c5591f57f1b3ad3358fb13d86bd4 | |
| parent | 5bd3f928dad9f423a74793cad6a6bda212a12bde (diff) | |
| download | meta-virtualization-6fc1aa83552713dc03933115890badebb297e4ae.tar.gz | |
vcontainer-tarball: track rootfs hash via explicit mcdepends
vcontainer-tarball bundles vdkr and vpdmn rootfs images alongside
the helper scripts into a single-shot SDK tarball. Those rootfs
images live in the vruntime-x86-64 / vruntime-aarch64 multiconfigs
and are pulled into the tarball at do_populate_sdk time from
tmp-<mc>/deploy/images/<machine>/<tool>/<arch>/rootfs.img. For
sstate to behave correctly, the tarball task's hash must reflect
the actual rootfs content.
In practice it didn't. A rootfs content change — adding netavark
to the image, switching the runtime from iptables to nftables —
left consumers of the SDK with a stale runtime even though their
config asked for the new behaviour. Cleansstate of vcontainer-tarball
alone didn't help: the path through the cached intermediates was
serving the old image back.
The recipe was relying on the chain
rootfs-image:do_build
-> initramfs-create:do_compile
-> initramfs-create:do_deploy
-> mcdepends -> tarball:do_populate_sdk
to propagate the rootfs hash. The break is at do_deploy: it reads
its rootfs.img out of DEPLOY_DIR, which is a known sstate sharp edge.
do_deploy can sstate-hit on its own hash while the file it deploys
came from a stale prior run, after which the downstream tarball task
hash is computed against the stale content and also hits cache.
Add a direct mcdepends from do_populate_sdk to
{vdkr,vpdmn}-rootfs-image:do_image_complete for each enabled vruntime
multiconfig. The rootfs-image task's hash now feeds the tarball hash
directly, independent of the intermediate do_deploy step. If a rootfs
content change moves the rootfs-image hash, the tarball is forced to
rebuild. When the chain was already healthy this dep adds nothing
new and costs nothing.
Verified end-to-end:
bitbake vcontainer-tarball -c cleansstate
bitbake vcontainer-tarball
sha256sum tmp/deploy/sdk/vcontainer-standalone.sh
# -> f8e75f947a506202d88a6eb196a3616f5088b11247207beab589e91fb6f2bba7
echo 'IMAGE_INSTALL:append:pn-vpdmn-rootfs-image = " bash"' \
>> conf/local.conf
bitbake vcontainer-tarball
sha256sum tmp/deploy/sdk/vcontainer-standalone.sh
# -> 1e89554500b2a4aaabc149a01f85fad2e78ba35796977469e7fcb1ecf15a856f
Hashes differ — the rootfs content change correctly invalidated the
tarball's sstate hash and produced a fresh build.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | recipes-containers/vcontainer/vcontainer-tarball.bb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/recipes-containers/vcontainer/vcontainer-tarball.bb b/recipes-containers/vcontainer/vcontainer-tarball.bb index 42a13527..7e59c77d 100644 --- a/recipes-containers/vcontainer/vcontainer-tarball.bb +++ b/recipes-containers/vcontainer/vcontainer-tarball.bb | |||
| @@ -140,6 +140,25 @@ VCONTAINER_ARCHITECTURES ?= "x86_64 aarch64" | |||
| 140 | 140 | ||
| 141 | # Conditionally set mcdepends based on available multiconfigs | 141 | # Conditionally set mcdepends based on available multiconfigs |
| 142 | # (avoids parse errors when BBMULTICONFIG is not set, e.g. yocto-check-layer) | 142 | # (avoids parse errors when BBMULTICONFIG is not set, e.g. yocto-check-layer) |
| 143 | # | ||
| 144 | # Two layers of dependency per arch: | ||
| 145 | # | ||
| 146 | # 1. initramfs-create:do_deploy | ||
| 147 | # Task ordering — guarantees the rootfs.img / kernel / initramfs are | ||
| 148 | # staged under tmp-<mc>/deploy/images/<machine>/<tool>/<arch>/ before | ||
| 149 | # do_populate_sdk reads them. | ||
| 150 | # | ||
| 151 | # 2. rootfs-image:do_image_complete | ||
| 152 | # Defence-in-depth for sstate consistency. Without this, a rootfs | ||
| 153 | # content change (e.g. adding netavark, switching iptables -> nftables) | ||
| 154 | # would only invalidate the tarball's sstate hash if it propagates | ||
| 155 | # cleanly through rootfs-image:do_build -> initramfs-create:do_compile | ||
| 156 | # -> initramfs-create:do_deploy -> mcdepends. Any break in that chain | ||
| 157 | # (the DEPLOY_DIR-input sstate pattern is one known way to get a stale | ||
| 158 | # hit) re-introduces the netavark-stale-tarball failure mode. Listing | ||
| 159 | # the rootfs-image task directly puts its hash in our chain regardless | ||
| 160 | # of intermediate propagation, and costs nothing if the chain was | ||
| 161 | # already healthy. | ||
| 143 | python () { | 162 | python () { |
| 144 | bbmulticonfig = (d.getVar('BBMULTICONFIG') or "").split() | 163 | bbmulticonfig = (d.getVar('BBMULTICONFIG') or "").split() |
| 145 | mcdeps = [] | 164 | mcdeps = [] |
| @@ -147,6 +166,8 @@ python () { | |||
| 147 | if mc in bbmulticonfig: | 166 | if mc in bbmulticonfig: |
| 148 | mcdeps.append('mc::%s:vdkr-initramfs-create:do_deploy' % mc) | 167 | mcdeps.append('mc::%s:vdkr-initramfs-create:do_deploy' % mc) |
| 149 | mcdeps.append('mc::%s:vpdmn-initramfs-create:do_deploy' % mc) | 168 | mcdeps.append('mc::%s:vpdmn-initramfs-create:do_deploy' % mc) |
| 169 | mcdeps.append('mc::%s:vdkr-rootfs-image:do_image_complete' % mc) | ||
| 170 | mcdeps.append('mc::%s:vpdmn-rootfs-image:do_image_complete' % mc) | ||
| 150 | if mcdeps: | 171 | if mcdeps: |
| 151 | d.setVarFlag('do_populate_sdk', 'mcdepends', ' '.join(mcdeps)) | 172 | d.setVarFlag('do_populate_sdk', 'mcdepends', ' '.join(mcdeps)) |
| 152 | 173 | ||
