提交 c3d7ef37 编写于 作者: P Piotr Gorski 提交者: Masahiro Yamada

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: NPiotr Gorski <lucjan.lucjanov@gmail.com>
Reviewed-by: NOleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
上级 d4bbe942
...@@ -2242,7 +2242,7 @@ choice ...@@ -2242,7 +2242,7 @@ choice
Please note that the tool used to load modules needs to support the Please note that the tool used to load modules needs to support the
corresponding algorithm. module-init-tools MAY support gzip, and kmod corresponding algorithm. module-init-tools MAY support gzip, and kmod
MAY support gzip and xz. MAY support gzip, xz and zstd.
Your build system needs to provide the appropriate compression tool Your build system needs to provide the appropriate compression tool
to compress the modules. to compress the modules.
...@@ -2267,6 +2267,12 @@ config MODULE_COMPRESS_XZ ...@@ -2267,6 +2267,12 @@ config MODULE_COMPRESS_XZ
Compress modules with XZ. The installed modules are suffixed Compress modules with XZ. The installed modules are suffixed
with .ko.xz. with .ko.xz.
config MODULE_COMPRESS_ZSTD
bool "ZSTD"
help
Compress modules with ZSTD. The installed modules are suffixed
with .ko.zst.
endchoice endchoice
config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
......
...@@ -21,6 +21,7 @@ endif ...@@ -21,6 +21,7 @@ endif
suffix-y := suffix-y :=
suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz
suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules)) modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules))
...@@ -95,6 +96,8 @@ quiet_cmd_gzip = GZIP $@ ...@@ -95,6 +96,8 @@ quiet_cmd_gzip = GZIP $@
cmd_gzip = $(KGZIP) -n -f $< cmd_gzip = $(KGZIP) -n -f $<
quiet_cmd_xz = XZ $@ quiet_cmd_xz = XZ $@
cmd_xz = $(XZ) --lzma2=dict=2MiB -f $< cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
quiet_cmd_zstd = ZSTD $@
cmd_zstd = $(ZSTD) -T0 --rm -f -q $<
$(dst)/%.ko.gz: $(dst)/%.ko FORCE $(dst)/%.ko.gz: $(dst)/%.ko FORCE
$(call cmd,gzip) $(call cmd,gzip)
...@@ -102,6 +105,9 @@ $(dst)/%.ko.gz: $(dst)/%.ko FORCE ...@@ -102,6 +105,9 @@ $(dst)/%.ko.gz: $(dst)/%.ko FORCE
$(dst)/%.ko.xz: $(dst)/%.ko FORCE $(dst)/%.ko.xz: $(dst)/%.ko FORCE
$(call cmd,xz) $(call cmd,xz)
$(dst)/%.ko.zst: $(dst)/%.ko FORCE
$(call cmd,zstd)
PHONY += FORCE PHONY += FORCE
FORCE: FORCE:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册