Files
u-boot/test/py/img/efi.py
Simon Glass 3f133727bf test: Move disk images to persistent-data directory
It is annoying to have disk images in the source directory since it
clutters up the working space.

Remove cur_dir=True from DiskHelper calls so disk images are written to
the persistent-data directory instead.

Move scsi.img too (used by the bootstd tests) and mmc6.img (used by the
MBR tests.

Add a few comments as to where the images are used.

This keeps the source tree clean and puts disk images in the same place
as other test data.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-29 16:18:51 +00:00

38 lines
1005 B
Python

# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
"""Create EFI test disk images"""
import os
from fs_helper import DiskHelper, FsHelper
from img.common import mkdir_cond
def setup_efi_image(config):
"""Create a 20MB disk image with an EFI app on it
Args:
config (ArbitraryAttributeContainer): Configuration
"""
devnum = 1
fsh = FsHelper(config, 'vfat', 18, 'flash')
fsh.setup()
efi_dir = os.path.join(fsh.srcdir, 'EFI')
mkdir_cond(efi_dir)
bootdir = os.path.join(efi_dir, 'BOOT')
mkdir_cond(bootdir)
efi_src = os.path.join(config.build_dir,
'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())
fsh.mk_fs()
img = DiskHelper(config, devnum, 'flash')
img.add_fs(fsh, DiskHelper.VFAT)
img.create()
fsh.cleanup()