public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: dist-kernel@gentoo.org, Sam James <sam@gentoo.org>
Subject: [gentoo-dev] [COMMITTED] kernel-build.eclass: handle CTF if enabled
Date: Tue,  3 Sep 2024 10:39:50 +0100	[thread overview]
Message-ID: <074703d997f81d4632e8f69d88a113c81e3220d4.1725356390.git.sam@gentoo.org> (raw)

genpatches will soon be adding optional CTF debug information support
via a patch. If it's enabled, we need to call a few special make targets
to create and install the CTF information. We also need to avoid stripping
the CTF archive.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/kernel-build.eclass | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 10fd0cca2cc5..1fc86c4a2208 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -296,7 +296,13 @@ kernel-build_src_configure() {
 kernel-build_src_compile() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	emake O="${WORKDIR}"/build "${MAKEARGS[@]}" all
+	local targets=( all )
+
+	if grep -q "CONFIG_CTF=y" "${WORKDIR}/modprep/.config"; then
+		targets+=( ctf )
+	fi
+
+	emake O="${WORKDIR}"/build "${MAKEARGS[@]}" "${targets[@]}"
 }
 
 # @FUNCTION: kernel-build_src_test
@@ -337,6 +343,10 @@ kernel-build_src_install() {
 		targets+=( dtbs_install )
 	fi
 
+	if grep -q "CONFIG_CTF=y" "${WORKDIR}/modprep/.config"; then
+		targets+=( ctf_install )
+	fi
+
 	# Use the kernel build system to strip, this ensures the modules
 	# are stripped *before* they are signed or compressed.
 	local strip_args
@@ -430,6 +440,7 @@ kernel-build_src_install() {
 			mv "build/vmlinux" "${ED}${kernel_dir}/vmlinux" || die
 		fi
 		dostrip -x "${kernel_dir}/vmlinux"
+		dostrip -x "${kernel_dir}/vmlinux.ctfa"
 	fi
 
 	# strip empty directories
-- 
2.46.0



                 reply	other threads:[~2024-09-03  9:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=074703d997f81d4632e8f69d88a113c81e3220d4.1725356390.git.sam@gentoo.org \
    --to=sam@gentoo.org \
    --cc=dist-kernel@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