Re: Kernel 4.14: Using dm-verity with squashfs rootfs - mounting issue
From: Mikulas Patocka
Date: Wed Jul 21 2021 - 13:10:31 EST
On Wed, 21 Jul 2021, Pintu Agarwal wrote:
> On Tue, 20 Jul 2021 at 17:12, Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
> >
> > Hi
> >
> > Try to set up dm-verity with block size 512 bytes.
> >
> > I don't know what block size does squashfs use, but if the filesystem
> > block size is smaller than dm-verity block size, it doesn't work.
> >
> Okay thank you so much for this clue,
> It seems we are using 65536 as the squashfs block size:
65536 is the compression block size - it is unrelated to I/O block size.
There's a config option SQUASHFS_4K_DEVBLK_SIZE. The documentation says
that it uses by default 1K block size and if you enable this option, it
uses 4K block size.
So, try to set it. Or try to reduce dm-verity block size down to 1K.
> ==> mksquashfs [...] - comp xz -Xdict-size 32K -noI -Xbcj arm -b 65536
> -processors 1
>
> But for dm-verity we are giving block size of 4096
> ==> [ 0.000000] Kernel command line:[..] verity="96160 12020
> d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681 0 "
> rootfstype=squashfs root=/dev/mtdblock34 ubi.mtd=30,0,30 [...]
> root=/dev/dm-0 dm="system none ro,0 96160 verity 1 /dev/mtdblock34
> /dev/mtdblock39 4096 4096 12020 8 sha256
> d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681
> aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
>
> Now, we are checking by giving squashfs block size also as 4096
>
> In case, if this does not work, what else could be the other option ?
> Can we try with initramfs approach ?
Yes - you can try initramfs.
Mikulas
> Thanks,
> Pintu
>