2 # Copyright (c) 2016 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
6 # This script creates the configuration whitelist file. This file contains
7 # all the config options which are allowed to be used outside Kconfig.
8 # Please do not add things to the whitelist. Instead, add your new option
11 export LC_ALL=C LC_COLLATE=C
13 # Looks for the rest of the CONFIG options, but exclude those in Kconfig and
17 egrep -vi "(Kconfig:|defconfig:|README|\.py|\.pl:)" \
19 | sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' \
20 |sort |uniq >scripts/config_whitelist.txt.tmp1;
22 # Finally, we need a list of the valid Kconfig options to exclude these from
24 cat `find . -name "Kconfig*"` |sed -n \
25 -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
26 -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
27 |sort |uniq >scripts/config_whitelist.txt.tmp2
29 # Use only the options that are present in the first file but not the second.
30 comm -23 scripts/config_whitelist.txt.tmp1 scripts/config_whitelist.txt.tmp2 \
31 |sort |uniq >scripts/config_whitelist.txt.tmp3
33 # If scripts/config_whitelist.txt already exists, take the intersection of the
34 # current list and the new one. We do not want to increase whitelist options.
35 if [ -r scripts/config_whitelist.txt ]; then
36 comm -12 scripts/config_whitelist.txt.tmp3 scripts/config_whitelist.txt \
37 > scripts/config_whitelist.txt.tmp4
38 mv scripts/config_whitelist.txt.tmp4 scripts/config_whitelist.txt
40 mv scripts/config_whitelist.txt.tmp3 scripts/config_whitelist.txt
43 rm scripts/config_whitelist.txt.tmp*
45 unset LC_ALL LC_COLLATE