linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] merge_config.sh: fail loudly if make also fails
@ 2016-08-30  9:56 Ioan-Adrian Ratiu
  0 siblings, 0 replies; only message in thread
From: Ioan-Adrian Ratiu @ 2016-08-30  9:56 UTC (permalink / raw)
  To: yann.morin.1998; +Cc: brad.mouring, bruce.ashfield, linux-kbuild, linux-kernel

There are cases in which the make call to fill missing symbols can fail.
I encountered one such case while building an Yocto/OpenEmbedded based
custom Linux kernel because by default after late 2014 OE poisons the
default compiler sysroot path [1], making it point to a bogus location
like /does/not/exist. This means the "--sysroot" compiler arg needs to
be passed everywhere explicitly.

If the sysroot is poisoned and no sane sysroot is passed to the make
call inside merge_config.sh it can fail silently and the continuing
build process using the borked config which does not know can generate a
kernel which will not boot (this is what happens in Yocto/OE). This was
fixed in OE by passing --sysroot (contained in $TOOLCHAIN_OPTIONS) [2].

Nevertheless, even though OE was fixed to pass a correct --sysroot and
avoid the error, this make call shouldn't fail silently and lead to
unbootable kernels. Make it fail loudly so that other build systems like
OE can pick up the error from merge_config.sh and act accordingly.

[1] http://git.openembedded.org/openembedded-core/commit/?id=04b725511a505c582a3abdf63d096967f0320779
[2] http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=zedd/kernel&id=87a9f321035428d9f4f8859ff99bb9acb70bd60c

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
---
 scripts/kconfig/merge_config.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 67d1314..5212f37 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -152,7 +152,10 @@ fi
 # alldefconfig: Fills in any missing symbols with Kconfig default
 # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
 make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
-
+if [ "$?" -ne 0 ]; then
+    echo "Make failed to fill missing config symbols. Exit." >&2
+    exit 1
+fi
 
 # Check all specified config values took (might have missed-dependency issues)
 for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
-- 
2.9.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-30  9:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30  9:56 [PATCH] merge_config.sh: fail loudly if make also fails Ioan-Adrian Ratiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).