Gentoo Archives: gentoo-dev

From: Mike Pagano <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] linux-mod.eclass: Support module compression
Date: Thu, 09 Jun 2022 22:11:11
Message-Id: ad7aac17-9238-57b7-6f54-2a537feac017@gentoo.org
1 The Linux kernel supports the compression of modules utilizing GZIP, XZ
2 and ZSTD. Add code into linux-mod.eclass to support this for out of
3 tree modules utilizing the compression binary specified in the kernel
4 config.
5
6 Note that if the binary which provides the compression is not present on
7 the system the kernel would have failed to build with an error
8 indicating the missing binaries name.
9
10 Signed-off-by: Mike Pagano <mpagano@g.o>
11 ---
12 eclass/linux-mod.eclass | 17 ++++++++++++++++-
13 1 file changed, 16 insertions(+), 1 deletion(-)
14
15 diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
16 index 6a820371b..b7c13cbf7 100644
17 --- a/eclass/linux-mod.eclass
18 +++ b/eclass/linux-mod.eclass
19 @@ -711,7 +711,22 @@ linux-mod_src_install() {
20 einfo "Installing ${modulename} module"
21 cd "${objdir}" || die "${objdir} does not exist"
22 insinto "${INSTALL_MOD_PATH}"/lib/modules/${KV_FULL}/${libdir}
23 - doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
24 +
25 + # check here for CONFIG_MODULE_COMPRESS_<compression option> (NONE, GZIP, XZ, ZSTD)
26 + # and similarily compress the module being built if != NONE.
27 +
28 + if linux_chkconfig_present MODULE_COMPRESS_XZ; then
29 + xz ${modulename}.${KV_OBJ}
30 + doins ${modulename}.${KV_OBJ}.xz || die "doins ${modulename}.${KV_OBJ}.xz failed"
31 + elif linux_chkconfig_present MODULE_COMPRESS_GZIP; then
32 + gzip ${modulename}.${KV_OBJ}
33 + doins ${modulename}.${KV_OBJ}.gz || die "doins ${modulename}.${KV_OBJ}.gz failed"
34 + elif linux_chkconfig_present MODULE_COMPRESS_ZSTD; then
35 + zstd ${modulename}.${KV_OBJ}
36 + doins ${modulename}.${KV_OBJ}.zst || die "doins ${modulename}.${KV_OBJ}.zst failed"
37 + else
38 + doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
39 + fi
40 cd "${OLDPWD}"
41
42 generate_modulesd "${objdir}/${modulename}"
43 --
44 2.35.1

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature

Replies