MTD: How to get actual image size from MTD partition

Richard Weinberger richard at nod.at
Tue Jul 20 02:40:15 EDT 2021


----- Ursprüngliche Mail -----
> Von: "Pintu Agarwal" <pintu.ping at gmail.com>
> Okay thank you.
> We have tried dm-verity with squashfs (for our rootfs) but we are
> facing some mounting issues.
> [...]
> [    4.697757] device-mapper: init: adding target '0 96160 verity 1
> /dev/mtdblock34 /dev/mtdblock39 4096 4096 12020 8 sha256
> d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681
> aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7'
> [    4.704771] device-mapper: verity: sha256 using implementation
> "sha256-generic"
> [...]
> [    4.727366] device-mapper: init: dm-0 is ready
> [    4.912558] VFS: Cannot open root device "dm-0" or
> unknown-block(253,0): error -5
> 
> The same works with ext4 emulation.
> So, not sure if there are any changes missing w.r.t. squashfs on 4.14 kernel ?

I don't know.

> Anyways, I will create a separate thread for dm-verity issue and keep
> this thread still open for UBI image size issue.
> We may use dm-verify for rootfs during booting, but still we need to
> perform integrity check for other nand partitions and UBI volumes.
> 
> So, instead of calculating the checksum for the entire partition, is
> it possible to perform checksum only based on the image size ?
> Right now, we are still exploring what are the best possible
> mechanisms available for this.

I still don't fully understand what you are trying to achieve.
Is it about cryptographic integrity of your storage or detecting
errors after the flashing process?

But let me advertise ubiblock a second time. If you place your squashfs on
a UBI static volume, UBI knows the exact length and you can checksum it
more easily.

Thanks,
//richard



More information about the Kernelnewbies mailing list