[PATCH 2/3] build,squashfs: switch to squashfs-tools-ng

Paul Spooren mail at aparcar.org
Sun Jun 20 14:35:41 PDT 2021


Let the newly added `squasfs-tools-ng` handle the squashfs file
creation.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 include/image.mk | 23 ++++++++++++++++-------
 tools/Makefile   |  6 +++---
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index a7473abe68..cf43ff1180 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -76,12 +76,13 @@ SQUASHFS_BLOCKSIZE := $(CONFIG_TARGET_SQUASHFS_BLOCK_SIZE)k
 SQUASHFSOPT := -b $(SQUASHFS_BLOCKSIZE)
 SQUASHFSOPT += -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1'
 SQUASHFSCOMP := gzip
-LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
+LZMA_XZ_OPTIONS := -X lc=0,lp=2,pb=2
+BCJ_FILTER:=extreme
 ifeq ($(CONFIG_SQUASHFS_XZ),y)
   ifneq ($(filter arm x86 powerpc sparc,$(LINUX_KARCH)),)
-    BCJ_FILTER:=-Xbcj $(LINUX_KARCH)
+    BCJ_FILTER:=,$(LINUX_KARCH)
   endif
-  SQUASHFSCOMP := xz $(LZMA_XZ_OPTIONS) $(BCJ_FILTER)
+  SQUASHFSCOMP := xz $(LZMA_XZ_OPTIONS)$(BCJ_FILTER)
 endif
 
 JFFS2_BLOCKSIZE ?= 64k 128k
@@ -226,10 +227,18 @@ $(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S))))
 $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))))
 
 define Image/mkfs/squashfs-common
-	$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
-		-nopad -noappend -root-owned \
-		-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
-		-processors 1
+	echo 'dir /dev 0755 0 0' > $@.squashfs.packfile; \
+	echo 'nod /dev/console 0600 0 0 c 5 1' >> $@.squashfs.packfile; \
+	echo 'glob / * * *' >> $@.squashfs.packfile; \
+	$(STAGING_DIR_HOST)/bin/gensquashfs \
+		--block-size $(SQUASHFS_BLOCKSIZE) \
+		--all-root \
+		--force \
+		--compressor $(SQUASHFSCOMP) \
+		--defaults uid=0,gid=0,mtime=0 \
+		--pack-dir $(call mkfs_target_dir,$(1)) \
+		--pack-file $@.squashfs.packfile \
+		$@
 endef
 
 ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
diff --git a/tools/Makefile b/tools/Makefile
index a48aa80db3..2f0c090ee9 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -25,7 +25,7 @@ tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
 tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
 tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
 tools-y += mklibs mm-macros mtd-utils mtools ninja padjffs2 patch-image
-tools-y += patchelf pkgconf quilt squashfskit4 sstrip xxd zip zlib zstd
+tools-y += patchelf pkgconf quilt squashfs-tools-ng sstrip xxd zip zlib zstd
 tools-$(BUILD_B43_TOOLS) += b43-tools
 tools-$(BUILD_ISL) += isl
 tools-$(BUILD_TOOLCHAIN) += expat gmp mpc mpfr
@@ -69,12 +69,12 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile
 $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
 $(curdir)/sdcc/compile := $(curdir)/bison/compile
 $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
-$(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
+$(curdir)/squashfs-tools-ng/compile := $(curdir)/autoconf/compile $(curdir)/xz/compile $(curdir)/zlib/compile
 $(curdir)/zlib/compile := $(curdir)/cmake/compile
 $(curdir)/zstd/compile := $(curdir)/cmake/compile
 
 ifneq ($(HOST_OS),Linux)
-  $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile
+  $(curdir)/squashfs-tools-ng/compile += $(curdir)/coreutils/compile
   tools-y += coreutils
 endif
 
-- 
2.30.2




More information about the openwrt-devel mailing list