[kernel-build 1/2] kernel: modify build via env

Norbert Manthey <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
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

Signed-off-by: Norbert Manthey <[email protected]>

---
 smatch_scripts/test_kernel.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/smatch_scripts/test_kernel.sh b/smatch_scripts/test_kernel.sh
--- a/smatch_scripts/test_kernel.sh
+++ b/smatch_scripts/test_kernel.sh
@@ -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
-- 
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.