OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 . debian/debian.env |
| 4 |
| 5 # Script to merge all configs and run 'make silentoldconfig' on it to wade out b
ad juju. |
| 6 # Then split the configs into distro-commmon and flavour-specific parts |
| 7 |
| 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 |
| 11 exit 1 |
| 12 fi |
| 13 |
| 14 mode=${1:?"Usage: $0 [oldconfig|editconfig]"} |
| 15 case "$mode" in |
| 16 oldconfig) ;; # All is good |
| 17 editconfig) ;; # All is good |
| 18 genconfig) ;; # All is good |
| 19 *) echo "$0 called with invalid mode" 1>&2 |
| 20 exit 1 ;; |
| 21 esac |
| 22 kerneldir="`pwd`" |
| 23 confdir="$kerneldir/${DEBIAN}/config" |
| 24 archs="i386 armel" |
| 25 family='chromeos' |
| 26 bindir="`pwd`/${DEBIAN}/scripts/misc" |
| 27 common_conf="$confdir/config.common.$family" |
| 28 tmpdir=`mktemp -d` |
| 29 |
| 30 if [ "$mode" = "genconfig" ]; then |
| 31 keep=1 |
| 32 mode="oldconfig" |
| 33 test -d CONFIGS || mkdir CONFIGS |
| 34 fi |
| 35 |
| 36 test -d build || mkdir build |
| 37 |
| 38 for arch in $archs; do |
| 39 # Map debian archs to kernel archs |
| 40 case "$arch" in |
| 41 amd64) kernarch="x86_64" ;; |
| 42 lpia) kernarch="x86" ;; |
| 43 sparc) kernarch="sparc64" ;; |
| 44 armel) kernarch="arm" ;; |
| 45 *) kernarch="$arch" ;; |
| 46 esac |
| 47 |
| 48 echo "" |
| 49 echo "***************************************" |
| 50 echo "* Processing $arch ($kernarch) ... " |
| 51 archconfdir=$confdir/$arch |
| 52 flavourconfigs=$(cd $archconfdir && ls config.flavour.*) |
| 53 |
| 54 # Merge configs |
| 55 # We merge config.common.ubuntu + config.common.<arch> + |
| 56 # config.flavour.<flavour> |
| 57 |
| 58 for config in $flavourconfigs; do |
| 59 fullconf="$tmpdir/$arch-$config-full" |
| 60 case $config in |
| 61 *) |
| 62 : >"$fullconf" |
| 63 if [ -f $common_conf ]; then |
| 64 cat $common_conf >> "$fullconf" |
| 65 fi |
| 66 if [ -f $archconfdir/config.common.$arch ]; then |
| 67 cat $archconfdir/config.common.$arch >> "$fullco
nf" |
| 68 fi |
| 69 cat "$archconfdir/$config" >>"$fullconf" |
| 70 ;; |
| 71 esac |
| 72 done |
| 73 |
| 74 for config in $flavourconfigs; do |
| 75 if [ -f $archconfdir/$config ]; then |
| 76 fullconf="$tmpdir/$arch-$config-full" |
| 77 cat "$fullconf" > build/.config |
| 78 # Call oldconfig or menuconfig |
| 79 case "$mode" in |
| 80 oldconfig) |
| 81 # Weed out incorrect config parameters |
| 82 echo "* Run silentoldconfig on $arch/$config ...
" |
| 83 make O=`pwd`/build ARCH=$kernarch silentoldconfi
g ;; |
| 84 editconfig) |
| 85 # Interactively edit config parameters |
| 86 echo " * Run menuconfig on $arch/$config... Pres
s a key." |
| 87 read |
| 88 make O=`pwd`/build ARCH=$kernarch menuconfig ;; |
| 89 *) # Bad! |
| 90 exit 1 ;; |
| 91 esac |
| 92 cat build/.config > $archconfdir/$config |
| 93 if [ "$keep" = "1" ]; then |
| 94 cat build/.config > CONFIGS/$arch-$config |
| 95 fi |
| 96 else |
| 97 echo "!! Config not found $archconfdir/$config..." |
| 98 fi |
| 99 done |
| 100 |
| 101 echo "Running splitconfig.pl for $arch" |
| 102 echo |
| 103 |
| 104 # Can we make this more robust by avoiding $tmpdir completely? |
| 105 # This approach was used for now because I didn't want to change |
| 106 # splitconfig.pl |
| 107 (cd $archconfdir; $bindir/splitconfig.pl; mv config.common \ |
| 108 config.common.$arch; cp config.common.$arch $tmpdir) |
| 109 done |
| 110 |
| 111 rm -f $common_conf |
| 112 |
| 113 # Now run splitconfig.pl on all the config.common.<arch> copied to |
| 114 # $tmpdir |
| 115 (cd $tmpdir; $bindir/splitconfig.pl) |
| 116 ( |
| 117 cd $confdir; |
| 118 rm -f *-full |
| 119 grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf |
| 120 for arch in $archs; do |
| 121 grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \ |
| 122 >$arch/config.common.$arch |
| 123 done |
| 124 ) |
OLD | NEW |