blob: a0c17a7c6b3d424447426b7feeb454d25856c02c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
###############################################################################
# Copyright (c) 2014 Linaro
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################
export PATH=$PATH:~/bin/
set -o errtrace
git config --global user.email "android-build-bot@fake-email.com"
git config --global user.name "android-build-bot"
if [ ! -n "$SOURCE_OVERLAY" ];
then
echo "ERROR: Missing SOURCE_OVERLAY in the configuration."
exit 1
fi
if [ "$SOURCE_OVERLAY_OPTIONAL" == "1" -o -n "$SOURCE_OVERLAY_OPTIONAL" ]; then
echo "ERROR: SOURCE_OVERLAY_OPTIONAL should not be set in official build configuration."
echo " It is meant to be set only in local build scripts to bypass overlays."
exit 1
fi
source "${BUILD_SCRIPT_ROOT}"/helpers
trap infrastructure_error ERR
if [ -z "${TARGET_OUT_DIR}" ]; then
# only set TARGET_OUT_DIR when it is not set
# Set TARGET_OUT_DIR since few TARGET_PRODUCT include "full_" keyword as well
export TARGET_OUT_DIR=`echo $TARGET_PRODUCT | sed 's/_/\n/;s/.*\n//'`
fi
if [ -n "$BUILD_COPYCAT" ]; then
download_another_build "$BUILD_COPYCAT"
else
# Download overlays ASAP for fail-fast approach
if [ -n "$SOURCE_OVERLAY" ]; then
download_overlays "$SOURCE_OVERLAY"
fi
# Select JAVA version based on Android version. Android 4.4 < builds with JAVA6
# AOSP master and future build will use java 1.7 openjdk.
# Step 1/2 (fail fast)
if [ -n "$USE_JAVA_6" ]; then
sudo update-java-alternatives --set java-6-sun || true
elif [ -n "$USE_JAVA_7" ]; then
sudo update-java-alternatives --set java-1.7.0-openjdk-amd64 || true
fi
java -version
# Download toolchain, fail-fast
if test -n "$TOOLCHAIN_URL"; then
wget -nv --no-check-certificate $TOOLCHAIN_URL
fi
if [ -n "$REPO_SEED_URL" ]; then
repo-sync-from-seed "${1}"
else
repo-sync-from-mirror "${1}"
fi
if [ -n "$GERRIT_PROJECT" ] && [ $GERRIT_EVENT_TYPE == "patchset-created" ]; then
if [ "$GERRIT_PROJECT" == "platform/manifest" ]; then
cd .repo/local_manifests;
git pull http://review.android.git.linaro.org/platform/manifest $GERRIT_REFSPEC
cd -
else
cd `grep -rni $GERRIT_PROJECT\" .repo/local_manifests | grep -Po 'path="\K[^"]*'`
git pull http://review.android.git.linaro.org/$GERRIT_PROJECT $GERRIT_REFSPEC
cd -
fi
fi
if [ -n "$PATCHSETS" ]; then
for i in $PATCHSETS; do
sh ./android-patchsets/$i
done
fi
if [ -n "$POST_CHECKOUT_HOOK" ]; then
# if echo "$POST_CHECKOUT_HOOK" | grep -F / >/dev/null; then
# echo "Invalid POST_CHECKOUT_HOOK: $POST_CHECKOUT_HOOK"
# exit 1
# fi
$BUILD_SCRIPT_ROOT/$POST_CHECKOUT_HOOK
fi
trap - ERR
. build/envsetup.sh
trap infrastructure_error ERR
[ -n "$LUNCH" ] && lunch "$LUNCH"
# We evaluate the configuration again because envsetup.sh might well
# have stomped on some of the values in it.
set -a
eval $CONFIGURATION
set +a
# export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22/
# export ANDROID_JAVA_HOME=$JAVA_HOME
# Select JAVA version based on Android version. Android 4.4 < builds with JAVA6
# AOSP master and future build will use java 1.7 openjdk.
# Step 2/2
# if [ -n "$USE_JAVA_6" ]; then
# export JAVA_HOME=/usr/lib/jvm/java-6-sun/
# export ANDROID_JAVA_HOME=$JAVA_HOME
# elif [ -n "$USE_JAVA_7" ]; then
# export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/
# export ANDROID_JAVA_HOME=$JAVA_HOME
# fi
MAKE_TARGETS="${MAKE_TARGETS-boottarball systemtarball userdatatarball}"
calc_make_jobs
if test -n "$TOOLCHAIN_URL"; then
toolchain_filename=`echo $TOOLCHAIN_URL | sed -e 's/.*\/\([^/]*\)$/\1/'`
mkdir toolchain
tar -C toolchain --strip-components 1 -xf $toolchain_filename
if test -z "$TOOLCHAIN_TRIPLET"; then
# Android 2.x usually needs to be built with arm-eabi,
# Android 4.x usually needs to be built with arm-linux-androideabi...
if echo $MANIFEST_BRANCH |grep -qE 'android.2\.3'; then
p=`find $PWD/toolchain/bin/arm-eabi-gcc 2>/dev/null |head -n1`
else
p=`find $PWD/toolchain/bin/arm-linux-androideabi-gcc 2>/dev/null |head -n1`
fi
[ -z "$p" ] && p=`find $PWD/toolchain/bin/*-gcc |head -n1`
else
p=`find $PWD/toolchain/bin/$TOOLCHAIN_TRIPLET-gcc |head -n1`
fi
export TARGET_TOOLS_PREFIX=`echo $p | sed -e 's/-gcc$/-/'`
fi
if [ "$TOOLCHAIN_FINGERPRINT" != "0" -a -n "$toolchain_filename" ]; then
mkdir -p fingerprints
cp $toolchain_filename fingerprints/
fi
if test -z "$TARGET_ARCH_VARIANT" -a -z "$LUNCH"; then
TARGET_ARCH_VARIANT=armv7-a-neon
fi
if test -z "$WITH_HOST_DALVIK"; then
WITH_HOST_DALVIK=false
fi
SHOWCOMMANDS=
if test -z "$QUIET" || test "$QUIET" = "0"; then
SHOWCOMMANDS=showcommands
fi
if [ -n "$SOURCE_OVERLAY" ]; then
unpack_overlays "$SOURCE_OVERLAY"
fi
if [ -n "$EXTERNAL_TARBALL" ]; then
unpack_external_tarball "$EXTERNAL_TARBALL"
fi
if [ -x "${TARGET_TOOLS_PREFIX}gcc" ]; then
${TARGET_TOOLS_PREFIX}gcc -v
fi
if [ -z "$MAKE" ]; then
MAKE=make
fi
if ! is_on_ec2; then
export USE_CCACHE=1
export CCACHE_DIR=$PWD/.ccache
if [ ! -e ".ccache" ]; then
./prebuilts/misc/linux-x86/ccache/ccache -M 25G
fi
fi
trap - ERR
export TIMEFORMAT="TIME: Compilation: %lR"
time $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS $SHOWCOMMANDS WITH_HOST_DALVIK="$WITH_HOST_DALVIK" USE_CLANG_PLATFORM_BUILD="$USE_CLANG_PLATFORM_BUILD"
unset TIMEFORMAT
trap infrastructure_error ERR
# Show remaining disk space to catch early if
# we're approaching ramdisk limit again
echo "Remaining disk space after build:"
df
if [ -n "$BUILD_SYSROOT" ]; then
git clone git://git.linaro.org/android/toolchain/build.git toolchain-build
rm -rf /tmp/sysroot
toolchain-build/build-sysroot.sh out/target/product/`ls -1 out/target/product | head -n1` /tmp/sysroot
tar -cj -C /tmp/sysroot -f out/sysroot.tar.bz2 .
fi
fi
# Create filesystem images
if [ -n "$BUILD_FS_IMAGE" ]; then
FS_IMAGE_SIZE=${FS_IMAGE_SIZE-2G}
sudo linaro-android-media-create \
--dev `product2lamc_dev $TARGET_PRODUCT` \
--system $PWD/out/target/product/$TARGET_OUT_DIR/system.tar.bz2 \
--userdata $PWD/out/target/product/$TARGET_OUT_DIR/userdata.tar.bz2 \
--boot $PWD/out/target/product/$TARGET_OUT_DIR/boot.tar.bz2 \
--image-size "$FS_IMAGE_SIZE" \
--image-file out/target/product/$TARGET_OUT_DIR/$TARGET_PRODUCT.img
bzip2 -9 out/target/product/$TARGET_PRODUCT/$TARGET_PRODUCT.img
fi
# Store kernel .config as a build artifact
if [ -f kernel/.config ]; then
cp kernel/.config out/kernel_config
elif [ -f "out/target/product/$TARGET_OUT_DIR/obj/kernel/.config" ]; then
cp "out/target/product/$TARGET_OUT_DIR/obj/kernel/.config" out/kernel_config
fi
# Create md5sums file for platform artifacts
(cd out/target/product/${TARGET_OUT_DIR}/; md5sum *.tar.bz2 *.img >MD5SUMS) || true
(cd out/; ${BUILD_SCRIPT_ROOT}/create-user-build-script)
if [ -f out/kernel_config ]; then
(cd out/; ${BUILD_SCRIPT_ROOT}/create-user-kernel-script) || true
fi
if [ ! -n "$SKIP_LICENSE_CHECK" ]; then
${BUILD_SCRIPT_ROOT}/license-verification.sh out/pinned-manifest.xml out/target/product/$TARGET_PRODUCT/BUILD-INFO.txt
fi
if [ -n "$PUBLISH_DESCRIPTIONS" ]; then
${BUILD_SCRIPT_ROOT}/../utils/manifest-descriptions/make.sh out/source-manifest.xml out/pinned-manifest.xml
fi
flatten_artifacts
|