blob: ed08a9ec5afe3e46707761a2fbe87ba257b22c82 (
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
|
#!/bin/bash
# Script used by CI to build the ARM Trusted Firmware
error_count=0
built_count=0
function count_errors {
if [ $1 -ne 0 ]; then
error_count=$(($error_count + 1))
else
built_count=$(($built_count + 1))
fi
return $1
}
set -e
if [ -z "${WORKSPACE}" ]; then
# Local build
export WORKSPACE=`pwd`
export BUILD_NUMBER=${BUILD_NUMBER:-0}
export JOB_NAME=${JOB_NAME:-fvp-pre-boot}
fi
repo=arm-trusted-firmware
repo_url=/linaro/g.l.o/arm/
case "${JOB_NAME}" in
juno*)
platform=juno
;;
fvp*)
platform=fvp
;;
esac
case "${JOB_NAME}" in
juno-pre-boot|juno-firmware)
branch=juno
;;
fvp-pre-boot|fvp-base-firmware)
branch=fvp-base
;;
juno-pre-boot-master|juno-firmware-master|fvp-pre-boot-master|fvp-base-firmware-master)
branch=master
;;
juno-pre-boot-integration|juno-firmware-integration|fvp-pre-boot-integration|fvp-base-firmware-integration)
branch=integration
;;
*)
echo "Invalid JOB_NAME $JOB_NAME"
exit 1
;;
esac
echo "WORKSPACE ${WORKSPACE}"
echo "BUILD_NUMBER ${BUILD_NUMBER}"
echo "JOB_NAME ${JOB_NAME}"
echo "repo ${repo}"
echo "repo_url ${repo_url}"
echo "branch ${branch}"
pkg_source=${JOB_NAME}
pkg_repository=$repo_url/${repo}.git
if [ "${BUILD_NUMBER}" -eq 0 ]; then
rm -rf ${repo}
fi
if [ ! -d ${repo} ]; then
echo "Cloning ${repo}"
git clone --depth 1 ${pkg_repository} -b ${branch}
else
echo "${repo} already exists; cleaning..."
pushd ${repo}
git reset --hard HEAD
git clean -dfx
popd
fi
scm_commit=`cd ${repo} && git log -n1 --pretty=format:%h`
if [ -z "${scm_commit}" ]; then
echo "Invalid git revision: ${scm_commit}" >&2
exit 1
fi
unset ARCH
export builddir=${WORKSPACE}/${JOB_NAME}-build
export REPO_WORKSPACE=${WORKSPACE}/${repo}
export CROSS_COMPILE=${CROSS_COMPILE:-aarch64-linux-gnu-}
rm -rf ${builddir} && mkdir -p ${builddir}
# Create source tarball
cd ${REPO_WORKSPACE}
git checkout ${branch}
base_version=0.2.`date +%Y%m%d`
pkg_version=${base_version}+git${BUILD_NUMBER}+${scm_commit}
pkg_dir=${pkg_source}-${pkg_version}
pkg_tar=${builddir}/${pkg_source}_${pkg_version}.orig.tar
echo "pkg_dir=${pkg_dir}"
echo "pkg_source=${pkg_source}"
echo "pkg_version=${pkg_version}"
echo "pkg_tar=${pkg_tar}"
git archive --format=tar --prefix=${pkg_dir}/ ${branch} -o ${pkg_tar}
cd ${WORKSPACE}
# disable exit on error
set +e
################################################################################
JUNO_BL30=${REPO_WORKSPACE}/bin/bl30.bin
if [ "${platform}" == "juno" ] && [ "${BUILD_UEFI}" != "yes" ]; then
echo "Using pre-built binaries for Juno"
export BL30=${JUNO_BL30}
export BL33=${REPO_WORKSPACE}/bin/bl33.bin
echo "BL30=${BL30}"
echo "BL33=${BL33}"
else
# Get the UEFI tools
UEFI_TOOLS_DIR=${WORKSPACE}/uefi-tools
if [ ! -d ${UEFI_TOOLS_DIR} ]; then
git clone git://git.linaro.org/uefi/uefi-tools.git
fi
# Build the latest UEFI binary
case "${JOB_NAME}" in
juno*)
EDK_REPO=edk2
EDK_REPO_URL=git://git.linaro.org/landing-teams/working/arm/${EDK_REPO}.git
EDK_BRANCH=master
;;
fvp*)
#EDK_REPO=linaro-edk2
#EDK_REPO_URL=git://git.linaro.org/uefi/${EDK_REPO}.git
#EDK_BRANCH=release-prep
EDK_REPO=edk2
EDK_REPO_URL=git://git.linaro.org/landing-teams/working/arm/${EDK_REPO}.git
EDK_BRANCH=master
;;
esac
EDK_WORKSPACE=${WORKSPACE}/${EDK_REPO}
echo "EDK_REPO=${EDK_REPO}"
echo "EDK_WORKSPACE=${EDK_WORKSPACE}"
echo "EDK_BRANCH=${EDK_BRANCH}"
if [ ! -d ${EDK_REPO} ]; then
echo "UEFI dir does not exist"
git clone --depth 1 ${EDK_REPO_URL} -b ${EDK_BRANCH}
else
echo "UEFI dir already exists; cleaning..."
cd ${EDK_WORKSPACE}
git reset --hard HEAD
git clean -dfx
fi
# Create the tarball of the UEFI source
cd ${EDK_WORKSPACE}
scm_commit=`git log -n1 --pretty=format:%h`
if [ -z "${scm_commit}" ]; then
echo "Invalid git revision: ${scm_commit}" >&2
exit 1
fi
edk_pkg_source=linaro-edk2-release
edk_pkg_version=${base_version}+git${BUILD_NUMBER}+${scm_commit}
edk_pkg_dir=${edk_pkg_source}-${edk_pkg_version}
echo "edk_pkg_source=$edk_pkg_source"
echo "edk_pkg_version=$edk_pkg_version"
echo "edk_pkg_dir=$edk_pkg_dir"
git archive --format=tar --prefix=${edk_pkg_dir}/ ${EDK_BRANCH} -o uefi.tar
tar --concatenate --file=${pkg_tar} uefi.tar
bzip2 ${pkg_tar}
cd ${EDK_WORKSPACE}
# Fix WORKSPACE environment variable conflict with Jenkins
find ${EDK_WORKSPACE} -type f | xargs sed -i 's/WORKSPACE/EDK_WORKSPACE/g'
export TARGET=${TARGET:-RELEASE}
case "${platform}" in
juno)
${UEFI_TOOLS_DIR}/uefi-build.sh -b ${TARGET} juno
count_errors $?
export BL30=${JUNO_BL30}
export BL33=`pwd`/`find . -name BL32_AP_UEFI.fd`
cp -a ${BL33} ${builddir}/uefi_juno.bin
;;
fvp)
${UEFI_TOOLS_DIR}/uefi-build.sh -b ${TARGET} fvp_minimal
count_errors $?
export BL33=`pwd`/`find . -name FVP_AARCH64_EFI.fd`
cp -a ${BL33} ${builddir}/uefi_fvp-base.bin
;;
esac
fi
################################################################################
# Build the ARM Trusted Firmware binaries (BL1, BL2 and BL31)
cd ${REPO_WORKSPACE}
make PLAT=${platform} all fip
count_errors $?
# Copy the ARM Trusted Firmware binaries into the build directory
cp -a ${REPO_WORKSPACE}/build/${platform}/release/bl1.bin ${builddir}/${platform}_bl1.bin
cp -a ${REPO_WORKSPACE}/build/${platform}/release/bl2.bin ${builddir}/${platform}_bl2.bin
cp -a ${REPO_WORKSPACE}/build/${platform}/release/bl31.bin ${builddir}/${platform}_bl31.bin
cp -a ${REPO_WORKSPACE}/build/${platform}/release/fip.bin ${builddir}/${platform}_fip.bin
# If nothing build, return an error
if [ $built_count -eq 0 ]; then
exit $error_count
fi
# We want to return 0 if something built so that the files get copied to snapshots.linaro.org
exit 0
|