5 # Script to merge all configs and run 'make silentoldconfig' on it to wade out bad juju.
6 # Then split the configs into distro-commmon and flavour-specific parts
8 # We have to be in the top level kernel source directory
9 if [ ! -f MAINTAINERS ] || [ ! -f Makefile ]; then
10 echo "This does not appear to be the kernel source directory." 1>&2
14 mode=${1:?"Usage: $0 [oldconfig|editconfig]"}
17 update*configs) mode='silentoldconfig' ;;
18 default*configs) mode='oldconfig'; yes=1 ;;
19 edit*configs) ;; # All is good
20 gen*configs) mode='genconfigs' ;; # All is good
21 dump*configs) mode='config'; yes=1 ;;
22 *) echo "$0 called with invalid mode" 1>&2
26 confdir="$kerneldir/${DEBIAN}/config"
27 sharedconfdir="$kerneldir/debian.master/config"
30 . $DEBIAN/etc/kernelconfig
32 bindir="`pwd`/${DROOT}/scripts/misc"
33 common_conf="$confdir/config.common.$family"
35 mkdir "$tmpdir/CONFIGS"
37 if [ "$mode" = "genconfigs" ]; then
40 test -d CONFIGS || mkdir CONFIGS
43 for arch in $archs; do
47 # Map debian archs to kernel archs
49 amd64) kernarch="x86_64" ;;
50 lpia) kernarch="x86" ;;
51 sparc) kernarch="sparc64" ;;
52 armel) kernarch="arm" ;;
53 *) kernarch="$arch" ;;
56 archconfdir=$confdir/$arch
57 flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
60 # We merge config.common.ubuntu + config.common.<arch> +
61 # config.flavour.<flavour>
63 for config in $flavourconfigs; do
64 fullconf="$tmpdir/$arch-$config-full"
68 if [ -f $common_conf ]; then
69 cat $common_conf >> "$fullconf"
71 if [ -f $archconfdir/config.common.$arch ]; then
72 cat $archconfdir/config.common.$arch >> "$fullconf"
74 cat "$archconfdir/$config" >>"$fullconf"
75 if [ -f $confdir/OVERRIDES ]; then
76 cat $confdir/OVERRIDES >> "$fullconf"
82 for config in $flavourconfigs; do
83 if [ -f $archconfdir/$config ]; then
84 fullconf="$tmpdir/$arch-$config-full"
85 cat "$fullconf" > build/.config
86 # Call oldconfig or menuconfig
89 # Interactively edit config parameters
91 echo -n "Do you want to edit config: $arch/$config? [Y/n] "
96 make O=`pwd`/build ARCH=$kernarch menuconfig
101 echo "Entry not valid"
106 echo "* Run $mode (yes=$yes) on $arch/$config ..."
107 if [ "$yes" -eq 1 ]; then
108 yes "" | make O=`pwd`/build ARCH=$kernarch "$mode"
110 make O=`pwd`/build ARCH=$kernarch "$mode"
113 cat build/.config > $archconfdir/$config
114 cat build/.config > "$tmpdir/CONFIGS/$arch-$config"
115 if [ "$keep" = "1" ]; then
116 cat build/.config > CONFIGS/$arch-$config
119 echo "!! Config not found $archconfdir/$config..."
123 echo "Running splitconfig.pl for $arch"
126 # Can we make this more robust by avoiding $tmpdir completely?
127 # This approach was used for now because I didn't want to change
129 (cd $archconfdir; $bindir/splitconfig.pl; mv config.common \
130 config.common.$arch; cp config.common.$arch $tmpdir)
135 # Now run splitconfig.pl on all the config.common.<arch> copied to
137 (cd $tmpdir; $bindir/splitconfig.pl)
141 grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf
142 for arch in $archs; do
143 grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \
144 >$arch/config.common.$arch
149 echo "Running config-check for all configurations ..."
152 for arch in $archs; do
153 archconfdir=$confdir/$arch
154 flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
155 for config in $flavourconfigs; do
156 flavour="${config##*.}"
157 if [ -f $archconfdir/$config ]; then
158 fullconf="$tmpdir/CONFIGS/$arch-$config"
159 "$bindir/../config-check" "$fullconf" "$arch" "$flavour" "$sharedconfdir" "0" || let "fail=$fail+1"
164 if [ "$fail" != 0 ]; then
166 echo "*** ERROR: $fail config-check failures detected"