kernel: modify build via env
PATCH 1/2 kernel: modify build via env
For certain kernel builds, additional parameter might be specified that are not picked up by the build system of the kernel via the environment. This change allows to modify the build target, as well as extra build arguments for the kernel build.
The following two environment variables are used to control this behaviour. The value of the target variable is overriden in case the environment variable is specified.
SMATCH_ENV_TARGET target to be build SMATCH_ENV_BUILD_PARAM other parameters to be forwarded to make
--- smatch_scripts/test_kernel.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
smatch_scripts/test_kernel.sh +5 -1
@@ -41,6 +41,10 @@ while true ; do fi done +# receive parameters from environment, which override +[ -z "${SMATCH_ENV_TARGET:-}" ] || TARGET="$SMATCH_ENV_TARGET" +[ -z "${SMATCH_ENV_BUILD_PARAM:-}" ] || BUILD_PARAM="$SMATCH_ENV_BUILD_PARAM" + SCRIPT_DIR=$(dirname $0) if [ -e $SCRIPT_DIR/../smatch ] ; then cp $SCRIPT_DIR/../smatch $SCRIPT_DIR/../bak.smatch
@@ -55,7 +59,7 @@ fi make clean find -name \*.c.smatch -exec rm \{\} \; make -j${NR_CPU} $ENDIAN -k CHECK="$CMD -p=kernel --file-output --succeed $*" \ - C=1 $TARGET 2>&1 | tee $LOG + C=1 $BUILD_PARAM $TARGET 2>&1 | tee $LOG find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > $WLOG find -name \*.c.smatch.sql -exec cat \{\} \; -exec rm \{\} \; > $WLOG.sql find -name \*.c.smatch.caller_info -exec cat \{\} \; -exec rm \{\} \; > $WLOG.caller_info
Signature · 11 lines
2.7.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich Ust-ID: DE 289 237 879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
PATCH 2/2 kernel: forward build failures
In case the kernel build fails, the calling tool chain should also return with a non-zero exit code, to indicate that the currently used tool chain is broken. This change allows to forward the exit code accordingly.
--- smatch_scripts/build_kernel_data.sh | 4 +++- smatch_scripts/test_kernel.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
smatch_scripts/build_kernel_data.sh +3 -1
@@ -35,7 +35,8 @@ if [ ! -e smatch_db.sqlite ] ; then fi fi -$SCRIPT_DIR/test_kernel.sh --call-tree --info --param-mapper --spammy --data=$DATA_DIR +BUILD_STATUS=0 +$SCRIPT_DIR/test_kernel.sh --call-tree --info --param-mapper --spammy --data=$DATA_DIR || BUILD_STATUS=$? for i in $SCRIPT_DIR/gen_* ; do $i smatch_warns.txt -p=kernel
@@ -45,3 +46,4 @@ mv ${PROJECT}.* $DATA_DIR $DATA_DIR/db/create_db.sh -p=kernel smatch_warns.txt +exit $BUILD_STATUS
smatch_scripts/test_kernel.sh +3 -1
@@ -60,8 +60,10 @@ make clean find -name \*.c.smatch -exec rm \{\} \; make -j${NR_CPU} $ENDIAN -k CHECK="$CMD -p=kernel --file-output --succeed $*" \ C=1 $BUILD_PARAM $TARGET 2>&1 | tee $LOG +BUILD_STATUS=${PIPESTATUS[0]} find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > $WLOG find -name \*.c.smatch.sql -exec cat \{\} \; -exec rm \{\} \; > $WLOG.sql find -name \*.c.smatch.caller_info -exec cat \{\} \; -exec rm \{\} \; > $WLOG.caller_info -echo "Done. The warnings are saved to $WLOG" +echo "Done. Build with status $BUILD_STATUS. The warnings are saved to $WLOG" +exit $BUILD_STATUS
Signature · 11 lines
2.7.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich Ust-ID: DE 289 237 879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
Re: [kernel-build 2/2] kernel: forward build failures
Thanks!
I've applied both.
regards,
dan carpenter
Re: [kernel-build 2/2] kernel: forward build failures
Thanks!
Best,
Norbert
Quoted 7 lines · Dan Carpenter
Thanks!
I've applied both.
regards,
dan carpenter
Amazon Development Center Germany GmbH Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B