aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2022-11-07 19:24:48 +0100
committerRafał Miłecki <rafal@milecki.pl>2022-11-21 16:37:24 +0100
commit932378aeb6fa38c922f1d9fdc5791b611594fa05 (patch)
tree09e713d6aeaa7c4fb34d73b4c53c840dd5bd20fd /target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
parentaf20d9d03bbe080fd9b27024acf5fca7bec15e4f (diff)
downloadupstream-932378aeb6fa38c922f1d9fdc5791b611594fa05.tar.gz
upstream-932378aeb6fa38c922f1d9fdc5791b611594fa05.tar.bz2
upstream-932378aeb6fa38c922f1d9fdc5791b611594fa05.zip
kernel: backport support for "linux,rootfs" in DT
This DT property allows marking flash partition that Linux should use as a root device. It's useful for devices that don't use U-Boot and cmdline parser for partitioning. It may be used with "fixed-partitions" or some dynamic partitioning based on flash content. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit d33e49857e3ad76586ebe55334996b15cd45ca1b)
Diffstat (limited to 'target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch')
-rw-r--r--target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch22
1 files changed, 17 insertions, 5 deletions
diff --git a/target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch b/target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
index 2f7da2aaba..1cd0efd624 100644
--- a/target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
+++ b/target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
@@ -7,13 +7,25 @@ Fix assumption about the block device index
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
-@@ -767,6 +767,9 @@ int add_mtd_device(struct mtd_info *mtd)
- unsigned int index = mtd->index;
- pr_notice("mtd: device %d (%s) set to be root filesystem\n",
- mtd->index, mtd->name);
+@@ -758,12 +758,18 @@ int add_mtd_device(struct mtd_info *mtd)
+
+ if (of_find_property(mtd_get_of_node(mtd), "linux,rootfs", NULL) ||
+ (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && !strcmp(mtd->name, "rootfs") && ROOT_DEV == 0)) {
++ unsigned int index = mtd->index;
++
+#ifdef CONFIG_FIT_PARTITION
+ index <<= 2;
+#endif
- ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
++
+ if (IS_BUILTIN(CONFIG_MTD)) {
+- pr_info("mtd: setting mtd%d (%s) as root device\n", mtd->index, mtd->name);
+- ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
++ pr_info("mtd: setting mtd%d (%s) as root device\n", index, mtd->name);
++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
+ } else {
+ pr_warn("mtd: can't set mtd%d (%s) as root device - mtd must be builtin\n",
+- mtd->index, mtd->name);
++ index, mtd->name);
+ }
}