]> git.ozlabs.org Git - next-scripts/blob - do_build
CONFIG_BUILD_DOCSRC was removed from the kernel sources
[next-scripts] / do_build
1 #!/bin/sh
2
3 tree=
4 if [ "$1" ]; then
5         tree=$1
6         shift
7 fi
8
9 tools_dir=$(cd $(dirname "$0"); pwd)
10 . "$tools_dir/common.sh"
11
12 set -e
13
14 bparent=$(dirname "$build_dir")
15
16 line="$(tail -n 1 $SHA1_FILE)"
17
18 # strip everything after the first tab character
19 stree=${line%%  *}
20 if [ "$tree" ]; then
21         [ "$tree" = "$stree" ] || {
22                 echo "That is not the last tree merged ($tree v $stree)" 1>&2
23                 exit 1
24         }
25 else
26         tree="$stree"
27 fi
28 obdir="$bparent/old/$tree"
29
30 cmd="/bin/sh"
31 [ "$build_host" ] &&
32         cmd="ssh root@$build_host unshare -n su $(id -u -n)"
33
34 $cmd <<-EOF
35
36         echo Building on \$(hostname)
37
38         echo \$PATH | grep -q "\$HOME/bin" || export PATH="\$HOME/bin:\$PATH"
39         export LANG=C
40
41         cd "$build_dir" || exit 1
42
43         export CCACHE_DIR="$bparent/.ccache"
44         export TMPDIR="$bparent/tmp"
45
46         git reset --hard next || exit 1
47         touch .scmversion || exit 1
48
49         [ -d "$obdir" ] || mkdir -p "$obdir" || exit 1
50
51         sanitise_log() {
52                 sed -r '
53 /^[[:space:]]+$/d
54 /^[.[:digit:]]+user [.[:digit:]]+system [:.[:digit:]]+elapsed [[:digit:]]+%CPU \([[:digit:]]+avgtext\+[[:digit:]]+avgdata [[:digit:]]+maxresident\)k$/d
55 /^[[:digit:]]+inputs\+[[:digit:]]+outputs \([[:digit:]]+major\+[[:digit:]]+minor\)pagefaults [[:digit:]]+swaps$/d
56 /^Setup is [[:digit:]]+ bytes \(padded to [[:digit:]]+ bytes\)\.$/d
57 /^System is [[:digit:]]+ kB$/d
58 /^CRC [[:xdigit:]]+$/d
59 /^Kernel: arch\/x86\/boot\/bzImage is ready  \(#[[:digit:]]+\)$/d
60 /^WARNING: vmlinux\.o\(\.text\+0x[[:xdigit:]]+\): Section mismatch in reference from /d
61 /^WARNING: drivers\/built-in\.o\(\.text\+0x[[:xdigit:]]+\): Section mismatch in reference from /d
62 ' | grep -vxFf $bparent/log-ignore
63         }
64
65         show_log() {
66                 arch=\$1
67                 conf=\$2
68                 log=\$3
69
70                 sep='======================================================================'
71
72                 echo "\$sep"
73                 echo " \$arch \$conf build OK - log follows"
74                 echo "\$sep"
75                 cat \$log
76                 b=\$(basename \$log)
77                 if [ -f $obdir/\$b ]; then
78                         olen=\$(sanitise_log <$obdir/\$b | wc -l)
79                         len=\$(sanitise_log <\$log | wc -l)
80                         if [ \$olen -lt \$len ]; then
81                                 echo "\$sep"
82                                 echo " log \$b increased number of lines"
83                                 echo "\$sep"
84                                 pushover "linux-next log got bigger"
85                                 diff -u $obdir/\$b \$log 2>&1 | less
86                         fi
87                 fi
88                 mv \$log $obdir/\$b
89         }
90
91         echo Building: x86_64 allmodconfig
92         d="$bparent/x86_64_allmodconfig"
93         [ -d \$d ] || mkdir \$d || exit 1
94         log_x86=\$d.log
95         e=\$d.except
96         echo CONFIG_MODULES=y >>\$e || exit 1
97         KCONFIG_ALLCONFIG=\$e cross -n -N -a x86_64 -c "$gcc_version" O=\$d -s allmodconfig || exit 1
98         echo "Forking x86 build ..."
99         /usr/bin/time cross -n -N -a x86_64 -c "$gcc_version" O=\$d -j"$j_factor" -O -s > \$log_x86 2>&1 &
100         x86_64_pid=\$!
101
102         echo Building: powerpc ppc64_defconfig
103         d="$bparent/powerpc_ppc64_defconfig"
104         [ -d \$d ] || mkdir \$d || exit 1
105         log_ppc=\$d.log
106         cross -n -N -a powerpc64 -k powerpc -c "$gcc_ppc_version" O=\$d -s ppc64_defconfig || exit 1
107         echo "Forking powerpc build ..."
108         /usr/bin/time cross -n -N -a powerpc64 -k powerpc -c "$gcc_ppc_version" O=\$d -j"$j_factor" -O -s > \$log_ppc 2>&1 &
109         ppc64_pid=\$!
110
111         echo Building: arm multi_v7_defconfig
112         d="$bparent/arm_multi_v7_defconfig"
113         [ -d \$d ] || mkdir \$d || exit 1
114         log_arm=\$d.log
115         cross -n -N -a arm -c "$gcc_version" O=\$d -s multi_v7_defconfig || exit 1
116         echo "Forking arm build ..."
117         /usr/bin/time cross -n -N -a arm -c "$gcc_version" O=\$d -j"$j_factor" -O -s > \$log_arm 2>&1 &
118         arm_pid=\$!
119
120         echo Building: perf
121         d="$bparent/perf"
122         [ -d \$d ] || mkdir \$d || exit 1
123         log_perf=\$d.log
124         echo "Forking perf build ..."
125         /usr/bin/time make -C tools/perf -f Makefile.perf -s -O -j"$j_factor" O=\$d > \$log_perf 2>&1 &
126         perf_pid=\$!
127
128         wait \$perf_pid
129         rc=\$?
130
131         if [ \$rc -ne 0 ]; then
132                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
133                 echo "ERROR: perf build failed - log follows"
134                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
135                 cat \$log_perf
136                 kill \$x86_64_pid
137                 kill \$ppc64_pid
138                 kill \$arm_pid
139                 killall make
140                 rm .scmversion
141                 exit 1
142         else
143                 show_log native perf \$log_perf
144         fi
145
146         wait \$arm_pid
147         rc=\$?
148
149         if [ \$rc -ne 0 ]; then
150                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
151                 echo "ERROR: arm multi_v7_defconfig build failed - log follows"
152                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
153                 cat \$log_arm
154                 kill \$x86_64_pid
155                 kill \$ppd64_pid
156                 killall make
157                 rm .scmversion
158                 exit 1
159         else
160                 show_log arm multi_v7_defconfig \$log_arm
161         fi
162
163         wait \$ppc64_pid
164         rc=\$?
165
166         if [ \$rc -ne 0 ]; then
167                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
168                 echo "ERROR: powerpc ppc64_defconfig build failed - log follows"
169                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
170                 cat \$log_ppc
171                 kill \$x86_64_pid
172                 killall make
173                 rm .scmversion
174                 exit 1
175         else
176                 show_log powerpc ppc64_defconfig \$log_ppc
177         fi
178
179         wait \$x86_64_pid
180         rc=\$?
181
182         if [ \$rc -ne 0 ]; then
183                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
184                 echo "ERROR: x86_64 allmodconfig build failed - log follows"
185                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
186                 cat \$log_x86
187                 rm .scmversion
188                 exit 1
189         else
190                 show_log x86_64 allmodconfig \$log_x86
191         fi
192
193         rm .scmversion
194 EOF