kernel: split out mtd hack for CONFIG_FIT_PARTITION + rootfs
[openwrt/openwrt.git] / target / linux / generic / hack-5.10 / 421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat Apr 10 17:00:57 2021 +0200
3 Subject: [PATCH] mtd: fix squashfs root on targets with CONFIG_FIT_PARTITION
4
5 Fix assumption about the block device index
6 ---
7
8 --- a/drivers/mtd/mtdcore.c
9 +++ b/drivers/mtd/mtdcore.c
10 @@ -767,6 +767,9 @@ int add_mtd_device(struct mtd_info *mtd)
11 unsigned int index = mtd->index;
12 pr_notice("mtd: device %d (%s) set to be root filesystem\n",
13 mtd->index, mtd->name);
14 +#ifdef CONFIG_FIT_PARTITION
15 + index <<= 2;
16 +#endif
17 ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
18 }
19