wic bootimg-efi.py: fail build if no binaries installed
PATCH v6 1/5 wic bootimg-efi.py: fail build if no binaries installed
With systemd-boot, some builds included correct EFI bootloader binaries and some not. Thus some builds booted and some not. Check that some boot binary was installed so that build fails if none were installed.
--- scripts/lib/wic/plugins/source/bootimg-efi.py | 7 +++++++ 1 file changed, 7 insertions(+)
v6: no chnages
v5: separated from modular kernel changes, changed from shell "ls" command to
python glob
scripts/lib/wic/plugins/source/bootimg-efi.py +7 -0
@@ -367,6 +367,13 @@ class BootimgEFIPlugin(SourcePlugin): else: raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) + + # must have installed at least one EFI bootloader + out = glob(os.path.join(hdddir, 'EFI', 'BOOT', 'boot*.efi')) + logger.debug("Installed systemd-boot files:\n%s" % out) + if not out: + raise WicError("No EFI loaders installed to ESP partition. Check that grub-efi, systemd-boot or similar is installed.") + except KeyError: raise WicError("bootimg-efi requires a loader, none specified")
Signature · 1 line
2.43.0
PATCH v6 2/5 image_types_wic.bbclass: depend on grub-efi and systemd-boot on aarch64, systemd-boot on arm
On x86 family builds, grub and systemd-boot are always included and thus get built and deployed before wic image builds. On aarch64 builds that was not the case. Result is that some builds added systemd-boot binaries to the wic image ESP partition and some not, though bugs in wic plugins contributed here too since missing files were silently ignored. Boot of such images fails since firmware is not able to load the default EFI binaries.
Adding EFI_PROVIDER to WKS_FILE_DEPENDS_BOOTLOADERS is not possible because of parsing order so adding grub-efi and systemd-boot to aarch64 and systemd-boot to arm depends
which makes sure their do_deploy is always executed before wic image is generated. Thus systemd-boot and grub binaries will get copied from deploy directory to the wic image ESP partition, and boot of the images succeeds.
--- meta/classes-recipe/image_types_wic.bbclass | 2 ++ 1 file changed, 2 insertions(+)
v6: no changes
v5: separated from modular kernel/systemd initrd series, os-release
removal added as separate commit
meta/classes-recipe/image_types_wic.bbclass +2 -0
@@ -111,6 +111,8 @@ WKS_FILE_DEPENDS_DEFAULT += "bmaptool-native cdrtools-native btrfs-tools-native # Unified kernel images need objcopy WKS_FILE_DEPENDS_DEFAULT += "virtual/cross-binutils" WKS_FILE_DEPENDS_BOOTLOADERS = "" +WKS_FILE_DEPENDS_BOOTLOADERS:aarch64 = "grub-efi systemd-boot" +WKS_FILE_DEPENDS_BOOTLOADERS:arm = "systemd-boot" WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi"
Signature · 1 line
2.43.0
PATCH v6 3/5 image_types_wic.bbclass: remove os-release from WKS_FILE_DEPENDS_BOOTLOADERS on x86 and x86_64
In reply to Mikko Rapelios-release was needed with UKI generation when this was done using wic plugin but now with separate uki.bbclass wic does not need it anymore.
--- meta/classes-recipe/image_types_wic.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
v6: no changes
meta/classes-recipe/image_types_wic.bbclass +2 -2
@@ -113,8 +113,8 @@ WKS_FILE_DEPENDS_DEFAULT += "virtual/cross-binutils" WKS_FILE_DEPENDS_BOOTLOADERS = "" WKS_FILE_DEPENDS_BOOTLOADERS:aarch64 = "grub-efi systemd-boot" WKS_FILE_DEPENDS_BOOTLOADERS:arm = "systemd-boot" -WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release" -WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux systemd-boot os-release" +WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot" +WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux systemd-boot" WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi" WKS_FILE_DEPENDS ??= "${WKS_FILE_DEPENDS_DEFAULT} ${WKS_FILE_DEPENDS_BOOTLOADERS}"
Signature · 1 line
2.43.0
PATCH v6 4/5 image_types_wic.bbclass: capture verbose wic output by default
In reply to Mikko RapeliCall wic with --debug to capture logs from wic internals so that it's clear which partitions get created and which files get copied where. wic plugins contain for example race conditions which don't install files at all and thus images fail to boot and it's not possible to debug these without something in wic task logs.
As an example core-image-initramfs-boot do_image_wic log is now 576 lines which is not excessive but very important when debugging problems, especially race conditions which are only hit in some builds in CI.
With all issues I have to deal within wic, I always need to apply this change before I get to see any details what wic and its plugins are doing. Thus I strongly believe this verbose outuput should be the default.
--- meta/classes-recipe/image_types_wic.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
v6: no changes but this change helped to resolve issues in v5 series
v5: no changes, v4 caused pseudo aborts on autobuilder
but these are likely fixed now after path inclusion list changes
v4: https://lists.openembedded.org/g/openembedded-core/message/215221
v3: https://lists.openembedded.org/g/openembedded-core/message/214360
meta/classes-recipe/image_types_wic.bbclass +1 -1
@@ -72,7 +72,7 @@ IMAGE_CMD:wic () { if [ -z "$wks" ]; then bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately." fi - BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" -w "$tmp_wic" ${WIC_CREATE_EXTRA_ARGS} + BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create --debug "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" -w "$tmp_wic" ${WIC_CREATE_EXTRA_ARGS} # look to see if the user specifies a custom imager IMAGER=direct
Signature · 1 line
2.43.0
PATCH v6 5/5 image_types_wic.bbclass: add "grub-efi" back to WKS_FILE_DEPENDS_BOOTLOADERS on x86-64
In reply to Mikko RapeliThis was removed by me without good reasons in commit 2f0ef8cd0e61c34e67ad9c7508094da3c23f5fce
"wic bootimg-efi.py: change UKI support from wic plugin to uki.bbclass" and results in grub-efi binaries missing from
genereted ESP partition on qemux86-64.
Fixes oeqa selftest overlayfs.OverlayFSEtcRunTimeTests.test_image_feature_is_missing after wic detects missing EFI loader files on ESP partition.
Test case was passing due qemu syslinux boot using kernel directly from /boot and not using UEFI firmware to boot.
WKS_FILE_DEPENDS_BOOTLOADERS needs to list all EFI loaders because it's used in DEPENDS and thus can't use conditional python macros to select which loader is actually needed in sysroot when wic builds the images and ESP partition.
--- meta/classes-recipe/image_types_wic.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
v6: new changes in series, fixes missing grub-efi binaries
on qemux86-64 overlayfs selftest
meta/classes-recipe/image_types_wic.bbclass +1 -1
@@ -114,7 +114,7 @@ WKS_FILE_DEPENDS_BOOTLOADERS = "" WKS_FILE_DEPENDS_BOOTLOADERS:aarch64 = "grub-efi systemd-boot" WKS_FILE_DEPENDS_BOOTLOADERS:arm = "systemd-boot" WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot" -WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux systemd-boot" +WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux grub-efi systemd-boot" WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi" WKS_FILE_DEPENDS ??= "${WKS_FILE_DEPENDS_DEFAULT} ${WKS_FILE_DEPENDS_BOOTLOADERS}"
Signature · 1 line
2.43.0