diff mbox series

[v4,02/10] wic: add runtime dependencies on the tools it invokes

Message ID 20260724090146.19924-3-twoerner@gmail.com
State New
Headers show
Series wic: ship its tools, and add an SDK_FEATURES lever | expand

Commit Message

Trevor Woerner July 24, 2026, 9:01 a.m. UTC
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. Declaring the tools as dependencies pins
known-good versions instead of trusting whatever the host provides.

Add the tools wic runs as RDEPENDS so they are installed alongside it.
resize2fs is listed on its own because e2fsprogs packages it separately
as e2fsprogs-resize2fs, which e2fsprogs does not pull in, and wic needs
it for the cp/write resize path.

grub (grub-mkimage) is used to assemble EFI boot images, and is only
compatible with, and only used by wic on, x86 and aarch64. In particular
grub is not in COMPATIBLE_HOST on arm hard-float, so an unconditional
dependency makes wic unbuildable there and breaks "bitbake world"
(Nothing RPROVIDES 'grub'). Gate grub to the hosts that can build and
use it.

syslinux is only available on x86, so it is gated to those hosts too.
Its bits are split across packages: the syslinux package provides the
isohybrid helper wic runs, syslinux-misc carries the ldlinux.sys,
isohdpfx.bin and ldlinux.c32 data files, and syslinux-isolinux carries
isolinux.bin; wic copies all of these into a hybrid ISO, so all three
are listed. cdrtools (mkisofs) is native-only with no nativesdk variant
and is only needed for ISO images, so it is not listed here.

AI-Generated: codex/claude-opus 4.8 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v4:
- gate grub to x86 and aarch64 (it is not in COMPATIBLE_HOST on arm
  hard-float, which made wic unbuildable and broke bitbake world); move
  syslinux into the same arch-gated appends
- also depend on syslinux-isolinux, which carries isolinux.bin that wic
  copies into a hybrid ISO; the syslinux/syslinux-misc pair alone missed
  it

changes in v3:
- list the tools on all variants rather than only the nativesdk variant

changes in v2:
- merge the tool list from the v1 "wic-tools.inc: add" patch into this
  recipe as RDEPENDS; the separate .inc is dropped
- list the tools inline rather than via a shared WIC_TOOLS variable
- note in the commit log that a host tool may also be the wrong version,
  not merely absent
---
 meta/recipes-support/wic/wic_0.3.1.bb | 30 +++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-support/wic/wic_0.3.1.bb b/meta/recipes-support/wic/wic_0.3.1.bb
index d9b4cc05c4bd..75fa734a9761 100644
--- a/meta/recipes-support/wic/wic_0.3.1.bb
+++ b/meta/recipes-support/wic/wic_0.3.1.bb
@@ -17,4 +17,34 @@  RDEPENDS:${PN} += " \
     python3-misc \
     "
 
+# wic shells out to these host-side tools when it runs, so they must be
+# installed alongside it.
+RDEPENDS:${PN} += " \
+    parted \
+    gptfdisk \
+    dosfstools \
+    mtools \
+    bmaptool \
+    btrfs-tools \
+    squashfs-tools \
+    e2fsprogs \
+    e2fsprogs-resize2fs \
+    util-linux \
+    tar \
+    erofs-utils \
+"
+
+# grub (grub-mkimage) assembles EFI boot images; it is only compatible
+# with, and only used by wic on, x86 and aarch64, so gate it to those
+# hosts. In particular grub is not compatible with arm hard-float, so an
+# unconditional dependency makes wic unbuildable there. syslinux is only
+# available on x86: its installer provides the isohybrid helper wic runs,
+# syslinux-misc carries ldlinux.sys/isohdpfx.bin/ldlinux.c32 and
+# syslinux-isolinux carries isolinux.bin, all of which wic copies into a
+# hybrid ISO.
+RDEPENDS:${PN}:append:x86 = " grub syslinux syslinux-misc syslinux-isolinux"
+RDEPENDS:${PN}:append:x86-64 = " grub syslinux syslinux-misc syslinux-isolinux"
+RDEPENDS:${PN}:append:x86-x32 = " grub syslinux syslinux-misc syslinux-isolinux"
+RDEPENDS:${PN}:append:aarch64 = " grub"
+
 BBCLASSEXTEND = "native nativesdk"