@@ -72,12 +72,30 @@ class WicTestCase(OESelftestTestCase):
if self.td['USE_NLS'] != 'yes':
self.skipTest('wic-tools needs USE_NLS=yes')
- bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils')
+ targets = 'wic-tools core-image-minimal core-image-minimal-mtdutils'
+ # wic copies target bootloader firmware into the images it builds:
+ # grub-efi and systemd-boot from DEPLOY_DIR_IMAGE and syslinux from
+ # the sysroot. Deploy/stage whatever is available on this host arch
+ # so the bootimg_efi / isoimage / pcbios plugins can find it. This
+ # used to be pulled in via wic-tools' DEPENDS, but firmware is a
+ # target artifact rather than a wic host tool, so it is built here.
+ targets += ' ' + ' '.join(self._firmware_recipes())
+ bitbake(targets)
WicTestCase.image_is_ready = True
os.environ['PATH'] = self._get_wic_path()
rmtree(self.resultdir, ignore_errors=True)
+ def _firmware_recipes(self):
+ """Target bootloader firmware wic may copy into images, per host arch."""
+ arch = self.td['HOST_ARCH']
+ recipes = []
+ if arch in ('i586', 'i686', 'x86_64', 'x86-64'):
+ recipes += ['syslinux', 'grub-efi', 'systemd-boot']
+ elif arch == 'aarch64':
+ recipes += ['grub-efi', 'systemd-boot']
+ return recipes
+
def tearDownLocal(self):
"""Remove resultdir as it may contain images."""
if self._old_path is None:
@@ -391,9 +409,15 @@ class Wic(WicTestCase):
@skipIfNotArch(['i586', 'i686', 'x86_64'])
def test_build_artifacts(self):
"""Test wic create directdisk providing all artifacts."""
- bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
- 'wic-tools')
- bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
+ # syslinux (the target bootloader data the bootimg_pcbios plugin
+ # copies from --bootimg-dir) is not staged by wic-tools; build it
+ # into the image and take the bootimg dir from there.
+ config = 'DEPENDS:pn-core-image-minimal += "syslinux"\n'
+ self.append_config(config)
+ bitbake('core-image-minimal')
+ self.remove_config(config)
+ bb_vars = get_bb_vars(['RECIPE_SYSROOT_NATIVE'], 'wic-tools')
+ bb_vars.update(get_bb_vars(['STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
'core-image-minimal'))
bbvars = {key.lower(): value for key, value in bb_vars.items()}
bbvars['resultdir'] = self.resultdir
@@ -494,9 +518,15 @@ class Wic(WicTestCase):
@skipIfNotArch(['i586', 'i686', 'x86_64'])
def test_rootfs_artifacts(self):
"""Test usage of rootfs plugin with rootfs paths"""
- bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
- 'wic-tools')
- bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
+ # syslinux (the target bootloader data the bootimg_pcbios plugin
+ # copies from --bootimg-dir) is not staged by wic-tools; build it
+ # into the image and take the bootimg dir from there.
+ config = 'DEPENDS:pn-core-image-minimal += "syslinux"\n'
+ self.append_config(config)
+ bitbake('core-image-minimal')
+ self.remove_config(config)
+ bb_vars = get_bb_vars(['RECIPE_SYSROOT_NATIVE'], 'wic-tools')
+ bb_vars.update(get_bb_vars(['STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
'core-image-minimal'))
bbvars = {key.lower(): value for key, value in bb_vars.items()}
bbvars['wks'] = "directdisk-multi-rootfs"
@@ -10,10 +10,13 @@ DEPENDS = "\
e2fsprogs-native util-linux-native tar-native erofs-utils-native \
virtual/cross-binutils \
"
-DEPENDS:append:x86 = " syslinux-native syslinux grub-efi systemd-boot"
-DEPENDS:append:x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
-DEPENDS:append:x86-x32 = " syslinux-native syslinux grub-efi"
-DEPENDS:append:aarch64 = " grub-efi systemd-boot"
+# syslinux-native provides the isohybrid host tool that wic runs; it is only
+# available on x86. The target bootloader firmware (syslinux, grub-efi,
+# systemd-boot) that wic copies into an image is deployed by the wic selftest
+# instead, so it is not staged here.
+DEPENDS:append:x86 = " syslinux-native"
+DEPENDS:append:x86-64 = " syslinux-native"
+DEPENDS:append:x86-x32 = " syslinux-native"
INHIBIT_DEFAULT_DEPS = "1"
wic-tools is a meta-recipe whose DEPENDS assemble a native sysroot of the host tools wic runs. Over time it also accumulated target bootloader firmware (syslinux, grub-efi, systemd-boot), which is a different kind of thing: wic copies those artifacts into the images it builds, reading grub-efi and systemd-boot from DEPLOY_DIR_IMAGE and syslinux from the sysroot. They were listed in wic-tools only so that building wic-tools would force the firmware to be built and deployed before the wic oe-selftest ran. That coupling makes wic-tools carry target recipes for the sole benefit of the test suite. Move the firmware out of wic-tools and have the wic oe-selftest build it directly in its setup, gated to the host architectures where each loader is available, matching the arch decorators already on the individual tests. wic-tools keeps syslinux-native, which is the isohybrid host tool wic invokes rather than firmware. No image or SDK builds relied on wic-tools pulling in the firmware; only the oe-selftest did, so this narrows wic-tools to its original purpose of staging wic's host tools. AI-Generated: codex/claude-opus 4.8 (xhigh) Signed-off-by: Trevor Woerner <twoerner@gmail.com> --- changes in v4: - new in v4 - update test_build_artifacts and test_rootfs_artifacts to build syslinux into the image and take the bootimg dir from there, since wic-tools no longer stages target syslinux --- meta/lib/oeqa/selftest/cases/wic.py | 44 ++++++++++++++++++++++++----- meta/recipes-core/meta/wic-tools.bb | 11 +++++--- 2 files changed, 44 insertions(+), 11 deletions(-)