diff options
Diffstat (limited to 'recipes-containers/vcontainer/vcontainer-tarball.bb')
| -rw-r--r-- | recipes-containers/vcontainer/vcontainer-tarball.bb | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/recipes-containers/vcontainer/vcontainer-tarball.bb b/recipes-containers/vcontainer/vcontainer-tarball.bb index ee3c1147..f943cfd0 100644 --- a/recipes-containers/vcontainer/vcontainer-tarball.bb +++ b/recipes-containers/vcontainer/vcontainer-tarball.bb | |||
| @@ -50,6 +50,15 @@ TOOLCHAIN_TARGET_TASK = "" | |||
| 50 | TARGET_ARCH = "none" | 50 | TARGET_ARCH = "none" |
| 51 | TARGET_OS = "none" | 51 | TARGET_OS = "none" |
| 52 | 52 | ||
| 53 | # Must use ${SDK_ARCH}-${SDKPKGSUFFIX} (e.g. x86_64-nativesdk) to match | ||
| 54 | # the pattern explicitly listed in SSTATE_ARCHS, which SPDX's find_jsonld() | ||
| 55 | # searches when locating the static recipe SPDX document generated by | ||
| 56 | # do_create_recipe_spdx. Using ${SDK_ARCH}_${SDK_OS} (x86_64_linux) is NOT | ||
| 57 | # in SSTATE_ARCHS and causes do_create_spdx to fatal with "Could not find a | ||
| 58 | # static SPDX document named static-vcontainer-tarball". | ||
| 59 | # See: meta/classes-global/sstate.bbclass SSTATE_ARCHS definition and | ||
| 60 | # buildtools-tarball.bb for the reference pattern. | ||
| 61 | |||
| 53 | # Host tools to include via SDK | 62 | # Host tools to include via SDK |
| 54 | # Note: nativesdk-qemu-vcontainer is a minimal QEMU without OpenGL/virgl | 63 | # Note: nativesdk-qemu-vcontainer is a minimal QEMU without OpenGL/virgl |
| 55 | # to avoid mesa -> llvm -> clang build dependency chain | 64 | # to avoid mesa -> llvm -> clang build dependency chain |
| @@ -66,7 +75,7 @@ SDK_TITLE = "vcontainer tools (vdkr/vpdmn)" | |||
| 66 | 75 | ||
| 67 | # SDK configuration (same pattern as buildtools-tarball) | 76 | # SDK configuration (same pattern as buildtools-tarball) |
| 68 | MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}" | 77 | MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}" |
| 69 | PACKAGE_ARCH = "${SDK_ARCH}_${SDK_OS}" | 78 | PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}" |
| 70 | PACKAGE_ARCHS = "" | 79 | PACKAGE_ARCHS = "" |
| 71 | SDK_PACKAGE_ARCHS += "vcontainer-dummy-${SDKPKGSUFFIX}" | 80 | SDK_PACKAGE_ARCHS += "vcontainer-dummy-${SDKPKGSUFFIX}" |
| 72 | 81 | ||
| @@ -131,6 +140,25 @@ VCONTAINER_ARCHITECTURES ?= "x86_64 aarch64" | |||
| 131 | 140 | ||
| 132 | # Conditionally set mcdepends based on available multiconfigs | 141 | # Conditionally set mcdepends based on available multiconfigs |
| 133 | # (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. | ||
| 134 | python () { | 162 | python () { |
| 135 | bbmulticonfig = (d.getVar('BBMULTICONFIG') or "").split() | 163 | bbmulticonfig = (d.getVar('BBMULTICONFIG') or "").split() |
| 136 | mcdeps = [] | 164 | mcdeps = [] |
| @@ -138,6 +166,8 @@ python () { | |||
| 138 | if mc in bbmulticonfig: | 166 | if mc in bbmulticonfig: |
| 139 | mcdeps.append('mc::%s:vdkr-initramfs-create:do_deploy' % mc) | 167 | mcdeps.append('mc::%s:vdkr-initramfs-create:do_deploy' % mc) |
| 140 | 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) | ||
| 141 | if mcdeps: | 171 | if mcdeps: |
| 142 | d.setVarFlag('do_populate_sdk', 'mcdepends', ' '.join(mcdeps)) | 172 | d.setVarFlag('do_populate_sdk', 'mcdepends', ' '.join(mcdeps)) |
| 143 | 173 | ||
| @@ -307,8 +337,9 @@ Quick Start: | |||
| 307 | Architectures included: ${ARCHITECTURES} | 337 | Architectures included: ${ARCHITECTURES} |
| 308 | 338 | ||
| 309 | Contents: | 339 | Contents: |
| 310 | init-env.sh - Environment setup script | 340 | init-env.sh - Environment setup script (interactive bash) |
| 311 | vdkr, vdkr-<arch> - Docker CLI wrapper | 341 | environment-setup-ci - CI environment (for yocto-autobuilder-helper) |
| 342 | vdkr, vdkr-<arch> - Docker CLI wrapper | ||
| 312 | vpdmn, vpdmn-<arch> - Podman CLI wrapper | 343 | vpdmn, vpdmn-<arch> - Podman CLI wrapper |
| 313 | vrunner.sh - Shared QEMU runner | 344 | vrunner.sh - Shared QEMU runner |
| 314 | vcontainer-common.sh - Shared CLI code | 345 | vcontainer-common.sh - Shared CLI code |
| @@ -399,6 +430,32 @@ ENVEOF | |||
| 399 | # Create init-env.sh symlink for convenience | 430 | # Create init-env.sh symlink for convenience |
| 400 | ln -sf environment-setup-${REAL_MULTIMACH_TARGET_SYS} ${SDK_OUTPUT}/${SDKPATH}/init-env.sh | 431 | ln -sf environment-setup-${REAL_MULTIMACH_TARGET_SYS} ${SDK_OUTPUT}/${SDKPATH}/init-env.sh |
| 401 | 432 | ||
| 433 | # ----------------------------------------------------------------------- | ||
| 434 | # CI/AutoBuilder environment script | ||
| 435 | # ----------------------------------------------------------------------- | ||
| 436 | # yocto-autobuilder-helper's enable_tools_tarball() parses environment | ||
| 437 | # scripts line-by-line in Python. It only honours lines starting with | ||
| 438 | # "export " at column 0, only substitutes $PATH, and treats "unset " at | ||
| 439 | # column 0 as a removal. It does NOT evaluate shell expressions like | ||
| 440 | # $(...) or variable references like $FOO. | ||
| 441 | # | ||
| 442 | # Rather than adding conditional logic to the interactive bash script, | ||
| 443 | # generate a separate flat file with baked-in absolute paths that the | ||
| 444 | # AB parser can consume directly. SDK relocation rewrites these paths | ||
| 445 | # at install time just like the primary environment-setup-* script. | ||
| 446 | ci_script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-ci | ||
| 447 | cat > $ci_script <<CISCRIPT | ||
| 448 | # vcontainer CI environment — for yocto-autobuilder-helper | ||
| 449 | # Flat export lines with absolute paths; no shell logic. | ||
| 450 | # SDK relocation rewrites these paths at install time. | ||
| 451 | export VCONTAINER_DIR="${SDKPATH}" | ||
| 452 | export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}" | ||
| 453 | export PATH="${SDKPATH}:${SDKPATHNATIVE}/usr/bin:/usr/bin:/bin:\$PATH" | ||
| 454 | # Clean up - unset to avoid confusing other Yocto tools' >> $script | ||
| 455 | unset OECORE_NATIVE_SYSROOT | ||
| 456 | CISCRIPT | ||
| 457 | chmod 755 $ci_script | ||
| 458 | |||
| 402 | # Create version file | 459 | # Create version file |
| 403 | echo "vcontainer SDK version: ${PV}" > ${SDK_OUTPUT}/${SDKPATH}/version.txt | 460 | echo "vcontainer SDK version: ${PV}" > ${SDK_OUTPUT}/${SDKPATH}/version.txt |
| 404 | echo "Built: $(date)" >> ${SDK_OUTPUT}/${SDKPATH}/version.txt | 461 | echo "Built: $(date)" >> ${SDK_OUTPUT}/${SDKPATH}/version.txt |
