Regression in auto-mounting mtd squashfs partitions

Felix Fietkau nbd at nbd.name
Sat Apr 10 15:04:28 BST 2021


Hi Daniel,

it seems to me that your commit 2809d0000744 ("kernel: support FIT
partition parser on mtdblock devices") is causing a regression in
mounting squashfs rootfs when CONFIG_FIT_PARTITION is enabled.
The following workaround fixes it, but maybe you can make a better fix,
since you're more familiar with the code.

- Felix

--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -699,9 +699,13 @@ int add_mtd_device(struct mtd_info *mtd)
 	if (!strcmp(mtd->name, "rootfs") &&
 	    IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
 	    ROOT_DEV == 0) {
+		unsigned int index = mtd->index;
 		pr_notice("mtd: device %d (%s) set to be root filesystem\n",
 			  mtd->index, mtd->name);
-		ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
+#ifdef CONFIG_FIT_PARTITION
+		index <<= 1;
+#endif
+		ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
 	}
 
 	return 0;







More information about the openwrt-devel mailing list