public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] linux-custom: Fix error handling of kernel build
@ 2022-07-10 20:51 Jan Kiszka
  2022-07-11 13:04 ` Henning Schild
  2022-07-19 18:55 ` Anton Mikanovich
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kiszka @ 2022-07-10 20:51 UTC (permalink / raw)
  To: isar-users; +Cc: Cedric Hombourger

From: Jan Kiszka <jan.kiszka@siemens.com>

Error was widely broken because set -e was not consistently set and,
where it was, it had no effect on functions as the do_${target}
invocation put them in a pipe which causes -e to be ignored.

This sets -e in the common script already and avoids the now unneeded
"|| exit ${?}".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Found while fighting with a horrible vemdor kernel that had dtbs_install 
broken - but was built "successfully".

 meta/recipes-kernel/linux/files/debian/isar/build.tmpl     | 6 +++---
 meta/recipes-kernel/linux/files/debian/isar/clean.tmpl     | 2 +-
 meta/recipes-kernel/linux/files/debian/isar/common.tmpl    | 4 +++-
 meta/recipes-kernel/linux/files/debian/isar/configure.tmpl | 6 +++---
 meta/recipes-kernel/linux/files/debian/isar/install.tmpl   | 5 +----
 5 files changed, 11 insertions(+), 12 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..550bdc67 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: MIT
 
 # Load common stuff
