public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 3/4] linux-mod-r1.eclass: Add USE=modules-compress
Date: Thu, 28 Dec 2023 11:35:35 +0100	[thread overview]
Message-ID: <20231228103536.420981-3-mgorny@gentoo.org> (raw)
In-Reply-To: <20231228103536.420981-1-mgorny@gentoo.org>

Add a `modules-compress` USE flag to explicitly control kernel module
compression.  When the flag is disabled, modules are installed
uncompressed even if the kernel supports compression (which is going
to be the case for new sys-kernel/gentoo-kernel* builds).  When it is
enabled, the eclass compresses modules using the compressor configured,
or fails if no compression is supported.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/linux-mod-r1.eclass | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass
index 44fc927c3a70..54df2406e5c7 100644
--- a/eclass/linux-mod-r1.eclass
+++ b/eclass/linux-mod-r1.eclass
@@ -111,7 +111,7 @@ _LINUX_MOD_R1_ECLASS=1
 
 inherit edo linux-info multiprocessing toolchain-funcs
 
-IUSE="dist-kernel modules-sign +strip ${MODULES_OPTIONAL_IUSE}"
+IUSE="dist-kernel modules-compress modules-sign +strip ${MODULES_OPTIONAL_IUSE}"
 
 RDEPEND="
 	sys-apps/kmod[tools]
@@ -835,6 +835,8 @@ _modules_prepare_toolchain() {
 # If enabled in the kernel configuration, this compresses the given
 # modules using the same format.
 _modules_process_compress() {
+	use modules-compress || return
+
 	local -a compress
 	if linux_chkconfig_present MODULE_COMPRESS_XZ; then
 		compress=(
@@ -853,13 +855,13 @@ _modules_process_compress() {
 		fi
 	elif linux_chkconfig_present MODULE_COMPRESS_ZSTD; then
 		compress=(zstd -qT"$(makeopts_jobs)" --rm)
+	else
+		die "USE=modules-compress enabled but no MODULE_COMPRESS* configured"
 	fi
 
-	if [[ -v compress ]]; then
-		# could fail, assumes have commands that were needed for the kernel
-		einfo "Compressing modules (matching the kernel configuration) ..."
-		edob "${compress[@]}" -- "${@}"
-	fi
+	# could fail, assumes have commands that were needed for the kernel
+	einfo "Compressing modules (matching the kernel configuration) ..."
+	edob "${compress[@]}" -- "${@}"
 }
 
 # @FUNCTION: _modules_process_depmod.d
-- 
2.43.0



  parent reply	other threads:[~2023-12-28 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 10:35 [gentoo-dev] [PATCH 1/4] profiles/use.desc: Add global USE=modules-compress Michał Górny
2023-12-28 10:35 ` [gentoo-dev] [PATCH 2/4] kernel-{build,install}.eclass: Rename flag to modules-compress Michał Górny
2023-12-28 10:35 ` Michał Górny [this message]
2023-12-28 10:35 ` [gentoo-dev] [PATCH 4/4] linux-mod.eclass: Fix xz compression options Michał Górny

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=20231228103536.420981-3-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox