blob: b4a5f871d81a87a66e370e756a9d1733986d10a9 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Yann Gautier47193692024-04-19 14:57:26 +02003# Copyright (c) 2019-2024, Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# This file is meant to be SOURCED only after setting $ci_root. $ci_root must be
9# the absolute path to the root of the CI repository
10#
11# A convenient way to set ci_root from the calling script like this:
12# ci_root="$(readlink -f "$(dirname "$0")/..")"
13#
14
15# Accept root of CI location from $CI_ROOT or $ci_root, in that order
16ci_root="${ci_root:-$CI_ROOT}"
17ci_root="${ci_root:?}"
18
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020019# Optionally source a file containing environmental settings.
20if [ -n "$host_env" ]; then
21 source "$host_env"
22else
23 # Are we running on Arm infrastructure?
Saheer Babubdb0d652025-02-10 14:08:20 +000024 if echo "$JENKINS_PUBLIC_URL" | grep -q "oss.arm.com"; then
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020025 source "$ci_root/arm-env.sh"
Saheer Babu734e6d62025-02-10 10:32:19 +000026 elif echo "$JENKINS_PUBLIC_URL" | grep -q "jenkins.openci"; then
27 # This is Arm infrastructure while migration from ci.trustedfirmware.org
28 source "$ci_root/openci-env.sh"
Saheer Babubdb0d652025-02-10 14:08:20 +000029 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.trustedfirmware.org"; then
Paul Sokolovsky58df3242023-07-31 14:28:41 +030030 if echo "$TF_GERRIT_BRANCH" | grep -q "lts-v2.8"; then
laurenw-armc74b20b2023-07-10 15:05:43 -050031 source "$ci_root/openci-lts-v2.8-env.sh"
32 else
33 source "$ci_root/openci-env.sh"
34 fi
Saheer Babubdb0d652025-02-10 14:08:20 +000035 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.staging.trustedfirmware.org"; then
Chris Kayfa20ea92022-12-19 16:56:51 +000036 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020037 fi
38fi
39
Fathi Boudra422bf772019-12-02 11:10:16 +020040# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
41nfs_volume="${nfs_volume:-$NFS_VOLUME}"
42nfs_volume="${nfs_volume:?}"
43
44# Override workspace for local runs
45workspace="${workspace:-$WORKSPACE}"
46workspace="${workspace:?}"
47workspace="$(readlink -f "$workspace")"
48artefacts="$workspace/artefacts"
49
50# pushd and popd outputs the directory stack every time, which could be
51# confusing when shown on the log. Suppress its output.
52pushd() {
53 builtin pushd "$1" &>/dev/null
54}
55popd() {
56 builtin popd &>/dev/null
57}
58
59# Copy a file to the $archive directory
60archive_file() {
61 local f out target md5
62 f="${1:?}"
63
64 out="${archive:?}"
65 [ ! -d "$out" ] && die "$out is not a directory"
66
67 target="$out/$(basename $f)"
68 if [ -f "$target" ]; then
69 # Prevent same file error
70 if [ "$(stat --format=%i "$target")" = \
71 "$(stat --format=%i "$f")" ]; then
72 return
73 fi
74 fi
75
76 md5="$(md5sum "$f" | awk '{print $1}')"
77 cp -t "$out" "$f"
78 echo "Archived: $f (md5: $md5)"
79}
80
81die() {
82 [ "$1" ] && echo "$1" >&2
83 exit 1
84}
85
86# Emit environment variables for the purpose of sourcing from shells and as
87# Jenkins property files. Whether the RHS is quoted depends on "$quote".
88emit_env() {
89 local env_file="${env_file:?}"
90 local var="${1:?}"
91
92 # Value parameter is mandatory, but allow for it to be empty
93 local val="${2?}"
94
95 if upon "$quote"; then
96 val="\"$val\""
97 else
98 # If RHS is not required to be quoted, any white space in it
99 # won't go well with a shell sourcing this file.
100 if echo "$var" | grep -q '\s'; then
101 die "$var: value '$val' has white space"
102 fi
103 fi
104
105 echo "$var=$val" >> "$env_file"
106}
107
Fathi Boudra422bf772019-12-02 11:10:16 +0200108fetch_directory() {
109 local base="$(basename "${url:?}")"
110 local sa
111
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200112 case "${url}" in
113 http*://*)
114 # Have exactly one trailing /
115 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200116
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200117 # Figure out the number of components between hostname and the
118 # final one
119 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
120 sa="${saveas:-$base}"
121 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500122 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200123 --reject="index.html*" "$modified_url"
124 if [ "$sa" != "$base" ]; then
125 mv "$base" "$sa"
126 fi
127 ;;
128 file://*)
129 sa="${saveas:-.}"
130 echo "Fetch: ${url} -> $sa"
131 cp -r "${url#file://}" "$sa"
132 ;;
133 *)
134 sa="${saveas:-.}"
135 echo "Fetch: ${url} -> $sa"
136 cp -r "${url}" "$sa"
137 ;;
138 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200139}
140
141fetch_file() {
142 local url="${url:?}"
143 local sa
144 local saveas
145
146 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200147 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200148 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200149 echo "Fetch: $url -> $saveas"
150 # Use curl to support file protocol
Paul Sokolovskycd93b372023-02-06 11:30:00 +0700151 curl --fail --connect-timeout 5 --retry 5 -sLS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200152 else
153 sa="${saveas-.}"
154 echo "Fetch: $url -> $sa"
155 cp "$url" "$sa"
156 fi
157}
158
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100159fetch_and_archive() {
160 url=${url:?}
161 filename=${filename:-basename $url}
162
163 url="$url" saveas="$filename" fetch_file
164 archive_file "$filename"
165}
166
167filter_artefacts(){
168 local model_param_file="${model_param_file-$archive/model_params}"
169
170 # Bash doesn't have array values, we have to create references to the
171 # array of artefacts and the artefact filters.
172 declare -ga "$1"
173 declare -n artefacts="$1"
174 declare -n filters="$2"
175
176 for artefact in "${!filters[@]}"; do
177 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
178 artefacts+=("${artefact}")
179 fi
180 done
181}
182
183gen_lava_job_def() {
184 local yaml_template_file="${yaml_template_file:?}"
185 local yaml_file="${yaml_file:?}"
186 local yaml_job_file="${yaml_job_file}"
187
188 # Bash doesn't have array values, we have to create references to the
189 # array of artefacts and their urls.
190 declare -n artefacts="$1"
191 declare -n artefact_urls="$2"
192
193 readarray -t boot_arguments < "${lava_model_params}"
194
195 # Generate the LAVA job definition, minus the test expectations
196 expand_template "${yaml_template_file}" > "${yaml_file}"
197
198 if [[ ! $model =~ "qemu" ]]; then
199 # Append expect commands into the job definition through
200 # test-interactive commands
201 gen_fvp_yaml_expect >> "$yaml_file"
202 fi
203
204 # create job.yaml
205 cp "$yaml_file" "$yaml_job_file"
206
207 # archive both yamls
208 archive_file "$yaml_file"
209 archive_file "$yaml_job_file"
210}
211
212gen_lava_model_params() {
213 local lava_model_params="${lava_model_params:?}"
214 declare -n macros="$1"
215
216 # Derive LAVA model parameters from the non-LAVA ones
217 cp "${archive}/model_params" "${lava_model_params}"
218
219 if [[ $model =~ "qemu" ]]; then
220 # Strip the model parameters of parameters already specified in the deploy
221 # overlay and job context.
222 sed -i '/-M/d;/kernel/d;/initrd/d;/bios/d;/cpu/d;/^[[:space:]]*$/d' \
223 $lava_model_params
224 elif [[ ! $model =~ "qemu" ]]; then
225 # FIXME find a way to properly match FVP configurations.
226 # Ensure braces in the FVP model parameters are not accidentally
227 # interpreted as LAVA macros.
228 sed -i -e 's/{/{{/g' "${lava_model_params}"
229 sed -i -e 's/}/}}/g' "${lava_model_params}"
230 else
231 echo "Unsupported emulated platform $model."
232 fi
233
234 # LAVA expects binary paths as macros, i.e. `{X}` instead of `x.bin`, so
235 # replace the file paths in our pre-generated model parameters.
236 for regex in "${!macros[@]}"; do
237 sed -i -e "s!${regex}!${macros[${regex}]}!" "${lava_model_params}"
238 done
239}
240
241gen_yaml_template() {
242 local target="${target-fvp}"
243 local yaml_template_file="${yaml_template_file-$workspace/${target}_template.yaml}"
244
245 local payload_type="${payload_type:?}"
246
247 cp "${ci_root}/script/lava-templates/${target}-${payload_type:?}.yaml" \
248 "${yaml_template_file}"
249
250 archive_file "$yaml_template_file"
251}
252
253# Generate link to an archived binary.
254gen_bin_url() {
255 local bin_mode="${bin_mode:?}"
256 local bin="${1:?}"
257
258 if upon "$jenkins_run"; then
259 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
260 else
261 echo "file://$workspace/artefacts/$bin_mode/$bin"
262 fi
263}
264
265get_kernel() {
266 local kernel_type="${kernel_type:?}"
267 local url="${plat_kernel_list[$kernel_type]}"
268
269 url="${url:?}" filename="kernel.bin" fetch_and_archive
270}
271
Chris Kaya75c0a62022-11-17 18:53:50 +0000272# Get the path to the run environment variables file.
273#
274# Run environment variables are the test-specific environment variables
275# configured by the CI's test configuration.
276#
277# Usage: get_run_env_path <archive>
278get_run_env_path() {
279 echo "${1:?}/run/env"
280}
281
282# Get a run environment variable.
283#
284# Run environment variables are the test-specific environment variables
285# configured by the CI's test configuration.
286#
287# Usage: get_run_env <archive> <variable> [default]
288get_run_env() {
289 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
290 . "$(get_run_env_path "${1:?}")"
291 fi
292
293 echo "${!2:-${3}}"
294}
295
296# Get the number of UARTs configured by the current test configuration. This
297# defaults to `4`.
298#
299# Usage: get_num_uarts <archive> [default]
300get_num_uarts() {
301 local default=4
302
303 get_run_env "${1:?}" num_uarts "${2-${default}}"
304}
305
306# Get the ports script configured by the current test configuration. This
307# defaults to `script/default-ports-script.awk`.
308#
309# Usage: get_ports_script <archive> [default]
310get_ports_script() {
311 local default="${ci_root}/script/default-ports-script.awk"
312
313 get_run_env "${1:?}" ports_script "${2-${default}}"
314}
315
316# Get the primary UART configured by the current test configuration. This
317# defaults to `0`.
318#
319# Usage: get_primary_uart <archive> [default]
320get_primary_uart() {
321 local default=0
322
323 get_run_env "${1:?}" primary_uart "${2-${default}}"
324}
325
326# Get the payload UART configured by the current test configuration. This
327# defaults to the primary UART.
328#
329# Usage: get_payload_uart <archive> [default]
330get_payload_uart() {
331 local default="$(get_primary_uart "${1:?}")"
332
333 get_run_env "${1:?}" payload_uart "${2-${default}}"
334}
335
336# Get the path to a UART's environment variable directory.
337#
338# UART environment variables are the UART-specific environment variables
339# configured by the CI's test configuration.
340#
341# Usage: get_uart_env_path <archive> <uart>
342get_uart_env_path() {
343 echo "${1:?}/run/uart${2:?}"
344}
345
346# Get a UART environment variable.
347#
348# UART environment variables are the UART-specific environment variables
349# configured by the CI's test configuration.
350#
351# Usage: get_uart_env <archive> <uart> <variable> [default]
352get_uart_env() {
353 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
354 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
355 else
Chris Kay3a968862022-11-17 19:18:32 +0000356 echo "${!3-${4}}"
Chris Kaya75c0a62022-11-17 18:53:50 +0000357 fi
358}
359
360# Get the path to the Expect script for a given UART. This defaults to nothing.
361#
362# Usage: get_uart_expect_script <archive> <uart> [default]
363get_uart_expect_script() {
364 local default=
365
366 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
367}
368
369# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
370#
371# Usage: get_uart_port <archive> <uart> [default]
372get_uart_port() {
373 local default="$(( 5000 + "${2:?}" ))"
374
375 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
376}
377
Chris Kay49437462022-11-23 12:53:30 +0000378# Set a UART environment variable.
379#
380# UART environment variables are the UART-specific environment variables
381# configured by the CI's test configuration.
382#
383# Usage: set_uart_env <archive> <uart> <variable> <value>
384set_uart_env() {
385 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
386
387 mkdir -p "${path}" && \
388 echo "${4:?}" > "${path}/${3:?}"
389}
390
391# Set the FVP port for a given UART.
392#
393# Usage: set_uart_port <archive> <uart> <port>
394set_uart_port() {
395 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
396}
397
Fathi Boudra422bf772019-12-02 11:10:16 +0200398# Make a temporary directory/file insdie workspace, so that it doesn't need to
399# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
400mktempdir() {
401 local ws="${workspace:?}"
402
403 mktemp -d --tmpdir="$ws"
404}
405mktempfile() {
406 local ws="${workspace:?}"
407
408 mktemp --tmpdir="$ws"
409}
410
411not_upon() {
412 ! upon "$1"
413}
414
415# Use "$1" as a boolean
416upon() {
417 case "$1" in
418 "" | "0" | "false") return 1;;
419 *) return 0;;
420 esac
421}
422
423# Check if the argument is a URL
424is_url() {
425 echo "$1" | grep -q "://"
426}
427
428# Check if a path is absolute
429is_abs() {
430 [ "${1:0:1}" = "/" ]
431}
432
433# Unset a variable based on its boolean value
434# If foo=, foo will be unset
435# If foo=blah, then leave it as is
436reset_var() {
437 local var="$1"
438 local val="${!var}"
439
440 if [ -z "$val" ]; then
441 unset "$var"
442 else
443 var="$val"
444 fi
445}
446
447default_var() {
448 local var="$1"
449 local val="${!var}"
450 local default="$2"
451
452 if [ -z "$val" ]; then
453 eval "$var=$default"
454 fi
455}
456
457# String various items joined by ":" to form a path. Items are prepended by
458# default; or 'op' can be set to 'append' to have them appended.
459# For example, to set: PATH=foo:bar:baz:$PATH
460extend_path() {
461 local path_var="$1"
462 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500463 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200464 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500465 local sep=':'
466 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200467
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500468 eval "array_val=\"\${$array_var[@]}\""
469 array_val="$(echo ${array_val// /:})"
470
471 [ -z "$path_val" ] && sep=''
472
473 if [ "$op" = "prepend" ]; then
474 array_val="${array_val}${sep}${path_val}"
475 elif [ "$op" = "append" ]; then
476 array_val="${path_val}${sep}${array_val}"
477 fi
478
479 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200480}
481
Chris Kay3d807882022-08-31 16:00:02 +0100482# Expand and evaluate Bash variables and expressions in a file, whose path is
483# given by the first parameter.
484#
485# For example, to expand a file containing the following:
486#
487# My name is ${name}!
488#
489# You might use:
490#
491# name="Chris" expand_template "path-to-my-file.txt"
492#
493# This would yield:
494#
495# My name is Chris!
496#
497# If you need to run multiple expansions on a file (e.g. to fill out information
498# incrementally), then you can escape expansion of a variable with a backslash,
499# e.g. `\${name}`.
500#
501# The expanded output is printed to the standard output stream.
502expand_template() {
503 local path="$1"
504
505 eval "cat <<-EOF
506 $(<${path})
507 EOF"
508}
509
Harrison Mutai013f6332022-02-16 16:06:33 +0000510# Fetch and extract the latest supported version of the LLVM toolchain from
511# a compressed archive file to a target directory, if it is required.
512setup_llvm_toolchain() {
513 link="${1:-$llvm_archive}"
514 archive="${2:-"$workspace/llvm.tar.xz"}"
515 target_dir="${3:-$llvm_dir}"
516
517 if is_arm_jenkins_env || upon "$local_ci"; then
518 url="$link" saveas="$archive" fetch_file
519 mkdir -p $target_dir
520 extract_tarball $archive $target_dir --strip-components=1 -k
521 fi
522}
523
524# Extract files from compressed archive to target directory. Supports .zip,
525# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500526extract_tarball() {
527 local archive="$1"
528 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500529 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500530
531 pushd "$target_dir"
532 case $(file --mime-type -b "$archive") in
533 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500534 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500535 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500536 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500537 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500538 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000539 application/x-xz)
540 tar -x $extra_params -f $archive
541 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500542 esac
Zelalem219df412020-05-17 19:21:20 -0500543 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500544}
545
Gary Morrison999a9d72022-03-14 18:29:06 -0500546# See if execution is done by Jenkins. If called with a parameter,
547# representing a 'domain', e.g. arm.com, it will also check if
Saheer Babubdb0d652025-02-10 14:08:20 +0000548# JENKINS_PUBLIC_URL contains the latter.
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500549is_jenkins_env () {
550 local domain="${1-}"
551
552 # check if running under Jenkins, if not, return non-zero
553 # the checks assumes Jenkins executing if JENKINS_HOME is set
554 [ -z "$JENKINS_HOME" ] && return 1
555
556 # if no parameter passed, no more checks, quit
557 [ -z "$domain" ] && return 0
558
Saheer Babubdb0d652025-02-10 14:08:20 +0000559 if echo "$JENKINS_PUBLIC_URL" | grep -q "$domain"; then
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500560 return 0
561 fi
562
563 return 1
564}
565
566
567# Check if execution is under ARM's jenkins
568is_arm_jenkins_env() {
Saheer Babu48e5f132025-01-08 16:32:17 +0000569 local arm_domain="oss.arm.com"
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500570 return $(is_jenkins_env "$arm_domain")
571}
572
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600573
574# Provide correct linaro cross toolchain based on environment
575set_cross_compile_gcc_linaro_toolchain() {
576 local cross_compile_path="/home/buildslave/tools"
577
578 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600579 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600580
581 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
582}
583
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500584if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200585 jenkins_run=1
586 umask 0002
587else
588 unset jenkins_run
589fi
590
591# Project scratch location for Trusted Firmware CI
592project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
593project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
594warehouse="${nfs_volume}/warehouse"
Saheer Babubdb0d652025-02-10 14:08:20 +0000595jenkins_url="${JENKINS_PUBLIC_URL%/*}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200596jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
597
598# Model revisions
Govindraj Raja74e5b452024-06-18 13:34:17 -0500599model_version_11_24="${model_version:-11.24}"
600model_build_11_24="${model_build:-24}"
601
Govindraj Rajae2415462024-06-04 14:50:28 -0500602model_version="${model_version:-11.26}"
603model_build="${model_build:-11}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100604model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200605
606# Model snapshots from filer are not normally not accessible from developer
607# systems. Ignore failures from picking real path for local runs.
608pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
609pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
610
Fathi Boudra422bf772019-12-02 11:10:16 +0200611tforg_gerrit_url="review.trustedfirmware.org"
612
613# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
614# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200615tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
616tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200617tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
618tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500619ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
620ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500621tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200622scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100623scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100624spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
625spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200626
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500627tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200628tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
629css_downloads="${css_downloads:-$tfa_downloads/css}"
630
Jayanth Dodderi Chidanandbf7369d2022-04-06 10:59:14 +0100631# SCP/MCP v2.10.0 release binaries.
Manish V Badarkhe83e4b8d2022-10-26 12:02:41 +0100632scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000633
Leonardo Sandoval15676062020-11-19 11:58:09 -0600634linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100635linaro_release="${linaro_release:-$linaro_2001_release}"
Ryan Everetta6bbfb72024-11-26 11:43:36 +0000636mbedtls_version="${mbedtls_version:-3.6.2}"
Zelalem219df412020-05-17 19:21:20 -0500637
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500638# mbedTLS archive public hosting available at github.com
Sandrine Bailleuxdf823892022-04-22 13:27:45 +0200639mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200640
Harrison Mutai013f6332022-02-16 16:06:33 +0000641# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
642# LLVM archive public hosting available at github.com
643llvm_version="${llvm_version:-14.0.0}"
644llvm_dir="$workspace/llvm-$llvm_version"
645llvm_archive="${llvm_archive:-https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvm_version/clang+llvm-$llvm_version-x86_64-linux-gnu-ubuntu-18.04.tar.xz}"
646
Mark Dykes30138ad2021-11-09 16:48:17 -0600647coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200648coverity_default_checkers=(
649"--all"
650"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200651"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500652"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200653"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200654"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500655"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200656)
657
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500658docker_registry="${docker_registry:-}"
659
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500660# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100661toolchain_version="11.3.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500662
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100663aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500664aarch64_none_elf_prefix="aarch64-none-elf-"
665
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100666arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500667arm_none_eabi_prefix="arm-none-eabi-"
668
Fathi Boudra422bf772019-12-02 11:10:16 +0200669path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500670 "${aarch64_none_elf_dir}/bin"
671 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000672 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500673 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
674 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200675)
676
677ld_library_path_list=(
678)
679
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200680license_path_list=${license_path_list-(
681)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200682
683# Setup various paths
684if upon "$retain_paths"; then
685 # If explicitly requested, retain local paths; apppend CI paths to the
686 # existing ones.
687 op="append" extend_path "PATH" "path_list"
688 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
689 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
690else
691 # Otherwise, prepend CI paths so that they take effect before local ones
692 extend_path "PATH" "path_list"
693 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
694 extend_path "LM_LICENSE_FILE" "license_path_list"
695fi
696
697export LD_LIBRARY_PATH
698export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200699export ARM_TOOL_VARIANT=ult
700
701# vim: set tw=80 sw=8 noet: