]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
build: image: support specifying mksquashfs4 parallel threads 19019/head
authorShiji Yang <yangshiji66@outlook.com>
Wed, 4 Jun 2025 10:16:12 +0000 (18:16 +0800)
committerNick Hainke <vincent@systemli.org>
Thu, 5 Jun 2025 19:28:03 +0000 (21:28 +0200)
By enabling multi-threading file reading, the squashfs rootfs build
process can be greatly accelerated. We use 4 as the default thread
number. This is the default value for squashfs4 tool 4.7 if we don't
append "-block-readers" or "-small-readers" options.

For more test results:
https://github.com/plougher/squashfs-tools/blob/4.7/Documentation/4.7/README

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19019
Signed-off-by: Nick Hainke <vincent@systemli.org>
config/Config-images.in
include/image.mk

index 47f3dfc0d9603f6e100db42d03cf49dc17e6d0ac..21ce0b8d28e4f7ff9587835b5afae66bbd56a8c2 100644 (file)
@@ -160,6 +160,22 @@ menu "Target Images"
                          Select squashfs block size, must be one of:
                            4, 8, 16, 32, 64, 128, 256, 512, 1024
 
+               config TARGET_SQUASHFS_BLOCK_READERS
+                       int "mksquashfs tool parallel block reader threads"
+                       depends on TARGET_ROOTFS_SQUASHFS
+                       default 4
+                       help
+                         Specify the number of parallel block reader threads
+                         (for files equal or larger than the squashfs block size).
+
+               config TARGET_SQUASHFS_SMALL_READERS
+                       int "mksquashfs tool parallel small file reader threads"
+                       depends on TARGET_ROOTFS_SQUASHFS
+                       default 4
+                       help
+                         Specify the number of parallel small file reader threads
+                         (for files less than the squashfs block size).
+
        menuconfig TARGET_ROOTFS_UBIFS
                bool "ubifs"
                default y if USES_UBIFS
index 98a440be3ceecbd5f5f78490f6486663d6ec81ef..2eca62a6643ae66dae227c464c6338edc0a17f0b 100644 (file)
@@ -86,6 +86,8 @@ 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'
 SQUASHFSOPT += $(if $(CONFIG_SELINUX),-xattrs,-no-xattrs)
+SQUASHFSOPT += -block-readers $(CONFIG_TARGET_SQUASHFS_BLOCK_READERS)
+SQUASHFSOPT += -small-readers $(CONFIG_TARGET_SQUASHFS_SMALL_READERS)
 SQUASHFSCOMP := gzip
 LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
 ifeq ($(CONFIG_SQUASHFS_XZ),y)