summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-12-25 09:07:23 +0100
committerMichał Górny <mgorny@gentoo.org>2023-12-25 16:47:32 +0100
commit8fbafcbda119ea44a75bfd8b29cf8631d5aff80e (patch)
tree3e56ac9f596a7dd2e38549a1b22bf019997c312f /eclass/kernel-build.eclass
parentdev-java/htmlcleaner: Stabilize 2.29 amd64, #920688 (diff)
downloadgentoo-8fbafcbda119ea44a75bfd8b29cf8631d5aff80e.tar.gz
gentoo-8fbafcbda119ea44a75bfd8b29cf8631d5aff80e.tar.bz2
gentoo-8fbafcbda119ea44a75bfd8b29cf8631d5aff80e.zip
kernel-{build,install}.eclass: Support XZ module compression
When KERNEL_IUSE_GENERIC_UKI is set (to gatekeep for new ebuilds), enable XZ module compression in kernel and add IUSE=module-compress. When the flag is enabled, the modules are installed .xz compressed per the config. When it is disabled, they are installed uncompressed but the kernel retains module compression support. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/kernel-build.eclass')
-rw-r--r--eclass/kernel-build.eclass22
1 files changed, 21 insertions, 1 deletions
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 70eb1243fcbc..69a2689601fa 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -283,9 +283,18 @@ kernel-build_src_install() {
# Modules were already stripped by the kernel build system
dostrip -x /lib/modules
+ local compress=()
+ if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && ! use module-compress; then
+ compress+=(
+ # force installing uncompressed modules even if compression
+ # is enabled via config
+ suffix-y=
+ )
+ fi
+
emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \
INSTALL_MOD_PATH="${ED}" INSTALL_MOD_STRIP="${strip_args}" \
- INSTALL_PATH="${ED}/boot" "${targets[@]}"
+ INSTALL_PATH="${ED}/boot" "${compress[@]}" "${targets[@]}"
# note: we're using mv rather than doins to save space and time
# install main and arch-specific headers first, and scripts
@@ -547,6 +556,17 @@ kernel-build_merge_configs() {
fi
fi
+ # Only semi-related but let's use that to avoid changing stable ebuilds.
+ if [[ ${KERNEL_IUSE_GENERIC_UKI} ]]; then
+ # NB: we enable this even with USE=-module-compress, in order
+ # to support both uncompressed and compressed modules in prebuilt
+ # kernels
+ cat <<-EOF > "${WORKDIR}/module-compress.config" || die
+ CONFIG_MODULE_COMPRESS_XZ=y
+ EOF
+ merge_configs+=( "${WORKDIR}/module-compress.config" )
+ fi
+
if [[ ${#user_configs[@]} -gt 0 ]]; then
elog "User config files are being applied:"
local x