2022-11-07 22:39:52 +00:00
|
|
|
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
|
2022-11-07 18:24:48 +00:00
|
|
|
@@ -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;
|
|
|
|
+
|
2022-11-07 22:39:52 +00:00
|
|
|
+#ifdef CONFIG_FIT_PARTITION
|
|
|
|
+ index <<= 2;
|
|
|
|
+#endif
|
2022-11-07 18:24:48 +00:00
|
|
|
+
|
|
|
|
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);
|
|
|
|
}
|
2022-11-07 22:39:52 +00:00
|
|
|
}
|
|
|
|
|