~ubuntu-branches/ubuntu/utopic/linux-ti-omap/utopic

« back to all changes in this revision

Viewing changes to debian/scripts/misc/kernelconfig

  • Committer: Bazaar Package Importer
  • Author(s): Amit Kucheria, Amit Kucheria
  • Date: 2010-03-10 02:28:15 UTC
  • Revision ID: james.westby@ubuntu.com-20100310022815-7sd3gwvn5kenaq33
Tags: 2.6.33-500.1
[ Amit Kucheria ]

* Initial release of a 2.6.33-based OMAP kernel
* UBUNTU: [Upstream] Fix omap 1-wire driver compilation
* UBUNTU: ubuntu: AppArmor -- update to mainline 2010-03-04

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
. debian/debian.env
 
4
 
 
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
 
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
sharedconfdir="$kerneldir/debian/config"
 
25
variant="$2"
 
26
 
 
27
. $DEBIAN/etc/kernelconfig
 
28
 
 
29
bindir="`pwd`/${DROOT}/scripts/misc"
 
30
common_conf="$confdir/config.common.$family"
 
31
tmpdir=`mktemp -d`
 
32
mkdir "$tmpdir/CONFIGS"
 
33
 
 
34
if [ "$mode" = "genconfig" ]; then
 
35
        keep=1
 
36
        mode="oldconfig"
 
37
        test -d CONFIGS || mkdir CONFIGS
 
38
fi
 
39
 
 
40
for arch in $archs; do
 
41
        rm -rf build
 
42
        mkdir build
 
43
 
 
44
        # Map debian archs to kernel archs
 
45
        case "$arch" in
 
46
                amd64)  kernarch="x86_64"       ;;
 
47
                lpia)   kernarch="x86"          ;;
 
48
                sparc)  kernarch="sparc64"      ;;
 
49
                armel)  kernarch="arm"          ;;
 
50
                *)      kernarch="$arch"        ;;
 
51
        esac
 
52
 
 
53
        echo ""
 
54
        echo "***************************************"
 
55
        echo "* Processing $arch ($kernarch) ... "
 
56
        archconfdir=$confdir/$arch
 
57
        flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
 
58
 
 
59
        # Merge configs
 
60
        # We merge config.common.ubuntu + config.common.<arch> +
 
61
        # config.flavour.<flavour>
 
62
 
 
63
        for config in $flavourconfigs; do
 
64
                fullconf="$tmpdir/$arch-$config-full"
 
65
                case $config in
 
66
                *)
 
67
                        : >"$fullconf"
 
68
                        if [ -f $common_conf ]; then
 
69
                                cat $common_conf >> "$fullconf"
 
70
                        fi
 
71
                        if [ -f $archconfdir/config.common.$arch ]; then
 
72
                                cat $archconfdir/config.common.$arch >> "$fullconf"
 
73
                        fi
 
74
                        cat "$archconfdir/$config" >>"$fullconf"
 
75
                        ;;
 
76
                esac
 
77
        done
 
78
 
 
79
        for config in $flavourconfigs; do
 
80
                if [ -f $archconfdir/$config ]; then
 
81
                        fullconf="$tmpdir/$arch-$config-full"
 
82
                        cat "$fullconf" > build/.config
 
83
                        # Call oldconfig or menuconfig
 
84
                        case "$mode" in
 
85
                            oldconfig)
 
86
                                # Weed out incorrect config parameters
 
87
                                echo "* Run silentoldconfig on $arch/$config ..."
 
88
                                make O=`pwd`/build ARCH=$kernarch silentoldconfig ;;
 
89
                            editconfig)
 
90
                                # Interactively edit config parameters
 
91
                                echo " * Run menuconfig on $arch/$config... Press a key."
 
92
                                read
 
93
                                make O=`pwd`/build ARCH=$kernarch menuconfig ;;
 
94
                            *)  # Bad!
 
95
                                exit 1 ;;
 
96
                        esac
 
97
                        cat build/.config > $archconfdir/$config
 
98
                        cat build/.config > "$tmpdir/CONFIGS/$arch-$config"
 
99
                        if [ "$keep" = "1" ]; then
 
100
                                cat build/.config > CONFIGS/$arch-$config
 
101
                        fi
 
102
                else
 
103
                        echo "!! Config not found $archconfdir/$config..."
 
104
                fi
 
105
        done
 
106
 
 
107
        echo "Running splitconfig.pl for $arch"
 
108
        echo
 
109
 
 
110
        # Can we make this more robust by avoiding $tmpdir completely?
 
111
        # This approach was used for now because I didn't want to change
 
112
        # splitconfig.pl
 
113
        (cd $archconfdir; $bindir/splitconfig.pl; mv config.common \
 
114
         config.common.$arch; cp config.common.$arch $tmpdir)
 
115
done
 
116
 
 
117
rm -f $common_conf
 
118
 
 
119
# Now run splitconfig.pl on all the config.common.<arch> copied to
 
120
# $tmpdir
 
121
(cd $tmpdir; $bindir/splitconfig.pl)
 
122
(
 
123
        cd $confdir;
 
124
        rm -f *-full
 
125
        grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf
 
126
        for arch in $archs; do
 
127
                grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \
 
128
                        >$arch/config.common.$arch
 
129
        done
 
130
)
 
131
 
 
132
echo ""
 
133
echo "Running config-check for all configurations ..."
 
134
echo ""
 
135
fail=0
 
136
for arch in $archs; do
 
137
        archconfdir=$confdir/$arch
 
138
        flavourconfigs=$(cd $archconfdir && ls config.flavour.*)
 
139
        for config in $flavourconfigs; do
 
140
                if [ -f $archconfdir/$config ]; then
 
141
                        fullconf="$tmpdir/CONFIGS/$arch-$config"
 
142
                        "$bindir/../config-check" "$fullconf" "$arch" "$config" "$sharedconfdir" "0" || let "fail=$fail+1"
 
143
                fi
 
144
        done
 
145
done
 
146
 
 
147
if [ "$fail" != 0 ]; then
 
148
        echo ""
 
149
        echo "*** ERROR: $fail config-check failures detected"
 
150
        echo ""
 
151
fi
 
152
 
 
153
rm -rf build
 
154