summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJames Calligeros <jcalligeros99@gmail.com>2024-06-29 01:55:12 +0000
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2024-07-15 21:17:07 +0200
commitfa0ab4edb83c6e9ca7729ca847fdf60bfd051fb0 (patch)
treece988b711a49aee6724e7378913a8647d3c30533 /eclass
parentkernel-{build,install}.eclass: make kernel install paths match release (diff)
downloadgentoo-fa0ab4edb83c6e9ca7729ca847fdf60bfd051fb0.tar.gz
gentoo-fa0ab4edb83c6e9ca7729ca847fdf60bfd051fb0.tar.bz2
gentoo-fa0ab4edb83c6e9ca7729ca847fdf60bfd051fb0.zip
kernel-build.eclass: sanity check the prepared kernel's release string
Previously, this was only checked by kernel-install_pkg_preinst(). This means that the entire kernel would have to be built and stripped before we knew if we had built the correct kernel or not. Duplicate this check in kernel-build_src_configure() so that we don't waste time and energy building an incorrectly-versioned kernel. Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/kernel-build.eclass13
1 files changed, 13 insertions, 0 deletions
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 89167124802b..9ddc7793d6e6 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -239,6 +239,19 @@ kernel-build_src_configure() {
local relfile=${WORKDIR}/build/include/config/kernel.release
KV_FULL=$(<"${relfile}") || die
fi
+
+ # Make sure we are about to build the correct kernel
+ if [[ ${PV} != *9999 ]]; then
+ local expected_ver=$(dist-kernel_PV_to_KV "${PV}")
+
+ if [[ ${KV_FULL} != ${expected_ver}* ]]; then
+ eerror "Kernel version does not match PV!"
+ eerror "Source version: ${KV_FULL}"
+ eerror "Expected (PV*): ${expected_ver}*"
+ eerror "Please ensure you are applying the correct patchset."
+ die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*"
+ fi
+ fi
}
# @FUNCTION: kernel-build_src_compile