public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2] make debug symbols of kernel build relocatable
@ 2022-07-21 13:45 Felix Moessbauer
  2022-07-28 13:29 ` Anton Mikanovich
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Moessbauer @ 2022-07-21 13:45 UTC (permalink / raw)
  To: isar-users; +Cc: amikan, Felix Moessbauer

This patch adds support to inject custom KCFLAGS into
the linux-custom kernel build.
Using this infrastructure, we add the debug-prefix-map
flag to strip off the absolute prefix of the sources location.
This makes the debug information relocatable.

By that, we also fix low ccache hit rates in combination with ssbuild
due to the random builddir that sbuild uses.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/recipes-kernel/linux/files/debian/isar/build.tmpl | 2 +-
 meta/recipes-kernel/linux/files/debian/rules.tmpl      | 3 ++-
 meta/recipes-kernel/linux/linux-custom.inc             | 4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
index 65261e41..94cfbe0e 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
@@ -22,7 +22,7 @@ do_build() {
     sed -i "s/@KR@/${KR}/g" ${S}/debian/control ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.*
 
     # Build the Linux kernel
-    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE}
+    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}"
 
     # Stop tracing
     set +x
diff --git a/meta/recipes-kernel/linux/files/debian/rules.tmpl b/meta/recipes-kernel/linux/files/debian/rules.tmpl
index a1166287..8063c495 100755
--- a/meta/recipes-kernel/linux/files/debian/rules.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/rules.tmpl
@@ -13,7 +13,8 @@ isar_env=$(strip \
 	export DEB_HOST_GNU_TYPE='$(DEB_HOST_GNU_TYPE)' && \
 	export MAKE='$(MAKE)' && \
 	export O='${O}' && \
-	export S='${S}' \
+	export S='${S}' && \
+	export CURDIR='$(CURDIR)' \
 )
 
 %:
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index a6b1cdab..55bf0418 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -78,11 +78,15 @@ TEMPLATE_VARS += "                \
     LINUX_VERSION_EXTENSION       \
     KERNEL_NAME_PROVIDED          \
     KERNEL_CONFIG_FRAGMENTS       \
+    KCFLAGS                       \
 "
 
 inherit dpkg
 inherit template
 
+# Add custom cflags to the kernel build
+KCFLAGS ?= "-fdebug-prefix-map=${CURDIR}=."
+
 # Derive name of the kernel packages from the name of this recipe
 KERNEL_NAME_PROVIDED ?= "${@ d.getVar('PN', True).partition('linux-')[2]}"
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-28 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 13:45 [PATCH v2] make debug symbols of kernel build relocatable Felix Moessbauer
2022-07-28 13:29 ` Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox