From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8EA8F159C83 for ; Wed, 7 Aug 2024 08:59:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 810972BC01A; Wed, 7 Aug 2024 08:59:02 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 675852BC01A for ; Wed, 7 Aug 2024 08:59:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2EC83343075 for ; Wed, 7 Aug 2024 08:59:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 83E2E1EBA for ; Wed, 7 Aug 2024 08:58:59 +0000 (UTC) From: "Andrew Ammerlaan" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andrew Ammerlaan" Message-ID: <1723021119.2073571d34ad5efcd6d4ec4db0914e774ca69a19.andrewammerlaan@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/kernel-install.eclass X-VCS-Directories: eclass/ X-VCS-Committer: andrewammerlaan X-VCS-Committer-Name: Andrew Ammerlaan X-VCS-Revision: 2073571d34ad5efcd6d4ec4db0914e774ca69a19 X-VCS-Branch: master Date: Wed, 7 Aug 2024 08:58:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d2dc8bda-1cb2-49dd-a8d5-f9e052566217 X-Archives-Hash: 5ef58d91fdf30465fd7cce9010d3c71f commit: 2073571d34ad5efcd6d4ec4db0914e774ca69a19 Author: Andrew Ammerlaan gentoo org> AuthorDate: Mon Aug 5 19:13:28 2024 +0000 Commit: Andrew Ammerlaan gentoo org> CommitDate: Wed Aug 7 08:58:39 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2073571d 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 gentoo.org> eclass/kernel-install.eclass | 36 +++++++++++++++++++++++++++++------- 1 file 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 }