public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] make debug symbols of kernel build relocatable
@ 2022-07-18 15:50 Felix Moessbauer
  2022-07-19  8:05 ` Uladzimir Bely
  2022-07-21 12:50 ` Anton Mikanovich
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Moessbauer @ 2022-07-18 15:50 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, 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 b7749cec..8fe816b3 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() {
     set -x
 
     # Build the Linux kernel
-    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} || exit ${?}
+    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" || exit ${?}
 
     # 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] 3+ messages in thread

* Re: [PATCH] make debug symbols of kernel build relocatable
  2022-07-18 15:50 [PATCH] make debug symbols of kernel build relocatable Felix Moessbauer
@ 2022-07-19  8:05 ` Uladzimir Bely
  2022-07-21 12:50 ` Anton Mikanovich
  1 sibling, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2022-07-19  8:05 UTC (permalink / raw)
  To: isar-users, Felix Moessbauer

In the email from Monday, 18 July 2022 18:50:56 +03 user Felix Moessbauer 
wrote:
> 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.

Hello.

I also came to the similar solution while debugging the issue, but I tried to 
use `-fdebug-prefix-map` directly in the build scripts.

The idea with placing it on recipe side and passing to the builder via KCFLAGS 
looks better and more extendable.

A small typo 'ssbuild' in commit message could be fixed during merge.

> 
> 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
> b7749cec..8fe816b3 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() {
>      set -x
> 
>      # Build the Linux kernel
> -    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} || exit ${?}
> +    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" ||
> exit ${?}
> 
>      # 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]}"


-- 
Uladzimir Bely




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

* Re: [PATCH] make debug symbols of kernel build relocatable
  2022-07-18 15:50 [PATCH] make debug symbols of kernel build relocatable Felix Moessbauer
  2022-07-19  8:05 ` Uladzimir Bely
@ 2022-07-21 12:50 ` Anton Mikanovich
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Mikanovich @ 2022-07-21 12:50 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users

18.07.2022 18:50, Felix Moessbauer wrote:
> 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>

Hello, can you please rebase this patch on the latest next?


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

end of thread, other threads:[~2022-07-21 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18 15:50 [PATCH] make debug symbols of kernel build relocatable Felix Moessbauer
2022-07-19  8:05 ` Uladzimir Bely
2022-07-21 12:50 ` Anton Mikanovich

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