[OpenWrt-Devel] Squashfs breakage lottery with UBI WAS: [PATCH RFC 2/2] amp821xx: use newly added pad-squashfs for Meraki MR24
Christian Lamparter
chunkeey at gmail.com
Fri Aug 23 17:01:52 EDT 2019
On Thursday, August 22, 2019 1:00:21 PM CEST Russell Senior wrote:
>
> Using pad-squashfs ensures that the root.squashfs is assigned sufficient
> LEBs on UBI such that all reads of the rootfs succeed, in order to avoid
> read failures and kernel panics.
>
> This fixes one such kernel panic observed on Meraki MR24 where an
> inopportune-sized unpadded root.squashfs occurred.
>
> Note: ext4-sysupgrade firmware binaries will build with this patch, but
> they are as nonsensical as before the patch. Finding a way to disable
> ext4 builds for Meraki MR24 is left as a TODO.
>
> Signed-off-by: Russell Senior <russell at personaltelco.net>
> ---
> target/linux/apm821xx/image/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile
> index acfd478755..53192bb448 100644
> --- a/target/linux/apm821xx/image/Makefile
> +++ b/target/linux/apm821xx/image/Makefile
> @@ -133,7 +133,8 @@ define Device/meraki_mr24
> IMAGE_SIZE := 8191k
> KERNEL := kernel-bin | lzma | uImage lzma | MerakiAdd-dtb | MerakiNAND
> KERNEL_INITRAMFS := kernel-bin | lzma | dtb | MuImage-initramfs lzma
> - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
> + IMAGE/sysupgrade.bin/squashfs := pad-squashfs | sysupgrade-tar | append-metadata
> + IMAGE/sysupgrade.bin/ext4 := sysupgrade-tar | append-metadata
> UBINIZE_OPTS := -E 5
> SUPPORTED_DEVICES += mr24
> endef
>
I've posted a similar message to the bugreport:
<https://bugs.openwrt.org/index.php?do=details&task_id=2460>
What's happening here is that mksquashfs4 is being told through the "-nopad" option
to "do not pad filesystem to a multiple of 4K" [0].
|define Image/mkfs/squashfs
| $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
| -nopad -noappend -root-owned \
| -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
| -processors 1
|endef
My guess is that this affects more than just the MR24 (I'm looking at you too:
pad2jffs and various pad-to $value) . I've tried tracking down the change that
added the "-nopad" and found it in a commit from 2005 titled:
"add some changes from whiterussian to head" [1] [2]:
| $(KDIR)/root.squashfs:
| @mkdir -p $(KDIR)/root/jffs
|- $(STAGING_DIR)/bin/mksquashfs-lzma $(KDIR)/root $@ -noappend -root-owned -le
|+ $(STAGING_DIR)/bin/mksquashfs-lzma $(KDIR)/root $@ -nopad -noappend -root-owned -le
So, this is really old...
Question is, should we just drop the -nopad? Since as you established, in
the described corner-case (see above) squashfs needs this 4k padding and
the generated squashfs could be considered broken otherwise?
(Judging from your message, you went through the kernel code. Can you
please share the place where the lack of the padding is breaking the fs?)
Cheers,
Christian
[0] <https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=include/image.mk;h=5d54bc7947e692dacd7b4e4e2e845b0e824bfc30;hb=HEAD#l243>
[1] <https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=0be45c47c09746d42936e61b27d8b80f63880dee>
[2] <https://git.openwrt.org/?p=openwrt/openwrt.git;a=blobdiff;f=openwrt/target/linux/image/squashfs.mk;h=70a85b99ee7445329e5f401c46b9f7707fda0e2c;hp=917a69ab8a1bbc5f652b83ce687b0b31db1b0f3c;hb=0be45c47c09746d42936e61b27d8b80f63880dee;hpb=6e6a04539395c2f22b4f8d43404b40aeefba739a>
_______________________________________________
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