[PATCH 07/10] test: Pass mkfs -d unconditionally for ext filesystems

Simon Glass sjg at chromium.org
Wed May 6 17:56:21 CEST 2026


Modern e2fsprogs supports the -d flag on mkfs.ext2 and mkfs.ext3 as well
as mkfs.ext4, so use it for all ext variants.

An empty source directory is also harmless, so drop the guard that
omitted -d when nothing has been written into srcdir. Remove the
ValueError branch, which is now unreachable.

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

 test/py/tests/fs_helper.py | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py
index 40cab6dddee..3983d42f5ce 100644
--- a/test/py/tests/fs_helper.py
+++ b/test/py/tests/fs_helper.py
@@ -76,6 +76,8 @@ class FsHelper:
             mkfs_opt = '-F 16'
         elif self.fs_type == 'fat32':
             mkfs_opt = '-F 32'
+        elif self.fs_type.startswith('ext'):
+            mkfs_opt = f'-d {self.srcdir}'
         else:
             mkfs_opt = ''
 
@@ -103,13 +105,6 @@ class FsHelper:
 
         mkfs_opt, fs_lnxtype = self._get_fs_args()
 
-        if src_dir:
-            if fs_lnxtype == 'ext4':
-                mkfs_opt = mkfs_opt + ' -d ' + src_dir
-            elif fs_lnxtype != 'vfat' and fs_lnxtype != 'exfat':
-                raise ValueError(
-                    f'src_dir not implemented for fs {fs_lnxtype}')
-
         size = self.size_mb << 20
         count = (size + SIZE_GRAN - 1) // SIZE_GRAN
 
-- 
2.43.0



More information about the U-Boot mailing list