diff options
| author | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2024-08-05 21:13:28 +0200 |
|---|---|---|
| committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2024-08-07 10:58:39 +0200 |
| commit | 2073571d34ad5efcd6d4ec4db0914e774ca69a19 (patch) | |
| tree | e938083b51bcb1ddf87439bc98947eae2ddb6f78 | |
| parent | facd2865e403fd295c955fff8d609bfc717aed24 (diff) | |
| download | gentoo-2073571d34ad5efcd6d4ec4db0914e774ca69a19.tar.gz gentoo-2073571d34ad5efcd6d4ec4db0914e774ca69a19.tar.bz2 gentoo-2073571d34ad5efcd6d4ec4db0914e774ca69a19.zip | |
kernel-install.eclass: use dist-kernel_get_module_suffix to find compression
Adjusts kernel-install_compress_modules to use the new function
dist-kernel_get_module_suffix. This makes no functional difference
at the moment since gentoo-kernel-bin is the only consumer and it has
XZ compression in the config. Still this makes it possible to compile
alternate prebuilt kernels with alternate module compression support, and may
in the future help to support gzip and zstd module compression in
gentoo-kernel-bin.
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
| -rw-r--r-- | eclass/kernel-install.eclass | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 15b7cf739bc3..c64dd673084b 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -766,13 +766,35 @@ kernel-install_compress_modules() { if use modules-compress; then einfo "Compressing kernel modules ..." - # xz options taken from scripts/Makefile.modinst - # we don't do 'xz -T' because it applies multithreading per file, - # so it works only for big files, and we have lots of small files - # instead - find "${ED}/lib" -name '*.ko' -print0 | - xargs -0 -P "$(makeopts_jobs)" -n 128 \ - xz --check=crc32 --lzma2=dict=1MiB + if [[ -z ${KV_FULL} ]]; then + KV_FULL=${PV}${KV_LOCALVERSION} + fi + local suffix=$(dist-kernel_get_module_suffix "${ED}/usr/src/linux-${KV_FULL}") + local compress=() + # Options taken from linux-mod-r1.eclass. + # We don't instruct the compressor to parallelize because it applies + # multithreading per file, so it works only for big files, and we have + # lots of small files instead. + case ${suffix} in + .ko) + return + ;; + .ko.gz) + compress+=( gzip ) + ;; + .ko.xz) + compress+=( xz --check=crc32 --lzma2=dict=1MiB ) + ;; + .ko.zst) + compress+=( zstd -q --rm ) + ;; + *) + die "Unknown compressor: ${suffix}" + ;; + esac + + find "${ED}/lib/modules/${KV_FULL}" -name '*.ko' -print0 | + xargs -0 -P "$(makeopts_jobs)" -n 128 "${compress[@]}" assert "Compressing kernel modules failed" fi } |
