All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piotr Gorski <lucjan.lucjanov@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org,
	Oleksandr Natalenko <oleksandr@natalenko.name>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Piotr Gorski <lucjan.lucjanov@gmail.com>
Subject: [PATCH] kbuild: add support for zstd compressed modules
Date: Wed,  7 Apr 2021 18:05:06 +0200	[thread overview]
Message-ID: <20210407160506.221308-1-lucjan.lucjanov@gmail.com> (raw)

kmod 28 supports modules compressed in zstd format so let's add this possibility to kernel.

V1 -> V2

* Rebuild against linux-kbuild tree

Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
---
 init/Kconfig             | 8 +++++++-
 scripts/Makefile.modinst | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 510f6fcd9b7f..b5744d32c4df 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2242,7 +2242,7 @@ choice
 
 	  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 and xz.
+	  MAY support gzip, xz and zstd.
 
 	  Your build system needs to provide the appropriate compression tool
 	  to compress the modules.
@@ -2267,6 +2267,12 @@ config MODULE_COMPRESS_XZ
 	  Compress modules with XZ. The installed modules are suffixed
 	  with .ko.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 191408f7a91a..90d8b2c4304e 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))
 
@@ -95,6 +96,8 @@ quiet_cmd_gzip = GZIP    $@
       cmd_gzip = $(KGZIP) -n -f $<
 quiet_cmd_xz = XZ      $@
       cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
+quiet_cmd_xz = ZSTD      $@
+      cmd_xz = $(ZSTD) -T0 --rm -f -q $<
 
 $(dst)/%.ko.gz: $(dst)/%.ko FORCE
 	$(call cmd,gzip)
@@ -102,6 +105,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.31.0.97.g1424303384


                 reply	other threads:[~2021-04-07 16:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210407160506.221308-1-lucjan.lucjanov@gmail.com \
    --to=lucjan.lucjanov@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=oleksandr@natalenko.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.