Regression in auto-mounting mtd squashfs partitions

Daniel Golle daniel at makrotopia.org
Sat Apr 10 15:33:16 BST 2021


On Sat, Apr 10, 2021 at 04:04:28PM +0200, Felix Fietkau wrote:
> 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.

No, I just forgot that we are also making assumptions about the mtdblock
device minor number in our own patches...
The fix looks good to me and certainly won't break devices that are
actually making of the new external-data FIT images (as ROOT_DEV is
then set by the FIT block partition parser in a generic way and no
'rootfs' MTD partition exists in that case).

Acked-by: Daniel Golle <daniel at makrotopia.org>

> 
> - 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;
> 
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list