3 # Script to merge all configs and run 'make silentoldconfig' on it to wade out bad juju.
4 # Then split the configs into distro-commmon and flavour-specific parts
6 # We have to be in the top level kernel source directory
7 if [ ! -f MAINTAINERS ] || [ ! -f Makefile ]; then
8 echo "This does not appear to be the kernel source directory." 1>&2
12 mode=${1:?"Usage: $0 [oldconfig|editconfig]"}
14 oldconfig) ;; # All is good
15 editconfig) ;; # All is good
16 genconfig) ;; # All is good
17 *) echo "$0 called with invalid mode" 1>&2
21 confdir="$kerneldir/chromeos/config"
22 archs="x86_64 i386 armel"
23 bindir="`pwd`/chromeos/scripts"
24 base_conf="$confdir/base.config"
27 if [ "$mode" = "genconfig" ]; then
30 test -d CONFIGS || mkdir CONFIGS
33 test -d build || mkdir build
35 for arch in $archs; do
36 # Map debian archs to kernel archs
38 amd64) kernarch="x86_64" ;;
39 lpia) kernarch="x86" ;;
40 sparc) kernarch="sparc64" ;;
41 armel) kernarch="arm" ;;
42 *) kernarch="$arch" ;;
46 echo "***************************************"
47 echo "* Processing $arch ($kernarch) ... "
48 archconfdir=$confdir/$arch
49 flavourconfigs=$(cd $archconfdir && ls *.flavour.config)
52 # We merge base.config + common.config + <flavour>.flavour.config
54 for config in $flavourconfigs; do
55 fullconf="$tmpdir/$arch-$config-full"
56 cp $base_conf "$fullconf"
57 cat $archconfdir/common.config >> "$fullconf"
58 cat $archconfdir/$config >> "$fullconf"
61 for config in $flavourconfigs; do
62 fullconf="$tmpdir/$arch-$config-full"
63 mv "$fullconf" build/.config
64 # Call oldconfig or menuconfig
67 # Weed out incorrect config parameters
68 echo "* Run silentoldconfig on $arch/$config ..."
69 make O=`pwd`/build ARCH=$kernarch silentoldconfig ;;
71 # Interactively edit config parameters
72 echo "* $arch/$config: press <Enter> to edit, S to skip"
74 if [ $REPLY = 's' -o $REPLY = 'S' ]; then
75 echo "* Skip: running silentoldconfig"
76 make O=`pwd`/build ARCH=$kernarch silentoldconfig
78 echo "* Running menuconfig"
79 make O=`pwd`/build ARCH=$kernarch menuconfig
84 cat build/.config > $archconfdir/$config
85 if [ "$keep" = "1" ]; then
86 make O=`pwd`/build ARCH=$kernarch oldconfig
87 make O=`pwd`/build ARCH=$kernarch savedefconfig
88 mv build/.config CONFIGS/$arch-$config
89 mv build/defconfig CONFIGS/$arch-$config.def
93 echo "Running splitconfig for $arch"
96 # Can we make this more robust by avoiding $tmpdir completely?
97 # This approach was used for now because I didn't want to change
99 (cd $archconfdir; rm common.config; $bindir/splitconfig; \
100 mv common.config $tmpdir/$arch.config)
103 # Now run splitconfig on all the <arch>.common.config copied to
105 (cd $tmpdir; $bindir/splitconfig)
106 mv $tmpdir/common.config $base_conf
107 for arch in $archs; do
108 mv $tmpdir/$arch.config $confdir/$arch/common.config