You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/profiles/templates/3.6/6_ac_install_patch/sys-kernel/calculate-sources/5.12/4503_zstd-patches_2.patch

82 lines
2.6 KiB

# Calculate format=diff
From 22dd6599c5d261925175a2f8a661c1c5d8755211 Mon Sep 17 00:00:00 2001
From: torvic9 <torvic9@mailbox.org>
Date: Fri, 2 Apr 2021 15:56:36 +0200
Subject: [PATCH 2/4] allow setting zstd compression level for kernel
Signed-off-by: torvic9 <torvic9@mailbox.org>
---
arch/x86/boot/compressed/Makefile | 5 +++++
init/Kconfig | 19 +++++++++++++++++++
scripts/Makefile.lib | 4 ++--
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index e0bc3988c..59ed10c61 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -130,8 +130,13 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lzo)
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lz4)
+ifdef CONFIG_KERNEL_ZSTD_ULTRA
$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
$(call if_changed,zstd22)
+else
+$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
+ $(call if_changed,zstd)
+endif
suffix-$(CONFIG_KERNEL_GZIP) := gz
suffix-$(CONFIG_KERNEL_BZIP2) := bz2
diff --git a/init/Kconfig b/init/Kconfig
index ecaccccd0..34384e4a1 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -309,6 +309,25 @@ config KERNEL_UNCOMPRESSED
endchoice
+menu "ZSTD compression options"
+ depends on KERNEL_ZSTD
+
+config KERNEL_ZSTD_LEVEL
+ int "Compression level (1-19)"
+ range 1 19
+ default 19
+ help
+ Choose a compression level for zstd kernel compression.
+ Default is 19.
+
+config KERNEL_ZSTD_LEVEL_ULTRA
+ bool "Ultra compression"
+ help
+ Selecting this overrides the chosen compression level and enables
+ the highest possible compression level for zstd (ultra-22).
+
+endmenu
+
config DEFAULT_INIT
string "Default init path"
default ""
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 8cd67b1b6..f2dfaa5a0 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -455,10 +455,10 @@ quiet_cmd_xzmisc = XZMISC $@
# be used because it would require zstd to allocate a 128 MB buffer.
quiet_cmd_zstd = ZSTD $@
- cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@
+ cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -$(CONFIG_KERNEL_ZSTD_LEVEL) -T0; $(size_append); } > $@
quiet_cmd_zstd22 = ZSTD22 $@
- cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
+ cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra -T0; $(size_append); } > $@
# ASM offsets
# ---------------------------------------------------------------------------
--
2.31.1.305.gd1b10fc6d8