aboutsummaryrefslogtreecommitdiff
path: root/scripts/solution_kconfig
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2014-12-16 20:25:31 +0100
committerKarel Kočí <cynerd@email.cz>2014-12-16 20:25:31 +0100
commit52f268cc92049fe7199e7102d72cfd92d9971c78 (patch)
treed062ecebf52256842c61a66e620b7afb695edf35 /scripts/solution_kconfig
parent0b9b90f209851b8db732408df66272f2ed9234b3 (diff)
downloadlinux-conf-perf-52f268cc92049fe7199e7102d72cfd92d9971c78.tar.gz
linux-conf-perf-52f268cc92049fe7199e7102d72cfd92d9971c78.tar.bz2
linux-conf-perf-52f268cc92049fe7199e7102d72cfd92d9971c78.zip
Add solution_kconfig
This script is for setting options from sat generated solution to kconfig.
Diffstat (limited to 'scripts/solution_kconfig')
-rwxr-xr-xscripts/solution_kconfig38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/solution_kconfig b/scripts/solution_kconfig
new file mode 100755
index 0000000..7f9e5dd
--- /dev/null
+++ b/scripts/solution_kconfig
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+SAT_FOLDER="$1"
+CONF="$2"
+LINKER="$1/linker"
+SOLUTION="$1/solution"
+
+SAT=`head -1 "$SOLUTION"`
+SOL=`tail -1 "$SOLUTION"`
+
+if [[ ! -w "$CONF" ]]; then
+ echo "No file \"$CONF\"" >&2
+ exit 1
+fi
+
+if [[ "$SAT" != "SAT" ]]; then
+ echo "No solution" >&2
+ exit 1
+fi
+
+for exp in $SOL; do
+ if [[ "$exp" != "0" ]]; then
+ if [[ `echo "$exp" | head -c 1` = "-" ]]; then
+ exp=`echo "$exp" | cut -c 2-`
+ not="n"
+ else
+ not="y"
+ fi
+ lnk=`grep -e "^$exp:" "$LINKER" | sed 's/^[0-9]*\://'`
+ if [[ "$lnk" != NONAMEGEN* ]]; then # Ignore no name configs
+ if [[ -z `grep "^CONFIG_$lnk" "$CONF"` ]]; then
+ echo "CONFIG_$lnk=$not" >> "$CONF"
+ else
+ sed "s/^CONFIG_$lnk=.*/CONFIG_$lnk=$not/" "$CONF" > "$CONF"
+ fi
+ fi
+ fi
+done