-. ${S}/debian/isar/common || exit ${?}
+. ${S}/debian/isar/common
 
 do_build() {
 
@@ -12,7 +12,7 @@ do_build() {
 
     # Process existing kernel configuration to make sure it is complete
     # (use defaults for options that were not specified)
-    ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig prepare || exit ${?}
+    ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig prepare
 
     # Transfer effective kernel version into control file and scripts
     KR=$(${MAKE} O=${KERNEL_BUILD_DIR} -s --no-print-directory kernelrelease)
@@ -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}
 
     # Stop tracing
     set +x
diff --git a/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl b/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl
index f9039877..bc67595b 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: MIT
 
 # Load common stuff
-. ${S}/debian/isar/common || exit ${?}
+. ${S}/debian/isar/common
 
 do_clean() {
 
diff --git a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
index b7752fb6..52ebebb0 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
@@ -2,6 +2,8 @@
 # Copyright (c) Mentor Graphics, a Siemens business, 2019
 # SPDX-License-Identifier: MIT
 
+set -e
+
 # Isar settings
 ARCH=${KERNEL_ARCH}
 KERNEL_PKG_IMAGE=linux-image-${KERNEL_NAME_PROVIDED}
@@ -45,5 +47,5 @@ main() {
     fi
 
     # call the actual target script
-    do_${target} || return ${?}
+    do_${target}
 }
diff --git a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
index 83871baa..58f10326 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
@@ -3,14 +3,14 @@
 # SPDX-License-Identifier: MIT
 
 # Load common stuff
-. ${S}/debian/isar/common || exit ${?}
+. ${S}/debian/isar/common
 
 do_configure() {
 
     # Process kernel config target and fragments
-    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} || exit ${?}
+    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET}
     ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
-    ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
+        ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
 
     # Stop tracing
     set +x
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
index 4c8c889f..c6b5059d 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
@@ -3,10 +3,7 @@
 # SPDX-License-Identifier: MIT
 
 # Load common stuff
-. ${S}/debian/isar/common || exit ${?}
-
-# Stop on error
-set -e
+. ${S}/debian/isar/common
 
 do_install() {
 
-- 
2.35.3

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

* Re: [PATCH] linux-custom: Fix error handling of kernel build
  2022-07-10 20:51 [PATCH] linux-custom: Fix error handling of kernel build Jan Kiszka
@ 2022-07-11 13:04 ` Henning Schild
  2022-07-11 16:55   ` Jan Kiszka
  2022-07-19 18:55 ` Anton Mikanovich
  1 sibling, 1 reply; 4+ messages in thread
From: Henning Schild @ 2022-07-11 13:04 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: isar-users, Cedric Hombourger

Am Sun, 10 Jul 2022 22:51:24 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Error was widely broken because set -e was not consistently set and,
> where it was, it had no effect on functions as the do_${target}
> invocation put them in a pipe which causes -e to be ignored.
> 
> This sets -e in the common script already and avoids the now unneeded
> "|| exit ${?}".
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Found while fighting with a horrible vemdor kernel that had
> dtbs_install broken - but was built "successfully".
> 
>  meta/recipes-kernel/linux/files/debian/isar/build.tmpl     | 6 +++---
>  meta/recipes-kernel/linux/files/debian/isar/clean.tmpl     | 2 +-
>  meta/recipes-kernel/linux/files/debian/isar/common.tmpl    | 4 +++-
>  meta/recipes-kernel/linux/files/debian/isar/configure.tmpl | 6 +++---
>  meta/recipes-kernel/linux/files/debian/isar/install.tmpl   | 5 +----
>  5 files changed, 11 insertions(+), 12 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..550bdc67 100644 ---
> a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl +++
> b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl @@ -3,7 +3,7
> @@ # SPDX-License-Identifier: MIT
>  
>  # Load common stuff
> -. ${S}/debian/isar/common || exit ${?}
> +. ${S}/debian/isar/common
>  
>  do_build() {
>  
> @@ -12,7 +12,7 @@ do_build() {
>  
>      # Process existing kernel configuration to make sure it is
> complete # (use defaults for options that were not specified)
> -    ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig prepare || exit ${?}
> +    ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig prepare
>  
>      # Transfer effective kernel version into control file and scripts
>      KR=$(${MAKE} O=${KERNEL_BUILD_DIR} -s --no-print-directory
> kernelrelease) @@ -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}
>  
>      # Stop tracing
>      set +x
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl
> b/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl index
> f9039877..bc67595b 100644 ---
> a/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl +++
> b/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl @@ -3,7 +3,7
> @@ # SPDX-License-Identifier: MIT
>  
>  # Load common stuff
> -. ${S}/debian/isar/common || exit ${?}
> +. ${S}/debian/isar/common
>  
>  do_clean() {
>  
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
> b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl index
> b7752fb6..52ebebb0 100644 ---
> a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl +++
> b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl @@ -2,6
> +2,8 @@ # Copyright (c) Mentor Graphics, a Siemens business, 2019
>  # SPDX-License-Identifier: MIT
>  
> +set -e
> +
>  # Isar settings
>  ARCH=${KERNEL_ARCH}
>  KERNEL_PKG_IMAGE=linux-image-${KERNEL_NAME_PROVIDED}
> @@ -45,5 +47,5 @@ main() {
>      fi
>  
>      # call the actual target script
> -    do_${target} || return ${?}
> +    do_${target}
>  }
> diff --git
> a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
> b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl index
> 83871baa..58f10326 100644 ---
> a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl +++
> b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl @@ -3,14
> +3,14 @@ # SPDX-License-Identifier: MIT 
>  # Load common stuff
> -. ${S}/debian/isar/common || exit ${?}
> +. ${S}/debian/isar/common
>  
>  do_configure() {
>  
>      # Process kernel config target and fragments
> -    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} || exit
> ${?}
> +    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET}
>      ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
> -    ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
> +        ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}

??

>  
>      # Stop tracing
>      set +x
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
> b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl index
> 4c8c889f..c6b5059d 100644 ---
> a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl +++
> b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl @@ -3,10
> +3,7 @@ # SPDX-License-Identifier: MIT
>  
>  # Load common stuff
> -. ${S}/debian/isar/common || exit ${?}
> -
> -# Stop on error
> -set -e
> +. ${S}/debian/isar/common
>  
>  do_install() {
>  


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

* Re: [PATCH] linux-custom: Fix error handling of kernel build
  2022-07-11 13:04 ` Henning Schild
@ 2022-07-11 16:55   ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2022-07-11 16:55 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users, Cedric Hombourger

On 11.07.22 15:04, Henning Schild wrote:
> Am Sun, 10 Jul 2022 22:51:24 +0200
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Error was widely broken because set -e was not consistently set and,
>> where it was, it had no effect on functions as the do_${target}
>> invocation put them in a pipe which causes -e to be ignored.
>>
>> This sets -e in the common script already and avoids the now unneeded
>> "|| exit ${?}".
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Found while fighting with a horrible vemdor kernel that had
>> dtbs_install broken - but was built "successfully".
>>
>>  meta/recipes-kernel/linux/files/debian/isar/build.tmpl     | 6 +++---
>>  meta/recipes-kernel/linux/files/debian/isar/clean.tmpl     | 2 +-
>>  meta/recipes-kernel/linux/files/debian/isar/common.tmpl    | 4 +++-
>>  meta/recipes-kernel/linux/files/debian/isar/configure.tmpl | 6 +++---
>>  meta/recipes-kernel/linux/files/debian/isar/install.tmpl   | 5 +----
>>  5 files changed, 11 insertions(+), 12 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..550bdc67 100644 ---
>> a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl +++
>> b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl @@ -3,7 +3,7
>> @@ # SPDX-License-Identifier: MIT
>>  
>>  # Load common stuff
>> -. ${S}/debian/isar/common || exit ${?}
>> +. ${S}/debian/isar/common
>>  
>>  do_build() {
>>  
>> @@ -12,7 +12,7 @@ do_build() {
>>  
>>      # Process existing kernel configuration to make sure it is
>> complete # (use defaults for options that were not specified)
>> -    ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig prepare || exit ${?}
>> +    ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig prepare
>>  
>>      # Transfer effective kernel version into control file and scripts
>>      KR=$(${MAKE} O=${KERNEL_BUILD_DIR} -s --no-print-directory
>> kernelrelease) @@ -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}
>>  
>>      # Stop tracing
>>      set +x
>> diff --git a/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl
>> b/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl index
>> f9039877..bc67595b 100644 ---
>> a/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl +++
>> b/meta/recipes-kernel/linux/files/debian/isar/clean.tmpl @@ -3,7 +3,7
>> @@ # SPDX-License-Identifier: MIT
>>  
>>  # Load common stuff
>> -. ${S}/debian/isar/common || exit ${?}
>> +. ${S}/debian/isar/common
>>  
>>  do_clean() {
>>  
>> diff --git a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
>> b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl index
>> b7752fb6..52ebebb0 100644 ---
>> a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl +++
>> b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl @@ -2,6
>> +2,8 @@ # Copyright (c) Mentor Graphics, a Siemens business, 2019
>>  # SPDX-License-Identifier: MIT
>>  
>> +set -e
>> +
>>  # Isar settings
>>  ARCH=${KERNEL_ARCH}
>>  KERNEL_PKG_IMAGE=linux-image-${KERNEL_NAME_PROVIDED}
>> @@ -45,5 +47,5 @@ main() {
>>      fi
>>  
>>      # call the actual target script
>> -    do_${target} || return ${?}
>> +    do_${target}
>>  }
>> diff --git
>> a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
>> b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl index
>> 83871baa..58f10326 100644 ---
>> a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl +++
>> b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl @@ -3,14
>> +3,14 @@ # SPDX-License-Identifier: MIT 
>>  # Load common stuff
>> -. ${S}/debian/isar/common || exit ${?}
>> +. ${S}/debian/isar/common
>>  
>>  do_configure() {
>>  
>>      # Process kernel config target and fragments
>> -    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} || exit
>> ${?}
>> +    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET}
>>      ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
>> -    ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
>> +        ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
> 
> ??
> 

That was what I had in mind as well when I read those two lines.
Therefore, I took the freedom to make them more readable via an
indention fix along this. Not worth a separate patch.

Jan

>>  
>>      # Stop tracing
>>      set +x
>> diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
>> b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl index
>> 4c8c889f..c6b5059d 100644 ---
>> a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl +++
>> b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl @@ -3,10
>> +3,7 @@ # SPDX-License-Identifier: MIT
>>  
>>  # Load common stuff
>> -. ${S}/debian/isar/common || exit ${?}
>> -
>> -# Stop on error
>> -set -e
>> +. ${S}/debian/isar/common
>>  
>>  do_install() {
>>  
> 

-- 
Siemens AG, Technology
Competence Center Embedded Linux

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

* Re: [PATCH] linux-custom: Fix error handling of kernel build
  2022-07-10 20:51 [PATCH] linux-custom: Fix error handling of kernel build Jan Kiszka
  2022-07-11 13:04 ` Henning Schild
@ 2022-07-19 18:55 ` Anton Mikanovich
  1 sibling, 0 replies; 4+ messages in thread
From: Anton Mikanovich @ 2022-07-19 18:55 UTC (permalink / raw)
  To: Jan Kiszka, isar-users; +Cc: Cedric Hombourger

10.07.2022 23:51, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Error was widely broken because set -e was not consistently set and,
> where it was, it had no effect on functions as the do_${target}
> invocation put them in a pipe which causes -e to be ignored.
>
> This sets -e in the common script already and avoids the now unneeded
> "|| exit ${?}".
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Applied to next, thanks.


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

end of thread, other threads:[~2022-07-19 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-10 20:51 [PATCH] linux-custom: Fix error handling of kernel build Jan Kiszka
2022-07-11 13:04 ` Henning Schild
2022-07-11 16:55   ` Jan Kiszka
2022-07-19 18:55 ` Anton Mikanovich

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