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"
20 if [ "$1" == ".config" ]; then
21 echo "It overwrites .config, rename it and try again."
26 echo "Calculating mini.config..."
28 LENGTH
=`cat $1 | wc -l`
30 # Loop through all lines in the file
33 if [ $I -gt $LENGTH ]; then
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`
43 mv .config.
test mini.config
48 echo -n -e $I/$LENGTH lines
`cat mini.config | wc -c` bytes
"\r"