linux: remove debug paths in assembly compilations for repro builds

Message ID 20230509062040.13244-1-venkata.pyla@toshiba-tsip.com
State Accepted, archived
Headers show
Series linux: remove debug paths in assembly compilations for repro builds | expand

Commit Message

venkata.pyla@toshiba-tsip.com May 9, 2023, 6:20 a.m. UTC
From: venkata pyla <venkata.pyla@toshiba-tsip.com>

vmlinux file is not reproducible in case of arm architectures, where the
assembly files are compiled with debug info included with build paths,
so use `-fdebug-prefix-map` to substitute the paths and produce bit
identical builds.

Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
---
 meta/recipes-kernel/linux/files/debian/isar/build.tmpl | 2 +-
 meta/recipes-kernel/linux/linux-custom.inc             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

MOESSBAUER, Felix May 9, 2023, 6:34 a.m. UTC | #1
On Tue, 2023-05-09 at 11:50 +0530, venkata.pyla@toshiba-tsip.com wrote:
> From: venkata pyla <venkata.pyla@toshiba-tsip.com>
> 
> vmlinux file is not reproducible in case of arm architectures, where
> the
> assembly files are compiled with debug info included with build
> paths,
> so use `-fdebug-prefix-map` to substitute the paths and produce bit
> identical builds.

Hi,

this is a really good finding. I initially just added the map for the
KCFLAGS, as for x86 this was sufficient. Thanks for the patch.

Acked-by: Felix Moessbauer <felix.moessbauer@siemens.com>

> 
> Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
> ---
>  meta/recipes-kernel/linux/files/debian/isar/build.tmpl | 2 +-
>  meta/recipes-kernel/linux/linux-custom.inc             | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
> b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
> index e7e04791..906dc580 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}
> KCFLAGS="${KCFLAGS}"
> +    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE}
> KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}"
>  
>      # Stop tracing
>      set +x
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc
> b/meta/recipes-kernel/linux/linux-custom.inc
> index 42501342..1404ab0b 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -80,6 +80,7 @@ TEMPLATE_VARS += "                \
>      KERNEL_NAME_PROVIDED          \
>      KERNEL_CONFIG_FRAGMENTS       \
>      KCFLAGS                       \
> +    KAFLAGS                       \
>      DISTRIBUTOR                   \
>  "
>  
> @@ -88,6 +89,7 @@ inherit template
>  
>  # Add custom cflags to the kernel build
>  KCFLAGS ?= "-fdebug-prefix-map=${CURDIR}=."
> +KAFLAGS ?= "-fdebug-prefix-map=${CURDIR}=."
>  
>  # Derive name of the kernel packages from the name of this recipe
>  KERNEL_NAME_PROVIDED ?= "${@ d.getVar('PN').partition('linux-')[2]}"
Uladzimir Bely May 19, 2023, 4:14 a.m. UTC | #2
On Tue, 2023-05-09 at 11:50 +0530, venkata.pyla@toshiba-tsip.com wrote:
> From: venkata pyla <venkata.pyla@toshiba-tsip.com>
> 
> vmlinux file is not reproducible in case of arm architectures, where
> the
> assembly files are compiled with debug info included with build
> paths,
> so use `-fdebug-prefix-map` to substitute the paths and produce bit
> identical builds.
> 
> Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
> ---
>  meta/recipes-kernel/linux/files/debian/isar/build.tmpl | 2 +-
>  meta/recipes-kernel/linux/linux-custom.inc             | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)

Applied to next, thanks.

Patch

diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
index e7e04791..906dc580 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} KCFLAGS="${KCFLAGS}"
+    ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}"
 
     # Stop tracing
     set +x
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 42501342..1404ab0b 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -80,6 +80,7 @@  TEMPLATE_VARS += "                \
     KERNEL_NAME_PROVIDED          \
     KERNEL_CONFIG_FRAGMENTS       \
     KCFLAGS                       \
+    KAFLAGS                       \
     DISTRIBUTOR                   \
 "
 
@@ -88,6 +89,7 @@  inherit template
 
 # Add custom cflags to the kernel build
 KCFLAGS ?= "-fdebug-prefix-map=${CURDIR}=."
+KAFLAGS ?= "-fdebug-prefix-map=${CURDIR}=."
 
 # Derive name of the kernel packages from the name of this recipe
 KERNEL_NAME_PROVIDED ?= "${@ d.getVar('PN').partition('linux-')[2]}"