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 9CDA6159C96 for ; Wed, 24 Jul 2024 17:19:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C20ABE2AB3; Wed, 24 Jul 2024 17:19:00 +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 80749E2AA0 for ; Wed, 24 Jul 2024 17:19:00 +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 8A3B534164C for ; Wed, 24 Jul 2024 17:18:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EE9441E46 for ; Wed, 24 Jul 2024 17:18:57 +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: <1721841493.e19b3318171fe5482417c00e0ff198091080944b.andrewammerlaan@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/kernel-build.eclass X-VCS-Directories: eclass/ X-VCS-Committer: andrewammerlaan X-VCS-Committer-Name: Andrew Ammerlaan X-VCS-Revision: e19b3318171fe5482417c00e0ff198091080944b X-VCS-Branch: master Date: Wed, 24 Jul 2024 17:18:57 +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: 6d5e5b74-982a-4dd5-a9d8-99730e6d9c8c X-Archives-Hash: 61bd34f0d8615af997468e739bd490dc commit: e19b3318171fe5482417c00e0ff198091080944b Author: Andrew Ammerlaan gentoo org> AuthorDate: Tue Jul 23 20:17:50 2024 +0000 Commit: Andrew Ammerlaan gentoo org> CommitDate: Wed Jul 24 17:18:13 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e19b3318 kernel-build.eclass: fix determining kernel release with MODULES=n For module-less kernels 'make modules_prepare' does nothing, we only get kernel.release after running src_compile. Luckily the kernel has the "kernelrelease" target which we can use for this purpose. Note, in kernel-install.eclass we still read the kernel release directly from the file since a) kernel.release will always exist and b) calling make there again would require duplicating (some subset off) ${MAKEARGS[@]}. The "make help" page specifies that this target should be called with "-s". The version check is moved up, before 'make modules_prepare' so we quit earlier if the KV_FULL is wrong. Note it should be run after we have completed the config in 'make olddefconfig'. Signed-off-by: Andrew Ammerlaan gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/37694 Signed-off-by: Andrew Ammerlaan gentoo.org> eclass/kernel-build.eclass | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index 29719609b912..f478cf636a27 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -253,25 +253,21 @@ kernel-build_src_configure() { mkdir -p "${WORKDIR}"/modprep || die mv .config "${WORKDIR}"/modprep/ || die emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig - emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare - 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 + local k_release=$(emake -s O="${WORKDIR}"/modprep "${MAKEARGS[@]}" kernelrelease) if [[ -z ${KV_FULL} ]]; then - KV_FULL=$(<"${relfile}") || die + KV_FULL=${k_release} 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 + if [[ ${KV_FULL} != ${k_release} ]]; then eerror "KV_FULL mismatch!" eerror "KV_FULL: ${KV_FULL}" - eerror "Expected: ${expected_rel}" - die "KV_FULL mismatch: got ${KV_FULL}, expected ${expected_rel}" + eerror "Expected: ${k_release}" + die "KV_FULL mismatch: got ${KV_FULL}, expected ${k_release}" fi if [[ ${KV_FULL} != ${expected_ver}* ]]; then @@ -282,6 +278,9 @@ kernel-build_src_configure() { die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*" fi fi + + emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare + cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die } # @FUNCTION: kernel-build_src_compile