[openwrt/openwrt] build: use zstd for IB, toolchain, SDK and LLVM compression

LEDE Commits lede-commits at lists.infradead.org
Sat Apr 13 00:45:11 PDT 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/2496f436a837f4d56a13883497ab5d07fb01d0f7

commit 2496f436a837f4d56a13883497ab5d07fb01d0f7
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Tue Feb 13 01:03:44 2024 +0100

    build: use zstd for IB, toolchain, SDK and LLVM compression
    
    Use similar efficient but faster compression algorithm.
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 target/imagebuilder/Makefile | 9 +++++----
 target/llvm-bpf/Makefile     | 4 ++--
 target/sdk/Makefile          | 9 +++++----
 target/toolchain/Makefile    | 8 ++++----
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index c768c992ea..bfc72dacd0 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -24,7 +24,7 @@ BUNDLER_COMMAND := PATH=$(BUNDLER_PATH) $(XARGS) $(SCRIPT_DIR)/bundle-libraries.
 
 all: compile
 
-$(BIN_DIR)/$(IB_NAME).tar.xz: clean
+$(BIN_DIR)/$(IB_NAME).tar.zst: clean
 	rm -rf $(PKG_BUILD_DIR)
 	mkdir -p $(IB_KDIR) $(IB_LDIR) $(PKG_BUILD_DIR)/staging_dir/host/lib \
 		$(PKG_BUILD_DIR)/target/linux $(PKG_BUILD_DIR)/scripts $(IB_DTSDIR)
@@ -118,15 +118,16 @@ endif
 		$(BUNDLER_COMMAND))
 	$(CP) $(TOPDIR)/staging_dir/host/lib/libfakeroot* $(PKG_BUILD_DIR)/staging_dir/host/lib
 	STRIP=$(STAGING_DIR_HOST)/bin/sstrip $(SCRIPT_DIR)/rstrip.sh $(PKG_BUILD_DIR)/staging_dir/host/bin/
+
 	(cd $(BUILD_DIR); \
-		tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(IB_NAME) \
+		tar -I '$(STAGING_DIR_HOST)/bin/zstd -T0 --ultra -20' -cf $@ $(IB_NAME) \
 		--mtime="$(shell date --date=@$(SOURCE_DATE_EPOCH))"; \
 	)
 
 download:
 prepare:
-compile: $(BIN_DIR)/$(IB_NAME).tar.xz
+compile: $(BIN_DIR)/$(IB_NAME).tar.zst
 install: compile
 
 clean: FORCE
-	rm -rf $(PKG_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.xz
+	rm -rf $(PKG_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.zst
diff --git a/target/llvm-bpf/Makefile b/target/llvm-bpf/Makefile
index 6cadf693ef..a61bda923a 100644
--- a/target/llvm-bpf/Makefile
+++ b/target/llvm-bpf/Makefile
@@ -12,11 +12,11 @@ override MAKEFLAGS=
 LLVM_VERSION := $(shell cat $(STAGING_DIR_HOST)/llvm-bpf/.llvm-version)
 
 LLVM_BPF_PREFIX := llvm-bpf-$(LLVM_VERSION).$(HOST_OS)-$(HOST_ARCH)
-LLVM_TAR := $(BIN_DIR)/$(LLVM_BPF_PREFIX).tar.xz
+LLVM_TAR := $(BIN_DIR)/$(LLVM_BPF_PREFIX).tar.zst
 
 $(LLVM_TAR): $(STAGING_DIR_HOST)/llvm-bpf/.llvm-version
 	tar -C $(STAGING_DIR_HOST) \
-		-I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' \
+		-I '$(STAGING_DIR_HOST)/bin/zstd -T0 --ultra -20' \
 		$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
 		-cf $@.tmp llvm-bpf $(LLVM_BPF_PREFIX)
 	mv $@.tmp $@
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index d0c0ab7a2b..f4b7640d2c 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -101,7 +101,7 @@ USERSPACE_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/
 
 all: compile
 
-$(BIN_DIR)/$(SDK_NAME).tar.xz: clean
+$(BIN_DIR)/$(SDK_NAME).tar.zst: clean
 	mkdir -p \
 		$(SDK_BUILD_DIR)/dl \
 		$(SDK_BUILD_DIR)/package \
@@ -181,15 +181,16 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean
 	find $(SDK_BUILD_DIR) -name .svn | $(XARGS) rm -rf
 	find $(SDK_BUILD_DIR) -name CVS | $(XARGS) rm -rf
 	-make -C $(SDK_BUILD_DIR)/scripts/config clean
+
 	(cd $(BUILD_DIR); \
-		tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(SDK_NAME) \
+		tar -I '$(STAGING_DIR_HOST)/bin/zstd -T0 --ultra -20' -cf $@ $(SDK_NAME) \
 		--mtime="$(shell date --date=@$(SOURCE_DATE_EPOCH))"; \
 	)
 
 download:
 prepare:
-compile: $(BIN_DIR)/$(SDK_NAME).tar.xz
+compile: $(BIN_DIR)/$(SDK_NAME).tar.zst
 install: compile
 
 clean:
-	rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.xz
+	rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.zst
diff --git a/target/toolchain/Makefile b/target/toolchain/Makefile
index c33bccee69..9c0fdc4c7e 100644
--- a/target/toolchain/Makefile
+++ b/target/toolchain/Makefile
@@ -26,7 +26,7 @@ all: compile
 
 TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
 
-$(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz: clean
+$(BIN_DIR)/$(TOOLCHAIN_NAME).tar.zst: clean
 	mkdir -p $(TOOLCHAIN_BUILD_DIR)
 	$(TAR) -cf - -C $(TOPDIR)/staging_dir/  \
 	       $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
@@ -62,14 +62,14 @@ $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz: clean
 	find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
 	mkdir -p $(BIN_DIR)
 	(cd $(BUILD_DIR); \
-		tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(TOOLCHAIN_NAME) \
+		tar -I '$(STAGING_DIR_HOST)/bin/zstd -T0 --ultra -20' -cf $@ $(TOOLCHAIN_NAME) \
 		--mtime="$(shell date --date=@$(SOURCE_DATE_EPOCH))"; \
 	)
 
 download:
 prepare:
-compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz
+compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.zst
 install: compile
 
 clean:
-	rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz
+	rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.zst




More information about the lede-commits mailing list