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 # There are two independent greps. The first pulls out the component parts
14 # of CONFIG_SYS_EXTRA_OPTIONS. An example is:
16 # SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)
18 # We want this to produce:
23 # The second looks for the rest of the CONFIG options, but excludes those in
24 # Kconfig and defconfig files.
27 git grep CONFIG_SYS_EXTRA_OPTIONS |sed -n \
28 's/.*CONFIG_SYS_EXTRA_OPTIONS="\(.*\)"/\1/ p' \
30 | sed 's/ *\([A-Za-z0-9_]*\).*/CONFIG_\1/'
33 egrep -vi "(Kconfig:|defconfig:|README|\.py|\.pl:)" \
35 | sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p'
37 |sort |uniq >scripts/config_whitelist.txt.tmp1;
39 # Finally, we need a list of the valid Kconfig options to exclude these from
41 cat `find . -name "Kconfig*"` |sed -n \
42 -e 's/^config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
43 -e 's/^menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
44 |sort |uniq >scripts/config_whitelist.txt.tmp2
46 # Use only the options that are present in the first file but not the second.
47 comm -23 scripts/config_whitelist.txt.tmp1 scripts/config_whitelist.txt.tmp2 \
48 |sort |uniq >scripts/config_whitelist.txt
49 rm scripts/config_whitelist.txt.tmp1 scripts/config_whitelist.txt.tmp2
51 unset LC_ALL LC_COLLATE