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