[PATCH v4 13/14] test: efi: boot: Set up an image suitable for EFI testing

Simon Glass sjg at chromium.org
Wed Aug 21 04:12:43 CEST 2024


Hi Tom,

On Fri, 16 Aug 2024 at 10:13, Tom Rini <trini at konsulko.com> wrote:
>
> On Thu, Aug 15, 2024 at 02:24:23PM -0600, Simon Glass wrote:
> > Create a new disk for use with tests, which contains the new 'testapp'
> > EFI app specifically intended for testing the EFI loader.
> >
> > Attach it to the USB device, since most testing is currently done with
> > mmc.
> >
> > Initially this image will be used to test the EFI bootmeth.
> >
> > Fix a stale comment in prep_mmc_bootdev() while we are here.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> [snip]
> > +    try:
> > +        loop = mount_image(cons, fname, mnt, 'ext4')
> > +        mounted = True
> > +        efi_dir = os.path.join(mnt, 'EFI')
> > +        mkdir_cond(efi_dir)
> > +        bootdir = os.path.join(efi_dir, 'BOOT')
> > +        mkdir_cond(bootdir)
> > +        efi_src = os.path.join(cons.config.build_dir,
> > +                               f'lib/efi_loader/testapp.efi')
> > +        efi_dst = os.path.join(bootdir, 'BOOTSBOX.EFI')
> > +        with open(efi_src, 'rb') as inf:
> > +            with open(efi_dst, 'wb') as outf:
> > +                outf.write(inf.read())
> > +    except ValueError as exc:
> > +        print(f'Falled to create image, failing back to prepared copy: {exc}')
> > +
> > +    finally:
> > +        if mounted:
> > +            u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt)
> > +        if loop:
> > +            u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop)
>
> Please see
> https://patchwork.ozlabs.org/project/uboot/patch/20240802093322.15240-1-richard@nod.at/
> for inspiration on making this not require sudo.

It's optional, hence the fallback, but I'll need to wait until that
stuff lands as we use common functions.

Regards,
Simon


More information about the U-Boot mailing list