summaryrefslogtreecommitdiff
path: root/scripts/miniconfig.sh
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2015-07-25 23:08:44 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2015-07-25 23:32:01 +0200
commit681b12820b50b95e45cbd9bb27dfc96af3812b9b (patch)
treef682ffc06c5b04fd9e7d284a76f8692eca4e7330 /scripts/miniconfig.sh
parent1f046dd3f6f9c3d779e034186f900536ca3dff11 (diff)
scripts: add miniconfig.sh to aid in mini.config creation
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'scripts/miniconfig.sh')
-rw-r--r--scripts/miniconfig.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/miniconfig.sh b/scripts/miniconfig.sh
new file mode 100644
index 000000000..0e4ccf777
--- /dev/null
+++ b/scripts/miniconfig.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# miniconfig.sh copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under the GNU General Public License version 2.
+#
+# This script aids in building a mini.config from a fully fledged kernel
+# config. To do so, change into the kernel source directory and call this
+# script with the full config as first parameter. The output will be written to
+# a file named 'mini.config' in the same directory.
+#
+# Beware: This runs for a long time and the output might not be optimal. When
+# using it, bring some beer but don't drink too much so you're still able to
+# manually review the output in the end.
+
+if [ $# -ne 1 ] || [ ! -f "$1" ]; then
+ echo "Usage: miniconfig.sh configfile"
+ exit 1
+fi
+
+if [ "$1" == ".config" ]; then
+ echo "It overwrites .config, rename it and try again."
+ exit 1
+fi
+
+cp $1 mini.config
+echo "Calculating mini.config..."
+
+LENGTH=`cat $1 | wc -l`
+
+# Loop through all lines in the file
+I=1
+while true; do
+ if [ $I -gt $LENGTH ]; then
+ exit
+ fi
+ sed -n "${I}!p" mini.config > .config.test
+ # Do a config with this file
+ make allnoconfig KCONFIG_ALLCONFIG=.config.test > /dev/null
+
+ # Compare. The date changes so expect a small difference each time.
+ D=`diff .config $1 | wc -l`
+ if [ $D -eq 4 ]; then
+ mv .config.test mini.config
+ LENGTH=$[$LENGTH-1]
+ else
+ I=$[$I + 1]
+ fi
+ echo -n -e $I/$LENGTH lines `cat mini.config | wc -c` bytes "\r"
+done
+echo