[Concept,11/24] test/py: Set up an Ubuntu image with space for FDE

Message ID 20251031065439.3251464-12-sjg@u-boot.org
State New
Headers
Series luks: Provide basic support for unlocking a LUKS1 partition |

Commit Message

Simon Glass Oct. 31, 2025, 6:54 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

Update one of the Ubuntu images to provide space for using full-disk
encryption.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/py/img/ubuntu.py    | 11 ++++++++---
 test/py/tests/test_ut.py |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)
  

Patch

diff --git a/test/py/img/ubuntu.py b/test/py/img/ubuntu.py
index 1247ec134d5..c60da4a0c41 100644
--- a/test/py/img/ubuntu.py
+++ b/test/py/img/ubuntu.py
@@ -6,14 +6,19 @@ 
 from img.common import setup_extlinux_image
 
 
-def setup_ubuntu_image(config, log, devnum, basename, version='24.04.1 LTS'):
-    """Create a 20MB Ubuntu disk image with a single FAT partition
+def setup_ubuntu_image(config, log, devnum, basename, version='24.04.1 LTS',
+                       use_fde=False):
+    """Create a Ubuntu disk image with a FAT partition and ext4 partition
+
+    This creates a FAT partition containing extlinux files, kernel, etc. and a
+    separate ext4 partition containing the root disk
 
     Args:
         config (ArbitraryAttributeContainer): Configuration
         log (multiplexed_log.Logfile): Log to write to
         devnum (int): Device number to use, e.g. 1
         basename (str): Base name to use in the filename, e.g. 'mmc'
+        use_fde (bool): True to set up full-disk encryption
     """
     vmlinux = 'vmlinuz-6.8.0-53-generic'
     initrd = 'initrd.img-6.8.0-53-generic'
@@ -44,4 +49,4 @@  label l0r
 	initrd /boot/%s
 ''' % ((version, vmlinux, initrd) * 2)
     setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
-                         script)
+                         script, part2_size=60 if use_fde else 1)
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index b532bdced13..218f5a74ac1 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -83,7 +83,7 @@  def test_ut_dm_init_bootstd(u_boot_config, u_boot_log):
     setup_ubuntu_image(u_boot_config, u_boot_log, 3, 'flash', '25.04')
     setup_localboot_image(u_boot_config, u_boot_log)
     setup_vbe_image(u_boot_config, u_boot_log)
-    setup_ubuntu_image(u_boot_config, u_boot_log, 11, 'mmc')
+    setup_ubuntu_image(u_boot_config, u_boot_log, 11, 'mmc', use_fde=True)
 
 def test_ut(ubman, ut_subtest):
     """Execute a "ut" subtest.