Gentoo Archives: gentoo-dev

From: Ionen Wolkens <ionen@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] linux-mod.eclass: Support module compression
Date: Fri, 10 Jun 2022 10:27:57
Message-Id: YqMcpeGoAjchf+/H@eversor
In Reply to: [gentoo-dev] [PATCH] linux-mod.eclass: Support module compression by Mike Pagano
1 On Thu, Jun 09, 2022 at 06:11:00PM -0400, Mike Pagano wrote:
2 > The Linux kernel supports the compression of modules utilizing GZIP, XZ
3 > and ZSTD. Add code into linux-mod.eclass to support this for out of
4 > tree modules utilizing the compression binary specified in the kernel
5 > config.
6 >
7 > Note that if the binary which provides the compression is not present on
8 > the system the kernel would have failed to build with an error
9 > indicating the missing binaries name.
10 >
11 > Signed-off-by: Mike Pagano <mpagano@g.o>
12 > ---
13 > eclass/linux-mod.eclass | 17 ++++++++++++++++-
14 > 1 file changed, 16 insertions(+), 1 deletion(-)
15 >
16 > diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
17 > index 6a820371b..b7c13cbf7 100644
18 > --- a/eclass/linux-mod.eclass
19 > +++ b/eclass/linux-mod.eclass
20 > @@ -711,7 +711,22 @@ linux-mod_src_install() {
21 > einfo "Installing ${modulename} module"
22 > cd "${objdir}" || die "${objdir} does not exist"
23 > insinto "${INSTALL_MOD_PATH}"/lib/modules/${KV_FULL}/${libdir}
24 > - doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
25 > +
26 > + # check here for CONFIG_MODULE_COMPRESS_<compression option> (NONE, GZIP, XZ, ZSTD)
27 > + # and similarily compress the module being built if != NONE.
28 > +
29 > + if linux_chkconfig_present MODULE_COMPRESS_XZ; then
30 > + xz ${modulename}.${KV_OBJ}
31 > + doins ${modulename}.${KV_OBJ}.xz || die "doins ${modulename}.${KV_OBJ}.xz failed"
32 > + elif linux_chkconfig_present MODULE_COMPRESS_GZIP; then
33 > + gzip ${modulename}.${KV_OBJ}
34 > + doins ${modulename}.${KV_OBJ}.gz || die "doins ${modulename}.${KV_OBJ}.gz failed"
35 > + elif linux_chkconfig_present MODULE_COMPRESS_ZSTD; then
36 > + zstd ${modulename}.${KV_OBJ}
37 > + doins ${modulename}.${KV_OBJ}.zst || die "doins ${modulename}.${KV_OBJ}.zst failed"
38 > + else
39 > + doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
40 > + fi
41
42 This is copied from what the ebuild used to do, but doins already dies
43 on its own and report what file failed. Be a good occasion to clean
44 that up rather than repeat it.
45
46 What does not die on its own is the compression commands though. doins
47 would fail right after, but feels kind of unclear/fragile.
48
49 That aside, I tend to wonder if the kernel build system could be used
50 to install (i.e. it'd do compression, signing, etc... at same time,
51 and even handle new methods without needing to add them to the eclass).
52 But it's not something I looked at for usability, so not picky about
53 how to handle this.
54
55 > cd "${OLDPWD}"
56 >
57 > generate_modulesd "${objdir}/${modulename}"
58 > --
59 > 2.35.1
60 >
61
62
63
64
65 --
66 ionen

Attachments

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

Replies