2 # Copyright (c) 2016 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
5 # Check that the u-boot.cfg file provided does not introduce any new
6 # ad-hoc CONFIG options
8 # You can generate the list of current ad-hoc CONFIG options (those which are
9 # not in Kconfig) with this command:
11 # export LC_ALL=C LC_COLLATE=C
12 # git grep CONFIG_ |tr ' \t' '\n\n' |sed -n 's/^\(CONFIG_[A-Z0-9_]*\).*/\1/p' \
13 # |sort |uniq >scripts/config_whitelist.txt;
14 # unset LC_ALL LC_COLLATE
17 # check-config.sh <path to u-boot.cfg> <path to whitelist file> <source dir>
20 # scripts/check-config.sh b/chromebook_link/u-boot.cfg kconfig_whitelist.txt .
27 configs="${path}.configs"
28 suspects="${path}.suspects"
30 new_adhoc="${path}.adhoc"
35 cat ${path} |sed -n 's/^#define \(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |sort |uniq \
38 comm -23 ${configs} ${whitelist} > ${suspects}
40 cat `find ${srctree} -name "Kconfig*"` |sed -n \
41 -e 's/^config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
42 -e 's/^menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' |sort |uniq > ${ok}
43 comm -23 ${suspects} ${ok} >${new_adhoc}
44 if [ -s ${new_adhoc} ]; then
45 echo "Error: You must add new CONFIG options using Kconfig"
46 echo "The following new ad-hoc CONFIG options were detected:"
49 echo "Please add these via Kconfig instead. Find a suitable Kconfig"
50 echo "file and add a 'config' or 'menuconfig' option."
51 # Don't delete the temporary files in case they are useful
54 rm ${suspects} ${ok} ${new_adhoc}