commit:     298c5096882846df2b215fede1c443f92aa5c6c6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 16 20:13:59 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 07:40:59 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=298c5096

kernel-install.eclass: Compress kernel modules in parallel

Closes: https://bugs.gentoo.org/922185
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/34843
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/kernel-install.eclass | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 9ab96628b5e4..2b6e80aee571 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -50,7 +50,7 @@ case ${EAPI} in
        *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit dist-kernel-utils mount-boot toolchain-funcs
+inherit dist-kernel-utils mount-boot multiprocessing toolchain-funcs
 
 SLOT="${PV}"
 IUSE="+initramfs test"
@@ -756,9 +756,14 @@ kernel-install_compress_modules() {
 
        if use modules-compress; then
                einfo "Compressing kernel modules ..."
-               # taken from scripts/Makefile.modinst
-               find "${ED}/lib" -name '*.ko' -exec \
-                       xz --check=crc32 --lzma2=dict=1MiB {} + || die
+               # 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
+               assert "Compressing kernel modules failed"
        fi
 }
 

Reply via email to