blob: ee4937f6e249c9d1c9e98236bc7278ed13adda56 (
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
|
###############################################################################
# Copyright (c) 2011 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
###############################################################################
set -o errtrace
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 [ -n "$BUILD_COPYCAT" ]; then
download_another_build "$BUILD_COPYCAT"
else
if [ -n "$REPO_SEED_URL" ]; then
repo-sync-from-seed "${1}"
else
repo-sync-from-mirror "${1}"
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
# 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
MAKE_TARGETS="${MAKE_TARGETS-boottarball systemtarball userdatatarball}"
calc_make_jobs
if test -n "$TOOLCHAIN_URL"; then
wget -nv --no-check-certificate $TOOLCHAIN_URL
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"; 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
trap - ERR
export TIMEFORMAT="TIME: Compilation: %lR"
time $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS $SHOWCOMMANDS WITH_HOST_DALVIK="$WITH_HOST_DALVIK" HOST_CC=gcc-4.5 HOST_CXX=g++-4.5 HOST_CPP=cpp-4.5
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_PRODUCT/system.tar.bz2 \
--userdata $PWD/out/target/product/$TARGET_PRODUCT/userdata.tar.bz2 \
--boot $PWD/out/target/product/$TARGET_PRODUCT/boot.tar.bz2 \
--image-size "$FS_IMAGE_SIZE" \
--image-file out/target/product/$TARGET_PRODUCT/$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_PRODUCT/obj/kernel/.config" ]; then
cp "out/target/product/$TARGET_PRODUCT/obj/kernel/.config" out/kernel_config
fi
# Create md5sums file for platform artifacts
(cd out/target/product/*/; md5sum *.tar.bz2 >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)
fi
# add EULA support
(
if [[ "$JOB_NAME" =~ .*blob.* && ("$JOB_NAME" =~ .*origen.* || "$JOB_NAME" =~ .*snowball.*) ]]
then
eula="EULA.txt"
else
eula="OPEN-EULA.txt"
fi
touch out/OPEN-EULA.txt
cd out/target/product/*/
touch $eula
) || true
|