[PATCH 4/4] test: capsule: Generate capsules through config file

Sughosh Ganu sughosh.ganu at linaro.org
Tue Nov 21 08:00:28 CET 2023


Add logic to generate capsules through a config file while testing the
EFI capsule update functionality. Capsule generation through config
file is enabled on the sandbox variant.

Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
---
 test/py/tests/test_efi_capsule/capsule_gen_binman.dts | 2 ++
 test/py/tests/test_efi_capsule/conftest.py            | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/test/py/tests/test_efi_capsule/capsule_gen_binman.dts b/test/py/tests/test_efi_capsule/capsule_gen_binman.dts
index e8a1858509..c4e9ebac46 100644
--- a/test/py/tests/test_efi_capsule/capsule_gen_binman.dts
+++ b/test/py/tests/test_efi_capsule/capsule_gen_binman.dts
@@ -54,6 +54,7 @@
 		};
 	};
 
+#if !defined(CONFIG_EFI_USE_CAPSULE_CFG_FILE)
 	capsule1 {
 		filename = "Test01";
 		efi-capsule {
@@ -319,3 +320,4 @@
 		};
 	};
 };
+#endif /* CONFIG_EFI_USE_CAPSULE_CFG_FILE */
diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py
index dd41da9284..d3702180ef 100644
--- a/test/py/tests/test_efi_capsule/conftest.py
+++ b/test/py/tests/test_efi_capsule/conftest.py
@@ -87,6 +87,13 @@ def efi_capsule_data(request, u_boot_config):
                    % (u_boot_config.source_dir, u_boot_config.build_dir, data_dir, data_dir, data_dir), shell=True)
         os.environ['PYTHONPATH'] = pythonpath
 
+        capsule_cfg_file_gen = u_boot_config.buildconfig.get('config_efi_use_capsule_cfg_file')
+        if capsule_cfg_file_gen:
+            cfg_file = u_boot_config.source_dir + '/' +  u_boot_config.buildconfig.get('config_efi_capsule_cfg_file')[1:-1]
+            check_call('cd %s; '
+                       '%s/tools/mkeficapsule -f %s'
+                       % (data_dir, u_boot_config.build_dir, cfg_file), shell=True)
+
         # Create a disk image with EFI system partition
         check_call('virt-make-fs --partition=gpt --size=+1M --type=vfat %s %s' %
                    (mnt_point, image_path), shell=True)
-- 
2.34.1



More information about the U-Boot mailing list