commit:     824d48dae0571e5e728d93bb08619c7f0f6d10f2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 25 08:36:01 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 25 15:47:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=824d48da

kernel-install.eclass: Add kernel-install_compress_modules

Add a function to compress modules manually.  It will be used
in sys-kernel/gentoo-kernel-bin.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/kernel-install.eclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index c04a21789a7c..1cbb7d54d3de 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -765,6 +765,17 @@ kernel-install_pkg_config() {
        kernel-install_install_all "${PV}${KV_LOCALVERSION}"
 }
 
+# @FUNCTION: kernel-install_compress_modules
+# @DESCRIPTION:
+# Compress modules installed in ED, if USE=module-compress is enabled.
+kernel-install_compress_modules() {
+       debug-print-function ${FUNCNAME} "${@}"
+
+       if use module-compress; then
+               # taken from scripts/Makefile.modinst
+               find "${ED}/lib" -name '*.ko' -exec \
+                       xz --check=crc32 --lzma2=dict=1MiB {} + || die
+       fi
 fi
 
 EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm

Reply via email to