Gentoo Archives: gentoo-dev

From: Jaco Kroon <jaco@××××××.za>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [PATCH] linux-mod.eclass: Support module compression
Date: Fri, 10 Jun 2022 09:32:08
Message-Id: 6a93eb82-dd88-8d55-3e0d-13ce5bcd105c@uls.co.za
In Reply to: [gentoo-dev] [PATCH] linux-mod.eclass: Support module compression by Mike Pagano
1 Hi,
2
3 On 2022/06/10 00:11, Mike Pagano wrote:
4
5 > The Linux kernel supports the compression of modules utilizing GZIP, XZ
6 > and ZSTD.  Add code into linux-mod.eclass to support this for out of
7 > tree modules utilizing the compression binary specified in the kernel
8 > config.
9 >
10 > Note that if the binary which provides the compression is not present on
11 > the system the kernel would have failed to build with an error
12 > indicating the missing binaries name.
13
14 LGTM.
15
16 Thanks for your work on this.
17
18 Kind Regards,
19 Jaco
20
21
22 >
23 > Signed-off-by: Mike Pagano <mpagano@g.o>
24 > ---
25 >  eclass/linux-mod.eclass | 17 ++++++++++++++++-
26 >  1 file changed, 16 insertions(+), 1 deletion(-)
27 >
28 > diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
29 > index 6a820371b..b7c13cbf7 100644
30 > --- a/eclass/linux-mod.eclass
31 > +++ b/eclass/linux-mod.eclass
32 > @@ -711,7 +711,22 @@ linux-mod_src_install() {
33 >          einfo "Installing ${modulename} module"
34 >          cd "${objdir}" || die "${objdir} does not exist"
35 >          insinto "${INSTALL_MOD_PATH}"/lib/modules/${KV_FULL}/${libdir}
36 > -        doins ${modulename}.${KV_OBJ} || die "doins
37 > ${modulename}.${KV_OBJ} failed"
38 > +
39 > +        # check here for CONFIG_MODULE_COMPRESS_<compression option>
40 > (NONE, GZIP, XZ, ZSTD)
41 > +        # and similarily compress the module being built if != NONE.
42 > +
43 > +        if linux_chkconfig_present MODULE_COMPRESS_XZ; then
44 > +            xz ${modulename}.${KV_OBJ}
45 > +            doins ${modulename}.${KV_OBJ}.xz || die "doins
46 > ${modulename}.${KV_OBJ}.xz failed"
47 > +        elif linux_chkconfig_present MODULE_COMPRESS_GZIP; then
48 > +            gzip ${modulename}.${KV_OBJ}
49 > +            doins ${modulename}.${KV_OBJ}.gz || die "doins
50 > ${modulename}.${KV_OBJ}.gz failed"
51 > +        elif linux_chkconfig_present MODULE_COMPRESS_ZSTD; then
52 > +            zstd ${modulename}.${KV_OBJ}
53 > +            doins ${modulename}.${KV_OBJ}.zst || die "doins
54 > ${modulename}.${KV_OBJ}.zst failed"
55 > +        else
56 > +            doins ${modulename}.${KV_OBJ} || die "doins
57 > ${modulename}.${KV_OBJ} failed"
58 > +        fi
59 >          cd "${OLDPWD}"
60 >  
61 >          generate_modulesd "${objdir}/${modulename}"