[Concept,15/24] luks: Encrypt the mmc11 test image

Message ID 20251031065439.3251464-16-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>

Encrypt the ext4 partition in this image so that we can use it for
tests.

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

 test/py/img/common.py | 6 ++++--
 test/py/img/ubuntu.py | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)
  

Patch

diff --git a/test/py/img/common.py b/test/py/img/common.py
index a08744fbb76..01745ce73b3 100644
--- a/test/py/img/common.py
+++ b/test/py/img/common.py
@@ -33,7 +33,7 @@  def copy_partition(ubman, fsfile, outname):
 
 
 def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
-                         script, part2_size=1):
+                         script, part2_size=1, use_fde=False):
     """Create a 20MB disk image with a single FAT partition
 
     Args:
@@ -46,6 +46,7 @@  def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
         dtbdir (str or None): Devicetree filename
         script (str): Script to place in the extlinux.conf file
         part2_size (int): Size of second partition in MB (default: 1)
+        use_fde (bool): True to encrypt the ext4 partition with LUKS1
     """
     fsh = FsHelper(config, 'vfat', 18, prefix=basename)
     fsh.setup()
@@ -80,7 +81,8 @@  def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
     img.add_fs(fsh, DiskHelper.VFAT, bootable=True)
 
     ext4 = FsHelper(config, 'ext4', max(1, part2_size - 30), prefix=basename,
-                    part_mb=part2_size)
+                    part_mb=part2_size,
+                    encrypt_passphrase='test' if use_fde else None)
     ext4.setup()
 
     bindir = os.path.join(ext4.srcdir, 'bin')
diff --git a/test/py/img/ubuntu.py b/test/py/img/ubuntu.py
index c60da4a0c41..58ee9f20277 100644
--- a/test/py/img/ubuntu.py
+++ b/test/py/img/ubuntu.py
@@ -49,4 +49,5 @@  label l0r
 	initrd /boot/%s
 ''' % ((version, vmlinux, initrd) * 2)
     setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
-                         script, part2_size=60 if use_fde else 1)
+                         script, part2_size=60 if use_fde else 1,
+                         use_fde=use_fde)