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 ppc64) kernarch="powerpc" ;;
50 amd64) kernarch="x86_64" ;;
51 lpia) kernarch="x86" ;;
52 sparc) kernarch="sparc64" ;;
53 armel|armhf) kernarch="arm" ;;
54 *) kernarch="$arch" ;;
57 archconfdir=$confdir/$arch
58 flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
61 # We merge config.common.ubuntu + config.common.<arch> +
62 # config.flavour.<flavour>
64 for config in $flavourconfigs; do
65 fullconf="$tmpdir/$arch-$config-full"
69 if [ -f $common_conf ]; then
70 cat $common_conf >> "$fullconf"
72 if [ -f $archconfdir/config.common.$arch ]; then
73 cat $archconfdir/config.common.$arch >> "$fullconf"
75 cat "$archconfdir/$config" >>"$fullconf"
76 if [ -f $confdir/OVERRIDES ]; then
77 cat $confdir/OVERRIDES >> "$fullconf"
83 for config in $flavourconfigs; do
84 if [ -f $archconfdir/$config ]; then
85 fullconf="$tmpdir/$arch-$config-full"
86 cat "$fullconf" > build/.config
87 # Call oldconfig or menuconfig
90 # Interactively edit config parameters
92 echo -n "Do you want to edit config: $arch/$config? [Y/n] "
97 make O=`pwd`/build ARCH=$kernarch menuconfig
102 echo "Entry not valid"
107 echo "* Run $mode (yes=$yes) on $arch/$config ..."
108 if [ "$yes" -eq 1 ]; then
109 yes "" | make O=`pwd`/build ARCH=$kernarch "$mode"
111 make O=`pwd`/build ARCH=$kernarch "$mode"
114 cat build/.config > $archconfdir/$config
115 cat build/.config > "$tmpdir/CONFIGS/$arch-$config"
116 if [ "$keep" = "1" ]; then
117 cat build/.config > CONFIGS/$arch-$config
120 echo "!! Config not found $archconfdir/$config..."
124 echo "Running splitconfig.pl for $arch"
127 # Can we make this more robust by avoiding $tmpdir completely?
128 # This approach was used for now because I didn't want to change
130 (cd $archconfdir; $bindir/splitconfig.pl; mv config.common \
131 config.common.$arch; cp config.common.$arch $tmpdir)
136 # Now run splitconfig.pl on all the config.common.<arch> copied to
138 (cd $tmpdir; $bindir/splitconfig.pl)
142 grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf
143 for arch in $archs; do
144 grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \
145 >$arch/config.common.$arch
150 echo "Running config-check for all configurations ..."
153 for arch in $archs; do
154 archconfdir=$confdir/$arch
155 flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
156 for config in $flavourconfigs; do
157 flavour="${config##*.}"
158 if [ -f $archconfdir/$config ]; then
159 fullconf="$tmpdir/CONFIGS/$arch-$config"
160 "$bindir/../config-check" "$fullconf" "$arch" "$flavour" "$sharedconfdir" "0" || let "fail=$fail+1"
165 if [ "$fail" != 0 ]; then
167 echo "*** ERROR: $fail config-check failures detected"