diff mbox series

[v5,1/4] wic bootimg-efi.py: fail build if no binaries installed

Message ID 20250528125635.684302-1-mikko.rapeli@linaro.org
State New
Headers show
Series [v5,1/4] wic bootimg-efi.py: fail build if no binaries installed | expand

Commit Message

Mikko Rapeli May 28, 2025, 12:56 p.m. UTC
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.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 +++++++
 1 file changed, 7 insertions(+)

v5: separated from modular kernel changes, changed from shell "ls" command to
    python glob

Comments

Mathieu Dubois-Briand May 29, 2025, 1:55 p.m. UTC | #1
On Wed May 28, 2025 at 2:56 PM CEST, Mikko Rapeli via lists.openembedded.org wrote:
> 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.
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> ---

Hi Mikko,

It looks like we have a new selftest error:

2025-05-29 06:41:09,920 - oe-selftest - INFO - overlayfs.OverlayFSEtcRunTimeTests.test_image_feature_is_missing (subunit.RemotedTestCase)
2025-05-29 06:41:09,921 - oe-selftest - INFO -  ... FAIL
...
ERROR: core-image-minimal-1.0-r0 do_image_wic: Execution of '/srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1199444/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/temp/run.do_image_wic.2027179' failed with exit code 1
...
| ERROR: No EFI loaders installed to ESP partition. Check that grub-efi, systemd-boot or similar is installed.

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/1649
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1590

Can you have a look please?
Mikko Rapeli May 30, 2025, 8:30 a.m. UTC | #2
Hi,

On Thu, May 29, 2025 at 03:55:56PM +0200, Mathieu Dubois-Briand wrote:
> On Wed May 28, 2025 at 2:56 PM CEST, Mikko Rapeli via lists.openembedded.org wrote:
> > 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.
> >
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> > ---
> 
> Hi Mikko,
> 
> It looks like we have a new selftest error:
> 
> 2025-05-29 06:41:09,920 - oe-selftest - INFO - overlayfs.OverlayFSEtcRunTimeTests.test_image_feature_is_missing (subunit.RemotedTestCase)
> 2025-05-29 06:41:09,921 - oe-selftest - INFO -  ... FAIL
> ...
> ERROR: core-image-minimal-1.0-r0 do_image_wic: Execution of '/srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1199444/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/temp/run.do_image_wic.2027179' failed with exit code 1
> ...
> | ERROR: No EFI loaders installed to ESP partition. Check that grub-efi, systemd-boot or similar is installed.
> 
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/1649
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1590
> 
> Can you have a look please?

Thanks to verbose wic logs I can see from
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/2526606/raw_inline

| DEBUG: _exec_cmd: install -d /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/EFI/BOOT
| DEBUG: ['install', '-d', '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/EFI/BOOT']
| DEBUG: _exec_cmd: output for install -d /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/EFI/BOOT (rc = 0):
| DEBUG: Ignoring missing initrd
| DEBUG: Writing grubefi config /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/EFI/BOOT/grub.cfg
| DEBUG: No boot files defined in IMAGE_EFI_BOOT_FILES
| DEBUG: _exec_cmd: install -d /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot
| DEBUG: ['install', '-d', '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot']
| DEBUG: _exec_cmd: output for install -d /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot (rc = 0):
| DEBUG: Writing syslinux config /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/syslinux.cfg
| DEBUG: SourcePlugin: do_stage_partition: part: <wic.partition.Partition object at 0x7f026ffef230>
| DEBUG: _exec_cmd: install -v -p -m 0644 /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/deploy/images/qemux86-64/bzImage /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/bzImage
| DEBUG: ['install', '-v', '-p', '-m', '0644', '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/deploy/images/qemux86-64/bzImage', '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/bzImage']
| DEBUG: _exec_cmd: output for install -v -p -m 0644 /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/deploy/images/qemux86-64/bzImage /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/bzImage (rc = 0): '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/deploy/images/qemux86-64/bzImage' -> '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/bzImage'
| DEBUG: Installed kernel files:
| '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/deploy/images/qemux86-64/bzImage' -> '/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2677000/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/hdd/boot/bzImage'
| DEBUG: Installed systemd-boot files:
| []
| ERROR: No EFI loaders installed to ESP partition. Check that grub-efi, systemd-boot or similar is installed.

That the ESP partition did not install the EFI loader binary from grub-efi.
I think this is a bug in the build setup for the overayfs test since that
partition would not boot with EFI. I'll check how this can be fixed..

Cheers,

-Mikko
diff mbox series

Patch

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 96c710bf77..e0ee2f7127 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -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")