From: Andrew Nowa Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH 3/4] kernel-build.eclass: sanity check the prepared kernel's release string
Date: Mon, 15 Jul 2024 15:45:32 +0200 [thread overview]
Message-ID: <f5d3a7cf-8fe2-41dc-9bcf-05683a6031f4@gentoo.org> (raw)
In-Reply-To: <a53b6b87-df4b-40ed-9fae-0fcaf7e411d9@gentoo.org>
Part of https://github.com/gentoo/gentoo/pull/37327
From ec4e55ae9fd7cc6a4833981040f051ad2a3df15b Mon Sep 17 00:00:00 2001
From: James Calligeros <jcalligeros99@gmail.com>
Date: Sat, 29 Jun 2024 03:44:38 +0000
Subject: [PATCH] kernel-build.eclass: check that KV_FULL matches the kernel
release
We want to ensure all our installed directories are consistent and
match the kernel's own idea of its release version. Do an extra
sanity check to ensure that KV_FULL is indeed what it is supposed
to be, and bail out if it isn't.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
eclass/kernel-build.eclass | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 408837c4c57a7..6658435b92587 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -235,14 +235,22 @@ kernel-build_src_configure() {
cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die
# Now that we have a release file, set KV_FULL
+ local relfile=${WORKDIR}/build/include/config/kernel.release
if [[ -z ${KV_FULL} ]]; then
- 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}")
+ local expected_rel=$(<"${relfile}")
+
+ if [[ ${KV_FULL} != ${expected_rel} ]]; then
+ eerror "KV_FULL mismatch!"
+ eerror "KV_FULL: ${KV_FULL}"
+ eerror "Expected: ${expected_rel}"
+ die "KV_FULL mismatch: got ${KV_FULL}, expected ${expected_rel}"
+ fi
if [[ ${KV_FULL} != ${expected_ver}* ]]; then
eerror "Kernel version does not match PV!"
next prev parent reply other threads:[~2024-07-15 13:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 13:43 [gentoo-dev] [PATCH 1/4] kernel-{build,install}.eclass: make kernel install paths match release Andrew Nowa Ammerlaan
2024-07-15 13:44 ` [gentoo-dev] [PATCH 2/4] kernel-build.eclass: sanity check the prepared kernel's release string Andrew Nowa Ammerlaan
2024-07-15 13:45 ` Andrew Nowa Ammerlaan [this message]
2024-07-15 13:46 ` [gentoo-dev] [PATCH 4/4] kernel-install.eclass: improve kernel version check Andrew Nowa Ammerlaan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f5d3a7cf-8fe2-41dc-9bcf-05683a6031f4@gentoo.org \
--to=andrewammerlaan@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox