Part of
https://github.com/gentoo/gentoo/pull/37327
From d57b75ed204432c11ae643ea3526b46dab40c746 Mon Sep 17 00:00:00 2001
From: James Calligeros <
jcalligeros99@gmail.com>
Date: Thu, 27 Jun 2024 05:56:44 +0000
Subject: [PATCH] kernel-{build,install}.eclass: make kernel install paths
match release
dist-kernel releases are required to match the package's version, with
'_' substituted for '-' as per kernel release format rules. Curiously,
we made no such substitution on the kernel install directory names.
The consequence of this is that Catalyst has technically only been
working with dist-kernels by pure coincidence - it had never been tested
with kernels containing '_' in ${PV}. When attempting to build install
media for the Gentoo Asahi project, which necessitates using kernels
versioned with '_p*', Catalyst's call to Dracut's --kver argument
passes in the name of the source directory while Dracut expects
the kernel release (module directory).
Make sure that all directories installed by the kernel match the
kernel's own idea of its version exactly. This fixes Catalyst,
makes directories like /usr/src/linux-* consistent with /lib/modules
For compatibility with existing bin kernels, KV_FULL will be
set to ${PV}${KV_LOCALVERSION} in kernel-install.eclass if it
has not been explicitly set elsewhere.
Signed-off-by: James Calligeros <
jcalligeros99@gmail.com>
---
eclass/kernel-build.eclass | 46 +++++++++++++++-------------
eclass/kernel-install.eclass | 59 +++++++++++++++++++++---------------
2 files changed, 60 insertions(+), 45 deletions(-)
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 86c7cd4a172d5..7d4b98ac027d9 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -20,6 +20,14 @@
# the kernel and installing it along with its modules and subset
# of sources needed to build external modules.
+# @ECLASS_VARIABLE: KV_FULL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A string containing the full kernel release version, e.g.
+# '6.9.6-gentoo-dist'. This is used to ensure consistency between the
+# kernel's release version and Gentoo's tooling. This is set by
+# kernel-build_src_configure() once we have a kernel.release file.
+
case ${EAPI} in
8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
@@ -225,6 +233,12 @@ kernel-build_src_configure() {
emake O="${WORKDIR}"/