From 56d9056999cb37012b48221f9a3d8aacb2f0ce54 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Thu, 25 Apr 2024 00:59:38 -0700 Subject: [PATCH] kernel: ubifs: automount ubifs root only when CONFIG_UBIFS_ROOT is set Kernel patches in generic/hack for 5.5, 6.1, and 6.6 that add `CONFIG_UBIFS_ROOT` option to automount rootfs as ubifs rather than using `CONFIG_MTD_ROOTFS_ROOT_DEV` which should only select the appropriate MTD partition and not force any filesystem type or mounting. Add `CONFIG_UBIFS_ROOT=y` to platforms where `FEATURES` included `ubifs` and `MKUBIFS_OPTS` was set (at91, imx, layerscape) Signed-off-by: Tony Butler --- target/linux/at91/sam9x/config-6.6 | 1 + target/linux/at91/sama5/config-6.6 | 1 + target/linux/at91/sama7/config-6.6 | 1 + target/linux/generic/config-6.6 | 1 + .../495-ubi-add-config-UBIFS_ROOT.patch | 50 +++++++++++++++++++ .../495-ubi-add-config-UBIFS_ROOT.patch | 50 +++++++++++++++++++ .../495-ubi-add-config-UBIFS_ROOT.patch | 50 +++++++++++++++++++ target/linux/imx/cortexa9/config-default | 1 + target/linux/layerscape/armv8_64b/config-6.6 | 1 + 9 files changed, 156 insertions(+) create mode 100644 target/linux/generic/hack-5.15/495-ubi-add-config-UBIFS_ROOT.patch create mode 100644 target/linux/generic/hack-6.1/495-ubi-add-config-UBIFS_ROOT.patch create mode 100644 target/linux/generic/hack-6.6/495-ubi-add-config-UBIFS_ROOT.patch diff --git a/target/linux/at91/sam9x/config-6.6 b/target/linux/at91/sam9x/config-6.6 index d5cfa5f7539..0b349052c01 100644 --- a/target/linux/at91/sam9x/config-6.6 +++ b/target/linux/at91/sam9x/config-6.6 @@ -310,6 +310,7 @@ CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y CONFIG_UBIFS_FS=y CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_ROOT=y CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" CONFIG_UNWINDER_ARM=y CONFIG_USB=y diff --git a/target/linux/at91/sama5/config-6.6 b/target/linux/at91/sama5/config-6.6 index 04eee7a210f..6e5f1d295f8 100644 --- a/target/linux/at91/sama5/config-6.6 +++ b/target/linux/at91/sama5/config-6.6 @@ -476,6 +476,7 @@ CONFIG_TINY_SRCU=y CONFIG_TOUCHSCREEN_ATMEL_MXT=y CONFIG_UACCESS_WITH_MEMCPY=y CONFIG_UBIFS_FS=y +CONFIG_UBIFS_ROOT=y CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" CONFIG_UNWINDER_ARM=y CONFIG_USB=y diff --git a/target/linux/at91/sama7/config-6.6 b/target/linux/at91/sama7/config-6.6 index e3455c5e379..21940348e36 100644 --- a/target/linux/at91/sama7/config-6.6 +++ b/target/linux/at91/sama7/config-6.6 @@ -409,6 +409,7 @@ CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y +CONFIG_UBIFS_ROOT=y CONFIG_UACCESS_WITH_MEMCPY=y CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" CONFIG_UNWINDER_ARM=y diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index c8bca0d0ff0..eb378d8c9de 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -6717,6 +6717,7 @@ CONFIG_UBIFS_FS_LZO=y CONFIG_UBIFS_FS_XATTR=y CONFIG_UBIFS_FS_ZLIB=y CONFIG_UBIFS_FS_ZSTD=y +# CONFIG_UBIFS_ROOT is not set # CONFIG_UBSAN is not set CONFIG_UBSAN_ALIGNMENT=y CONFIG_UBSAN_BOOL=y diff --git a/target/linux/generic/hack-5.15/495-ubi-add-config-UBIFS_ROOT.patch b/target/linux/generic/hack-5.15/495-ubi-add-config-UBIFS_ROOT.patch new file mode 100644 index 00000000000..a4d2151095e --- /dev/null +++ b/target/linux/generic/hack-5.15/495-ubi-add-config-UBIFS_ROOT.patch @@ -0,0 +1,50 @@ +From: Tony Butler +Date: Mon, 22 Apr 2024 03:56:21 -0700 +Subject: kernel: ubifs: automount ubifs root only when CONFIG_UBIFS_ROOT is set + +Kernel patches in generic/hack for 5.5, 6.1, and 6.6 that add +`CONFIG_UBIFS_ROOT` option to automount rootfs as ubifs rather than +using `CONFIG_MTD_ROOTFS_ROOT_DEV` which should only select the +appropriate MTD partition and not force any filesystem type or mounting. + +Signed-off-by: Tony Butler +--- + fs/ubifs/Kconfig | 8 ++++++++ + init/do_mounts.c | 4 ++-- + 2 files changed, 10 insertions(+), 2 deletions(-) + +--- a/fs/ubifs/Kconfig ++++ b/fs/ubifs/Kconfig +@@ -98,4 +98,12 @@ config UBIFS_FS_AUTHENTICATION + sha256, these are not selected automatically since there are many + different options. + ++config UBIFS_ROOT ++ bool "UBIFS root file system" ++ depends on UBIFS_FS=y ++ help ++ Enables root file system support using UBIFS. ++ ++ Most people say N here. ++ + endif # UBIFS_FS +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -448,7 +448,7 @@ out: + put_page(page); + } + +-#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++#ifdef CONFIG_UBIFS_ROOT + static int __init mount_ubi_rootfs(void) + { + int flags = MS_SILENT; +@@ -603,7 +603,7 @@ void __init mount_root(void) + return; + } + #endif +-#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++#ifdef CONFIG_UBIFS_ROOT + if (!mount_ubi_rootfs()) + return; + #endif diff --git a/target/linux/generic/hack-6.1/495-ubi-add-config-UBIFS_ROOT.patch b/target/linux/generic/hack-6.1/495-ubi-add-config-UBIFS_ROOT.patch new file mode 100644 index 00000000000..b805c9bd509 --- /dev/null +++ b/target/linux/generic/hack-6.1/495-ubi-add-config-UBIFS_ROOT.patch @@ -0,0 +1,50 @@ +From: Tony Butler +Date: Mon, 22 Apr 2024 03:56:21 -0700 +Subject: kernel: ubifs: automount ubifs root only when CONFIG_UBIFS_ROOT is set + +Kernel patches in generic/hack for 5.5, 6.1, and 6.6 that add +`CONFIG_UBIFS_ROOT` option to automount rootfs as ubifs rather than +using `CONFIG_MTD_ROOTFS_ROOT_DEV` which should only select the +appropriate MTD partition and not force any filesystem type or mounting. + +Signed-off-by: Tony Butler +--- + fs/ubifs/Kconfig | 8 ++++++++ + init/do_mounts.c | 4 ++-- + 2 files changed, 10 insertions(+), 2 deletions(-) + +--- a/fs/ubifs/Kconfig ++++ b/fs/ubifs/Kconfig +@@ -98,4 +98,12 @@ config UBIFS_FS_AUTHENTICATION + sha256, these are not selected automatically since there are many + different options. + ++config UBIFS_ROOT ++ bool "UBIFS root file system" ++ depends on UBIFS_FS=y ++ help ++ Enables root file system support using UBIFS. ++ ++ Most people say N here. ++ + endif # UBIFS_FS +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -447,7 +447,7 @@ out: + put_page(page); + } + +-#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++#ifdef CONFIG_UBIFS_ROOT + static int __init mount_ubi_rootfs(void) + { + int flags = MS_SILENT; +@@ -602,7 +602,7 @@ void __init mount_root(void) + return; + } + #endif +-#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++#ifdef CONFIG_UBIFS_ROOT + if (!mount_ubi_rootfs()) + return; + #endif diff --git a/target/linux/generic/hack-6.6/495-ubi-add-config-UBIFS_ROOT.patch b/target/linux/generic/hack-6.6/495-ubi-add-config-UBIFS_ROOT.patch new file mode 100644 index 00000000000..5e7e50381d4 --- /dev/null +++ b/target/linux/generic/hack-6.6/495-ubi-add-config-UBIFS_ROOT.patch @@ -0,0 +1,50 @@ +From: Tony Butler +Date: Mon, 22 Apr 2024 03:56:21 -0700 +Subject: kernel: ubifs: automount ubifs root only when CONFIG_UBIFS_ROOT is set + +Kernel patches in generic/hack for 5.5, 6.1, and 6.6 that add +`CONFIG_UBIFS_ROOT` option to automount rootfs as ubifs rather than +using `CONFIG_MTD_ROOTFS_ROOT_DEV` which should only select the +appropriate MTD partition and not force any filesystem type or mounting. + +Signed-off-by: Tony Butler +--- + fs/ubifs/Kconfig | 8 ++++++++ + init/do_mounts.c | 4 ++-- + 2 files changed, 10 insertions(+), 2 deletions(-) + +--- a/fs/ubifs/Kconfig ++++ b/fs/ubifs/Kconfig +@@ -98,4 +98,12 @@ config UBIFS_FS_AUTHENTICATION + sha256, these are not selected automatically since there are many + different options. + ++config UBIFS_ROOT ++ bool "UBIFS root file system" ++ depends on UBIFS_FS=y ++ help ++ Enables root file system support using UBIFS. ++ ++ Most people say N here. ++ + endif # UBIFS_FS +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -249,7 +249,7 @@ out: + put_page(page); + } + +-#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++#ifdef CONFIG_UBIFS_ROOT + static int __init mount_ubi_rootfs(void) + { + int flags = MS_SILENT; +@@ -408,7 +408,7 @@ static inline void mount_block_root(char + + void __init mount_root(char *root_device_name) + { +-#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++#ifdef CONFIG_UBIFS_ROOT + if (!mount_ubi_rootfs()) + return; + #endif diff --git a/target/linux/imx/cortexa9/config-default b/target/linux/imx/cortexa9/config-default index 5757c8c8be6..9db26f7155a 100644 --- a/target/linux/imx/cortexa9/config-default +++ b/target/linux/imx/cortexa9/config-default @@ -51,3 +51,4 @@ CONFIG_SOC_IMX6=y CONFIG_SOC_IMX6Q=y CONFIG_SOC_IMX6SL=y CONFIG_SOC_IMX6SX=y +CONFIG_UBIFS_ROOT=y diff --git a/target/linux/layerscape/armv8_64b/config-6.6 b/target/linux/layerscape/armv8_64b/config-6.6 index 3c052edb7d0..3785847f765 100644 --- a/target/linux/layerscape/armv8_64b/config-6.6 +++ b/target/linux/layerscape/armv8_64b/config-6.6 @@ -801,6 +801,7 @@ CONFIG_TRANS_TABLE=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y CONFIG_UBIFS_FS=y +CONFIG_UBIFS_ROOT=y # CONFIG_UCLAMP_TASK is not set CONFIG_UIO=y CONFIG_UIO_AEC=y