[PATCH 06/11] test: Move EFI image-creation to its own file
Simon Glass
sjg at chromium.org
Mon May 18 00:51:04 CEST 2026
Move setup_efi_image() to its own module.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
test/py/img/efi.py | 33 +++++++++++++++++++++++++++++++++
test/py/tests/test_ut.py | 25 +------------------------
2 files changed, 34 insertions(+), 24 deletions(-)
create mode 100644 test/py/img/efi.py
diff --git a/test/py/img/efi.py b/test/py/img/efi.py
new file mode 100644
index 00000000000..1327a2be6ce
--- /dev/null
+++ b/test/py/img/efi.py
@@ -0,0 +1,33 @@
+# 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(ubman):
+ """Create a 20MB disk image with an EFI app on it"""
+ devnum = 1
+ fsh = FsHelper(ubman.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(ubman.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(ubman.config, devnum, 'flash', True)
+ img.add_fs(fsh, DiskHelper.VFAT)
+ img.create()
+ fsh.cleanup()
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 9e571304dee..4736b92ca13 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -24,6 +24,7 @@ from img.fedora import setup_fedora_image
from img.armbian import setup_bootmenu_image
from img.chromeos import setup_cros_image
from img.android import setup_android_image
+from img.efi import setup_efi_image
def setup_cedit_file(ubman):
@@ -79,30 +80,6 @@ def test_ut_dm_init(ubman):
fh.write(data)
-def setup_efi_image(ubman):
- """Create a 20MB disk image with an EFI app on it"""
- devnum = 1
- fsh = FsHelper(ubman.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(ubman.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(ubman.config, devnum, 'flash', True)
- img.add_fs(fsh, DiskHelper.VFAT)
- img.create()
- fsh.cleanup()
-
-
def setup_rauc_image(ubman):
"""Create a 40MB disk image with an A/B RAUC system on it"""
mmc_dev = 10
--
2.43.0
More information about the U-Boot
mailing list