wic: give installed wic the tools it needs
v2 cover wic: give installed wic the tools it needs
wic shells out to a range of host-side tools but does not declare them, so wherever it is installed as a package (rather than run from the bitbake do_image_wic task, which has the wic-tools native sysroot on PATH) it works only by chance depending on what the host happens to have installed. This series makes an installed wic carry its own tools and makes putting wic into the SDK an explicit, opt-in choice.
Changes since v1:
- Dropped the wic-tools.inc refactor. With wic no longer added to the SDK by default and the tarball entries removed, there was nothing left to share, so the tool list now lives directly in the wic recipe as RDEPENDS instead of a new .inc.
- buildtools-extended-tarball no longer swaps the parted/dosfstools/ gptfdisk entries for nativesdk-wic; those three tools never belonged in this tarball (it ships build prerequisites, not image helpers), so they are simply removed.
- wic is no longer added to nativesdk-packagegroup-sdk-host unconditionally. It is gated behind a new SDK_INCLUDE_WIC knob (default "no"), since pulling in wic also pulls in the long list of tools it might need.
The wic/wic-tools split and the machine-specific bootloader firmware that wic-tools drags in are left for a separate follow-up.
Trevor Woerner (3):
wic: add runtime dependencies on the tools it invokes buildtools-extended-tarball: drop wic helper tools nativesdk-packagegroup-sdk-host: optionally add wic
.../meta/buildtools-extended-tarball.bb | 3 --- .../nativesdk-packagegroup-sdk-host.bb | 6 +++++ meta/recipes-support/wic/wic_0.3.0.bb | 23 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-)
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
PATCH v2 1/3 wic: add runtime dependencies on the tools it invokes
wic shells out to a number of host-side tools to do its work: parted, mkdosfs, mcopy, the mkfs.* family, sfdisk, e2fsck, resize2fs, debugfs, blkid and more, depending on the operation and on the partition types in the image.
None of these are declared as dependencies of wic. For the bitbake do_image_wic task this is handled by the wic-tools recipe, which builds the tools into a native sysroot. Wherever else wic is installed as a package it gets none of them, and its offline lookup (wic ls/cp/write) resolves each tool over a search path that falls back to the host PATH, so on a machine that happens to have the tool installed system-wide wic succeeds while on a machine without it wic fails:
wic.WicError: Can't find executable 'mcopy'
Falling back to the host is unreliable even when the tool is found: wic depends on specific minimum versions of some of these tools, and an arbitrary host copy may be too old, so wic can pick up a tool that does not behave as it needs. Providing the tools as proper dependencies pins known-good versions rather than leaving it to whatever the host has.
Add the tools as RDEPENDS so they are installed alongside wic and found regardless of the host. They are added to the nativesdk variant only, which is where wic is packaged for use outside a bitbake build; the native and target variants are unaffected (and wic is not expected on a target).
resize2fs is named explicitly: e2fsprogs splits it into its own e2fsprogs-resize2fs package, so nativesdk-e2fsprogs alone does not provide it, and it is needed by the wic cp/write resize path.
syslinux (with its isohybrid helper) is gated to x86 hosts; cdrtools (mkisofs) is native-only with no nativesdk variant and is only needed for ISO images, so it cannot be included here.
AI-Generated: codex/claude-opus 4.8 (xhigh)
--- meta/recipes-support/wic/wic_0.3.0.bb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
meta/recipes-support/wic/wic_0.3.0.bb +23 -0
@@ -17,4 +17,27 @@ RDEPENDS:${PN} += " \ python3-misc \ " +# Pull in the tools wic invokes for the nativesdk variant, where wic is +# packaged for use outside a bitbake build; native and target are +# unaffected. resize2fs is named explicitly as e2fsprogs splits it into +# its own package. +RDEPENDS:${PN}:append:class-nativesdk = " \ + nativesdk-parted \ + nativesdk-gptfdisk \ + nativesdk-dosfstools \ + nativesdk-mtools \ + nativesdk-bmaptool \ + nativesdk-grub \ + nativesdk-btrfs-tools \ + nativesdk-squashfs-tools \ + nativesdk-e2fsprogs \ + nativesdk-e2fsprogs-resize2fs \ + nativesdk-util-linux \ + nativesdk-tar \ + nativesdk-erofs-utils \ +" + +# syslinux (with its isohybrid helper) only builds for x86 hosts. +RDEPENDS:${PN}:append:class-nativesdk = "${@' nativesdk-syslinux nativesdk-syslinux-misc' if d.getVar('SDK_ARCH') in ['x86_64', 'i686'] else ''}" + BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
PATCH v2 2/3 buildtools-extended-tarball: drop wic helper tools
In reply to Trevor WoernerThe extended buildtools tarball exists to make a host with inadequate or ancient software able to run bitbake builds: it provides a compiler, autotools, python3, git, tar and the rest of the build essentials. The things it ships are the build prerequisites a build host is otherwise expected to provide.
nativesdk-parted, -dosfstools and -gptfdisk do not fit that purpose. They are not build prerequisites; they are disk-image helper tools that only make sense for someone assembling or inspecting a .wic image, and they do not belong in the set of essentials this tarball guarantees.
Drop the three entries so the tarball's contents stay limited to what its description promises.
AI-Generated: codex/claude-opus 4.8 (xhigh)
--- meta/recipes-core/meta/buildtools-extended-tarball.bb | 3 --- 1 file changed, 3 deletions(-)
meta/recipes-core/meta/buildtools-extended-tarball.bb +0 -3
@@ -30,9 +30,6 @@ TOOLCHAIN_HOST_TASK += "\ nativesdk-glibc-utils \ nativesdk-glibc-gconvs \ nativesdk-libxcrypt-dev \ - nativesdk-parted \ - nativesdk-dosfstools \ - nativesdk-gptfdisk \ " # gconvs needed for iconv to work in vim builds
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
PATCH v2 3/3 nativesdk-packagegroup-sdk-host: optionally add wic
In reply to Trevor Woernerwic is useful from an installed SDK for assembling or inspecting a wic image, but adding it is not free: nativesdk-wic pulls in the long list of host-side tools it might need (parted, gptfdisk, dosfstools, mtools, bmaptool, grub, btrfs-tools, squashfs-tools, e2fsprogs, util-linux, tar, erofs-utils, and syslinux on x86). Most SDKs do not need any of that, so it should not be forced into the host packagegroup unconditionally.
Add an SDK_INCLUDE_WIC knob, defaulting to "no", that gates nativesdk-wic in the host packagegroup. A configuration that wants wic in its SDK opts in with
SDK_INCLUDE_WIC = "yes"
and gets a working wic, together with the tools it invokes, in the SDK; the default SDK is unchanged.
AI-Generated: codex/claude-opus 4.8 (xhigh)
--- .../packagegroups/nativesdk-packagegroup-sdk-host.bb | 6 ++++++ 1 file changed, 6 insertions(+)
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb +6 -0
@@ -9,6 +9,11 @@ inherit_defer nativesdk PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1" +# wic is useful from an installed SDK for assembling or inspecting a wic +# image, but it is not needed by every SDK, so it is opt-in. Set +# SDK_INCLUDE_WIC = "yes" to add it (it pulls in the tools it invokes). +SDK_INCLUDE_WIC ?= "no" + # autoconf pulls in nativesdk-perl but perl-module-integer is needed to # build some recent linux kernels (5.14+) for arm RDEPENDS:${PN} = "\
@@ -29,6 +34,7 @@ RDEPENDS:${PN} = "\ nativesdk-bison \ nativesdk-flex \ nativesdk-perl-module-integer \ + ${@'nativesdk-wic' if bb.utils.to_boolean(d.getVar('SDK_INCLUDE_WIC')) else ''} \ " RDEPENDS:${PN}:darwin = "\
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a