aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2019-08-30 18:19:06 +0200
committerAndrey Konovalov <andreyknvl@gmail.com>2019-09-04 13:09:49 +0200
commit6c19c36919c3040459c321551e9d8993b3cd5182 (patch)
tree187419e5fd4add1463a4752f2f2e3b96992456ad
parent3977854c2a06af8542e92dd8a28e21c324741e92 (diff)
dashboard/config: improve config generation scripts
1. Use MAKE_ARGS var to pass arguments to make. 2. Pass -m to merge_config.sh to avoid calling make without CC. 3. Make util_add_syzbot_extra_bits() operate on .config.
-rwxr-xr-xdashboard/config/generate-config-kmsan-from-kasan.sh31
-rwxr-xr-xdashboard/config/generate-config-usb.sh25
-rwxr-xr-xdashboard/config/util.sh26
3 files changed, 43 insertions, 39 deletions
diff --git a/dashboard/config/generate-config-kmsan-from-kasan.sh b/dashboard/config/generate-config-kmsan-from-kasan.sh
index 6e6d2b42e..4bdaf8974 100755
--- a/dashboard/config/generate-config-kmsan-from-kasan.sh
+++ b/dashboard/config/generate-config-kmsan-from-kasan.sh
@@ -1,25 +1,24 @@
#!/bin/bash
# Generate upstream-kmsan.config from upstream-kasan.config.
-# Make sure $CC points to the Clang binary and $SOURCEDIR - to the kernel tree.
-
-THISDIR=`cd $(dirname $0); pwd`
-KASAN_CONFIG=${THISDIR}/upstream-kasan.config
-KMSAN_CONFIG=${THISDIR}/upstream-kmsan.config
-KMSAN_ADD=${THISDIR}/bits-kmsan.config
-. ${THISDIR}/util.sh
+# Make sure $CC points to the Clang binary and $KERNEL_SOURCE - to the kernel tree.
[ -z "${CC}" ] && echo 'Please set $CC to point to the compiler!' && exit
-[ -z "${SOURCEDIR}" ] && echo 'Please set $SOURCEDIR to point to the kernel tree!' && exit
+[ -z "${KERNEL_SOURCE}" ] && echo 'Please set $KERNEL_SOURCE to point to the kernel tree!' && exit
+
+THIS_DIR=`cd $(dirname $0); pwd`
+. ${THIS_DIR}/util.sh
+
+KASAN_CONFIG=${THIS_DIR}/upstream-kasan.config
+KMSAN_CONFIG=${THIS_DIR}/upstream-kmsan.config
+KMSAN_ADD=${THIS_DIR}/bits-kmsan.config
+
+cd ${KERNEL_SOURCE}
-(
-cd $SOURCEDIR
cp ${KASAN_CONFIG} .config
-scripts/kconfig/merge_config.sh .config ${KMSAN_ADD}
-make CC="${CC}" oldconfig < /dev/null
+scripts/kconfig/merge_config.sh -m .config ${KMSAN_ADD}
+make ${MAKE_VARS} olddefconfig
util_add_usb_bits
-util_add_syzbot_extra_bits "${KMSAN_CONFIG}"
+util_add_syzbot_extra_bits
-cat .config >> ${KMSAN_CONFIG}
-cp ${KMSAN_CONFIG} .config
-)
+cp .config ${KMSAN_CONFIG}
diff --git a/dashboard/config/generate-config-usb.sh b/dashboard/config/generate-config-usb.sh
index ffe89c74e..78cf19b07 100755
--- a/dashboard/config/generate-config-usb.sh
+++ b/dashboard/config/generate-config-usb.sh
@@ -2,26 +2,25 @@
set -eux
-THISDIR=`cd $(dirname $0); pwd`
+[ -z "${CC}" ] && echo 'Please set $CC to point to the compiler!' && exit
+[ -z "${KERNEL_SOURCE}" ] && echo 'Please set $KERNEL_SOURCE to point to the kernel tree!' && exit
-SYZBOT_CONFIG=${THISDIR}/bits-syzbot.config
-USB_CONFIG=${THISDIR}/upstream-usb.config
-. ${THISDIR}/util.sh
+THIS_DIR=`cd $(dirname $0); pwd`
+. ${THIS_DIR}/util.sh
-[ -z "${CC}" ] && echo 'Please set $CC to point to the compiler!' && exit
-[ -z "${SOURCEDIR}" ] && echo 'Please set $SOURCEDIR to point to the kernel tree!' && exit
+OUTPUT_CONFIG=${THIS_DIR}/upstream-usb.config
+
+cd ${KERNEL_SOURCE}
-cd ${SOURCEDIR}
-make CC="${CC}" defconfig
-make CC="${CC}" kvmconfig
+make ${MAKE_VARS} defconfig
+make ${MAKE_VARS} kvmconfig
util_add_usb_bits
util_add_syzbot_bits
sed -i "s#=m\$#=y#g" .config
-make CC="${CC}" olddefconfig
+make ${MAKE_VARS} olddefconfig
-util_add_syzbot_extra_bits "${USB_CONFIG}"
+util_add_syzbot_extra_bits
-cat .config >> ${USB_CONFIG}
-cp ${USB_CONFIG} .config
+cp .config ${OUTPUT_CONFIG}
diff --git a/dashboard/config/util.sh b/dashboard/config/util.sh
index a485c9a0b..a39fe508c 100755
--- a/dashboard/config/util.sh
+++ b/dashboard/config/util.sh
@@ -4,24 +4,24 @@
set -eux
-THISDIR=`cd $(dirname $0); pwd`
-
[ -z "${CC}" ] && echo 'Please set $CC to point to the compiler!' && exit
+THIS_DIR=`cd $(dirname $0); pwd`
+MAKE_VARS="CC=${CC}"
+SYZBOT_BITS=${THIS_DIR}/bits-syzbot.config
+
function util_add_syzbot_bits {
- scripts/kconfig/merge_config.sh .config $SYZBOT_CONFIG
- # Not merged in for some reason.
- scripts/config -e CONFIG_KCOV_ENABLE_COMPARISONS
- make CC="${CC}" olddefconfig
+ scripts/kconfig/merge_config.sh -m .config $SYZBOT_BITS
+ make ${MAKE_VARS} olddefconfig
}
function util_add_usb_bits {
- MERGE_USB_SCRIPT=${THISDIR}/kconfiglib-merge-usb-configs.py
+ MERGE_USB_SCRIPT=${THIS_DIR}/kconfiglib-merge-usb-configs.py
git clone --depth=1 https://github.com/ulfalizer/Kconfiglib.git
wget -qO- https://raw.githubusercontent.com/ulfalizer/Kconfiglib/master/makefile.patch | patch -p1
- for config in ${THISDIR}/distros/*; do
- make CC="${CC}" scriptconfig SCRIPT=${MERGE_USB_SCRIPT} SCRIPT_ARG=${config}
+ for config in ${THIS_DIR}/distros/*; do
+ make ${MAKE_VARS} scriptconfig SCRIPT=${MERGE_USB_SCRIPT} SCRIPT_ARG=${config}
done
git checkout ./scripts/kconfig/Makefile
rm -rf ./Kconfiglib
@@ -43,9 +43,12 @@ function util_add_usb_bits {
scripts/config -e CONFIG_USB_GADGETFS
scripts/config -e CONFIG_USB_DUMMY_HCD
scripts/config -e CONFIG_USB_FUZZER
+
+ make ${MAKE_VARS} olddefconfig
}
function util_add_syzbot_extra_bits {
+ TMP_FILE=$(mktemp /tmp/syzkaller.XXXXXX)
echo "# The following configs are added manually, preserve them.
# CONFIG_DEBUG_MEMORY was once added to mm tree and cause disabling of KASAN,
# which in turn caused storm of assorted crashes after silent memory
@@ -55,5 +58,8 @@ CONFIG_DEBUG_MEMORY=y
# This config can be used to enable any additional temporal debugging
# features in linux-next tree.
CONFIG_DEBUG_AID_FOR_SYZBOT=y
-" > $1
+" > ${TMP_FILE}
+ cat .config >> ${TMP_FILE}
+ mv ${TMP_FILE} .config
+ rm -rf ${TMP_FILE}
}