[OpenWrt-Devel] [PATCH] brcm2708: add squashfs rootfs image

Christian Lamparter chunkeey at gmail.com
Tue Mar 27 13:42:18 EDT 2018


This patch adds a image with squashfs as the root filesystem.
A rootfs_data partition will be generated on the first boot
and placed inside the rootfs partition (just after the squashfs
image).

advantages:
 - it is possible to migrate from an existing -ext4
   installation and back via sysupgrade.
 - existing partition layout will not be lost.
 - slightly smaller image size.
 - support for attendedsysupgrade

disadvantages:
 - needs f2fs + tools as well. This is because fs-tools decides on the
   blocksize of the sdcard. So either f2fs or ext4 can get choosen as
   the rootfs_data filesystem (depends on the size of the root partition).
 - rootfs_data is placed into the rootfs partition. This makes
   it difficult for tools that expect a /dev/mmc0pX device.
   It also makes it difficult for data recovery tools since they
   might not expect to find a embedded partition or will be
   confused.

For people with existing build configurations: make sure to include mkf2fs
and f2fsck package into the image... Otherwise the new -squashfs image will
boot of a ram-overlay and won't keep the configurations after a reboot.

Cc: Álvaro Fernández Rojas <noltari at gmail.com>
Cc: Paul Spooren <spooren at informatik.uni-leipzig.de>
Cc: Daniel Golle <daniel at makrotopia.org>
Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
Hello Álvaro,

The squashfs image was requested by Paul:
<https://github.com/aparcar/attendedsysupgrade-server/issues/88#issuecomment-365036459>
I'm not sure why, but he hardcoded his tool to only work with "squashfs".
<https://github.com/aparcar/attendedsysupgrade-server/blob/c8684b12d7a0b95222eec8aea20608d2595ce0ed/worker/worker.py#L209>

I've tested this with a raspberrypi model b. But I'm confident the
other targets rpis will work as well. What's your take on this?

Regards,
Christian
---
 target/linux/brcm2708/Makefile           | 5 +++--
 target/linux/brcm2708/bcm2708/config-4.9 | 6 +++++-
 target/linux/brcm2708/bcm2709/config-4.9 | 6 +++++-
 target/linux/brcm2708/bcm2710/config-4.9 | 6 +++++-
 target/linux/brcm2708/image/Makefile     | 1 -
 target/linux/brcm2708/image/cmdline.txt  | 2 +-
 6 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile
index 244513dfc6..870029c4c8 100644
--- a/target/linux/brcm2708/Makefile
+++ b/target/linux/brcm2708/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=brcm2708
 BOARDNAME:=Broadcom BCM27xx
-FEATURES:=ext4 audio usb usbgadget display gpio fpu
+FEATURES:=ext4 audio usb usbgadget display gpio fpu squashfs
 MAINTAINER:=Álvaro Fernández Rojas <noltari at gmail.com>
 SUBTARGETS:=bcm2708 bcm2709 bcm2710
 
@@ -27,7 +27,8 @@ DEFAULT_PACKAGES += \
 	kmod-usb-hid \
 	kmod-sound-core kmod-sound-arm-bcm2835 \
 	kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \
-	brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini
+	brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini \
+	partx-utils mkf2fs e2fsprogs
 
 KERNELNAME:=Image dtbs
 
diff --git a/target/linux/brcm2708/bcm2708/config-4.9 b/target/linux/brcm2708/bcm2708/config-4.9
index dccf85fac3..116dd257dd 100644
--- a/target/linux/brcm2708/bcm2708/config-4.9
+++ b/target/linux/brcm2708/bcm2708/config-4.9
@@ -141,6 +141,11 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_EXT4_FS_SECURITY=y
+# CONFIG_F2FS_CHECK_FS is not set
+CONFIG_F2FS_FS=y
+# CONFIG_F2FS_FS_SECURITY is not set
+CONFIG_F2FS_FS_XATTR=y
+CONFIG_F2FS_STAT_FS=y
 CONFIG_FB=y
 CONFIG_FB_BCM2708=y
 CONFIG_FB_CFB_COPYAREA=y
@@ -342,7 +347,6 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
 CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_SG_POOL=y
 CONFIG_SPARSE_IRQ=y
-# CONFIG_SQUASHFS is not set
 CONFIG_SRCU=y
 # CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_SUSPEND=y
diff --git a/target/linux/brcm2708/bcm2709/config-4.9 b/target/linux/brcm2708/bcm2709/config-4.9
index 71884a5fa1..2571a4dc0a 100644
--- a/target/linux/brcm2708/bcm2709/config-4.9
+++ b/target/linux/brcm2708/bcm2709/config-4.9
@@ -155,6 +155,11 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_EXT4_FS_SECURITY=y
+# CONFIG_F2FS_CHECK_FS is not set
+CONFIG_F2FS_FS=y
+# CONFIG_F2FS_FS_SECURITY is not set
+CONFIG_F2FS_FS_XATTR=y
+CONFIG_F2FS_STAT_FS=y
 CONFIG_FB=y
 CONFIG_FB_BCM2708=y
 CONFIG_FB_CFB_COPYAREA=y
@@ -372,7 +377,6 @@ CONFIG_SG_POOL=y
 CONFIG_SMP=y
 CONFIG_SMP_ON_UP=y
 CONFIG_SPARSE_IRQ=y
-# CONFIG_SQUASHFS is not set
 CONFIG_SRCU=y
 # CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_SUSPEND=y
diff --git a/target/linux/brcm2708/bcm2710/config-4.9 b/target/linux/brcm2708/bcm2710/config-4.9
index d402f4b573..87e0289347 100644
--- a/target/linux/brcm2708/bcm2710/config-4.9
+++ b/target/linux/brcm2708/bcm2710/config-4.9
@@ -162,6 +162,11 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_EXT4_FS_SECURITY=y
+# CONFIG_F2FS_CHECK_FS is not set
+CONFIG_F2FS_FS=y
+# CONFIG_F2FS_FS_SECURITY is not set
+CONFIG_F2FS_FS_XATTR=y
+CONFIG_F2FS_STAT_FS=y
 CONFIG_FB=y
 CONFIG_FB_BCM2708=y
 CONFIG_FB_CFB_COPYAREA=y
@@ -393,7 +398,6 @@ CONFIG_SPARSEMEM_MANUAL=y
 CONFIG_SPARSEMEM_VMEMMAP=y
 CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
 CONFIG_SPARSE_IRQ=y
-# CONFIG_SQUASHFS is not set
 CONFIG_SRCU=y
 # CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_SUSPEND=y
diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile
index 9ea9a07a9d..28dfa70628 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -47,7 +47,6 @@ endef
 
 ### Devices ###
 define Device/Default
-  FILESYSTEMS := ext4
   KERNEL := kernel-bin | kernel-img
   KERNEL_IMG := kernel.img
   IMAGES := sdcard.img.gz
diff --git a/target/linux/brcm2708/image/cmdline.txt b/target/linux/brcm2708/image/cmdline.txt
index 24f4f0c276..c1099afb00 100644
--- a/target/linux/brcm2708/image/cmdline.txt
+++ b/target/linux/brcm2708/image/cmdline.txt
@@ -1 +1 @@
-dwc_otg.lpm_enable=0 console=serial0,115200 kgdboc=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
+dwc_otg.lpm_enable=0 console=serial0,115200 kgdboc=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait
-- 
2.16.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list