openwrt/target/linux/generic/hack-5.10/421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
John Audia 15b9c02d6c kernel: bump 5.10 to 5.10.163
Removed upstreamed:
  generic/101-Use-stddefs.h-instead-of-compiler.h.patch[1]
  bcm27xx/patches-5.10/950-0194-drm-fourcc-Add-packed-10bit-YUV-4-2-0-format.patch

All patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.163&id=ddd2bb08bd99b7ee4442fbbe0f9b80236fdd71d2

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
(cherry picked from commit 2835df54ab)
2023-01-28 20:07:11 +01:00

32 lines
1023 B
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Sat Apr 10 17:00:57 2021 +0200
Subject: [PATCH] mtd: fix squashfs root on targets with CONFIG_FIT_PARTITION
Fix assumption about the block device index
---
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -760,12 +760,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
+
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);
}
}