forked from bottlerocket-os/bottlerocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2007-kbuild-add-support-for-zstd-compressed-modules.patch
82 lines (68 loc) · 2.57 KB
/
2007-kbuild-add-support-for-zstd-compressed-modules.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From ddd6d2cff1af4bccee97a7d939e39f64a8965e50 Mon Sep 17 00:00:00 2001
From: Piotr Gorski <[email protected]>
Date: Wed, 7 Apr 2021 18:09:27 +0200
Subject: [PATCH 2007/2007] kbuild: add support for zstd compressed modules
kmod 28 supports modules compressed in zstd format so let's add this
possibility to kernel.
Signed-off-by: Piotr Gorski <[email protected]>
Reviewed-by: Oleksandr Natalenko <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
(cherry picked from commit c3d7ef377eb2564b165b1e8fdb4646952c90ac17)
[fixed a merge conflict in init/Kconfig]
Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
---
init/Kconfig | 11 +++++++++--
scripts/Makefile.modinst | 6 ++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index 4dc3ea198a2c..c6ffb8b7eec6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2121,8 +2121,9 @@ config MODULE_COMPRESS
Out-of-tree kernel modules installed using Kbuild will also be
compressed upon installation.
- Note: for modules inside an initrd or initramfs, it's more efficient
- to compress the whole initrd or initramfs instead.
+ Please note that the tool used to load modules needs to support the
+ corresponding algorithm. module-init-tools MAY support gzip, and kmod
+ MAY support gzip, xz and zstd.
Note: This is fully compatible with signed modules.
@@ -2144,6 +2145,12 @@ config MODULE_COMPRESS_GZIP
config MODULE_COMPRESS_XZ
bool "XZ"
+config MODULE_COMPRESS_ZSTD
+ bool "ZSTD"
+ help
+ Compress modules with ZSTD. The installed modules are suffixed
+ with .ko.zst.
+
endchoice
config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 84696ef99df7..59f613aa08b4 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -21,6 +21,7 @@ endif
suffix-y :=
suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz
suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
+suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules))
@@ -86,6 +87,8 @@ quiet_cmd_gzip = GZIP $@
cmd_gzip = $(KGZIP) -n -f $<
quiet_cmd_xz = XZ $@
cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
+quiet_cmd_zstd = ZSTD $@
+ cmd_zstd = $(ZSTD) -T0 --rm -f -q $<
$(dst)/%.ko.gz: $(dst)/%.ko FORCE
$(call cmd,gzip)
@@ -93,6 +96,9 @@ $(dst)/%.ko.gz: $(dst)/%.ko FORCE
$(dst)/%.ko.xz: $(dst)/%.ko FORCE
$(call cmd,xz)
+$(dst)/%.ko.zst: $(dst)/%.ko FORCE
+ $(call cmd,zstd)
+
PHONY += FORCE
FORCE:
--
2.30.2