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" |
| 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 *) kernarch="$arch" ;; |
| 45 esac |
| 46 |
| 47 echo "" |
| 48 echo "***************************************" |
| 49 echo "* Processing $arch ($kernarch) ... " |
| 50 archconfdir=$confdir/$arch |
| 51 flavourconfigs=$(cd $archconfdir && ls config.flavour.*) |
| 52 |
| 53 # Merge configs |
| 54 # We merge config.common.ubuntu + config.common.<arch> + |
| 55 # config.flavour.<flavour> |
| 56 |
| 57 for config in $flavourconfigs; do |
| 58 fullconf="$tmpdir/$arch-$config-full" |
| 59 case $config in |
| 60 *) |
| 61 : >"$fullconf" |
| 62 if [ -f $common_conf ]; then |
| 63 cat $common_conf >> "$fullconf" |
| 64 fi |
| 65 if [ -f $archconfdir/config.common.$arch ]; then |
| 66 cat $archconfdir/config.common.$arch >> "$fullco
nf" |
| 67 fi |
| 68 cat "$archconfdir/$config" >>"$fullconf" |
| 69 ;; |
| 70 esac |
| 71 done |
| 72 |
| 73 for config in $flavourconfigs; do |
| 74 if [ -f $archconfdir/$config ]; then |
| 75 fullconf="$tmpdir/$arch-$config-full" |
| 76 cat "$fullconf" > build/.config |
| 77 # Call oldconfig or menuconfig |
| 78 case "$mode" in |
| 79 oldconfig) |
| 80 # Weed out incorrect config parameters |
| 81 echo "* Run silentoldconfig on $arch/$config ...
" |
| 82 make O=`pwd`/build ARCH=$kernarch silentoldconfi
g ;; |
| 83 editconfig) |
| 84 # Interactively edit config parameters |
| 85 echo " * Run menuconfig on $arch/$config... Pres
s a key." |
| 86 read |
| 87 make O=`pwd`/build ARCH=$kernarch menuconfig ;; |
| 88 *) # Bad! |
| 89 exit 1 ;; |
| 90 esac |
| 91 cat build/.config > $archconfdir/$config |
| 92 if [ "$keep" = "1" ]; then |
| 93 cat build/.config > CONFIGS/$arch-$config |
| 94 fi |
| 95 else |
| 96 echo "!! Config not found $archconfdir/$config..." |
| 97 fi |
| 98 done |
| 99 |
| 100 echo "Running splitconfig.pl for $arch" |
| 101 echo |
| 102 |
| 103 # Can we make this more robust by avoiding $tmpdir completely? |
| 104 # This approach was used for now because I didn't want to change |
| 105 # splitconfig.pl |
| 106 (cd $archconfdir; $bindir/splitconfig.pl; mv config.common \ |
| 107 config.common.$arch; cp config.common.$arch $tmpdir) |
| 108 done |
| 109 |
| 110 rm -f $common_conf |
| 111 |
| 112 # Now run splitconfig.pl on all the config.common.<arch> copied to |
| 113 # $tmpdir |
| 114 (cd $tmpdir; $bindir/splitconfig.pl) |
| 115 ( |
| 116 cd $confdir; |
| 117 rm -f *-full |
| 118 grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf |
| 119 for arch in $archs; do |
| 120 grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \ |
| 121 >$arch/config.common.$arch |
| 122 done |
| 123 ) |
OLD | NEW |