From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Subject: [PATCH] linux-custom: Fix error handling of kernel build
Date: Sun, 10 Jul 2022 22:51:24 +0200 [thread overview]
Message-ID: <6b8a5055-437c-f706-d871-a9b564631cd8@siemens.com> (raw)
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
next reply other threads:[~2022-07-10 20:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-10 20:51 Jan Kiszka [this message]
2022-07-11 13:04 ` Henning Schild
2022-07-11 16:55 ` Jan Kiszka
2022-07-19 18:55 ` Anton Mikanovich
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=6b8a5055-437c-f706-d871-a9b564631cd8@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=Cedric_Hombourger@mentor.com \
--cc=isar-users@googlegroups.com \
/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