fs/ext2: fixes for ext2r0 with host-e2fsprogs >= 1.47.2

Since Buildroot commit [1] "package/e2fsprogs: bump version to
1.47.2", running the runtime test tests.fs.test_ext.TestExt2 with the
command:

    utils/docker-run support/testing/run-tests \
        -d dl -o output_folder \
        tests.fs.test_ext.TestExt2
    tail output_folder/TestExt2-build.log

Fails with error in the log:

    mkfs.ext2: the -r option has been removed.

    If you really need compatibility with pre-1995 Linux systems, use the
    command-line option "-E revision=0".

Upstream commit [2] "tune2fs: replace the -r option with -E
revision=<fs-rev>" removed this option.

This commit fixes the issue by using the new form with -E. Also,
BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS has a default value to "-O
^64bit". Passing a "-O ..." option now generates an error when a
ext2r0 filesystem is created (because this revision does not support
ext2 filesystem feature options). This commit sets this default value
only if BR2_TARGET_ROOTFS_EXT2_2r0 is not set.

Fixes: [3]

[1] db459859fa
[2] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=3fffe9dd6be5a5ed77755cf23c267b4afd1e7651
[3] https://gitlab.com/buildroot.org/buildroot/-/jobs/8830670170

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Julien Olivain
2025-01-13 21:02:24 +01:00
committed by Peter Korsgaard
parent b2ae9d0acd
commit 51e6e87053
2 changed files with 5 additions and 3 deletions

View File

@@ -85,7 +85,8 @@ config BR2_TARGET_ROOTFS_EXT2_RESBLKS
config BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS
string "additional mke2fs options"
default "-O ^64bit"
# Note: ext2 rev0 does not support filesystem options.
default "-O ^64bit" if !BR2_TARGET_ROOTFS_EXT2_2r0
help
Specify a space-separated list of mke2fs options, including
any ext2/3/4 filesystem features.
@@ -100,7 +101,8 @@ config BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS
support. This default value has been chosen because U-Boot
versions before 2017.02 don't support this filesystem
option: using it may make the filesystem unreadable by
U-Boot.
U-Boot. Note: this default does not apply to the old ext2
(rev0) which does not support filesystem options.
choice
prompt "Compression method"

View File

@@ -18,7 +18,7 @@ ROOTFS_EXT2_LABEL = $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL))
ROOTFS_EXT2_OPTS = \
-d $(TARGET_DIR) \
-r $(BR2_TARGET_ROOTFS_EXT2_REV) \
-E revision=$(BR2_TARGET_ROOTFS_EXT2_REV) \
-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
-m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
-L "$(ROOTFS_EXT2_LABEL)" \