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

Tom Rini trini at konsulko.com
Fri Aug 16 18:13:11 CEST 2024


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.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240816/534dd582/attachment.sig>


More information about the U-Boot mailing list