Re: [OE-core] [PATCH v3 10/11] wic bootimg-efi.py: fail build if no binaries installed

Mikko Rapeli
2025-04-15T05:03:51Z

Hi,

On Mon, Apr 14, 2025 at 04:51:18PM -0400, Trevor Woerner wrote:
> On Fri 2025-04-04 @ 07:29:31 PM, 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>
> > ---
> > scripts/lib/wic/plugins/source/bootimg-efi.py | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
> > index 96c710bf77..20b1c36a46 100644
> > --- a/scripts/lib/wic/plugins/source/bootimg-efi.py
> > +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
> > @@ -341,6 +341,9 @@ class BootimgEFIPlugin(SourcePlugin):
> > cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:])
> > out = exec_cmd(cp_cmd, True)
> > logger.debug("systemd-boot files:\n%s" % out)
> > + # must have installed at least one EFI bootloader
> > + out = exec_cmd("ls %s/EFI/BOOT/boot*.efi" % (hdddir), True)
> > + logger.debug("Installed systemd-boot files:\n%s" % out)
> > elif source_params['loader'] == 'uefi-kernel':
> > kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> > if not kernel:
>
> At first glance I do not see how this code is checking for an invalid
> scenario, and then failing the build should it be detected. Or are you
> expecting the build to fail if the "ls" fails?

Yes, the shell commands run in "set -e" and failing "ls" will fail the build.

Cheers,

-Mikko