libunistring: update to 0.9.7, allows to compile for musl toolchains
[openadk.git] / scripts / miniconfig.sh
blob0e4ccf777939f1b155bb5d2edc4e33c6b9d54048
1 #!/bin/sh
3 # miniconfig.sh copyright 2005 by Rob Landley <rob@landley.net>
4 # Licensed under the GNU General Public License version 2.
6 # This script aids in building a mini.config from a fully fledged kernel
7 # config. To do so, change into the kernel source directory and call this
8 # script with the full config as first parameter. The output will be written to
9 # a file named 'mini.config' in the same directory.
11 # Beware: This runs for a long time and the output might not be optimal. When
12 # using it, bring some beer but don't drink too much so you're still able to
13 # manually review the output in the end.
15 if [ $# -ne 1 ] || [ ! -f "$1" ]; then
16 echo "Usage: miniconfig.sh configfile"
17 exit 1
20 if [ "$1" == ".config" ]; then
21 echo "It overwrites .config, rename it and try again."
22 exit 1
25 cp $1 mini.config
26 echo "Calculating mini.config..."
28 LENGTH=`cat $1 | wc -l`
30 # Loop through all lines in the file
31 I=1
32 while true; do
33 if [ $I -gt $LENGTH ]; then
34 exit
36 sed -n "${I}!p" mini.config > .config.test
37 # Do a config with this file
38 make allnoconfig KCONFIG_ALLCONFIG=.config.test > /dev/null
40 # Compare. The date changes so expect a small difference each time.
41 D=`diff .config $1 | wc -l`
42 if [ $D -eq 4 ]; then
43 mv .config.test mini.config
44 LENGTH=$[$LENGTH-1]
45 else
46 I=$[$I + 1]
48 echo -n -e $I/$LENGTH lines `cat mini.config | wc -c` bytes "\r"
49 done
50 echo