blob: 008f9456cefb6687bdee65d26a79cd6bd9b7e228 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Govindraj Raja5e709b22023-02-09 10:21:24 +00003# Copyright (c) 2019-2023, 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?
Gary Morrison999a9d72022-03-14 18:29:06 -050024 if echo "$JENKINS_URL" | grep -q "oss.arm.com"; then
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020025 source "$ci_root/arm-env.sh"
Chris Kay7c542f22022-11-18 11:42:59 +000026 elif echo "$JENKINS_URL" | grep -q "ci.trustedfirmware.org"; then
27 source "$ci_root/openci-env.sh"
Chris Kay73a91b02022-12-19 16:56:51 +000028 elif echo "$JENKINS_URL" | grep -q "ci.staging.trustedfirmware.org"; then
29 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020030 fi
31fi
32
Fathi Boudra422bf772019-12-02 11:10:16 +020033# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
34nfs_volume="${nfs_volume:-$NFS_VOLUME}"
35nfs_volume="${nfs_volume:?}"
36
37# Override workspace for local runs
38workspace="${workspace:-$WORKSPACE}"
39workspace="${workspace:?}"
40workspace="$(readlink -f "$workspace")"
41artefacts="$workspace/artefacts"
42
43# pushd and popd outputs the directory stack every time, which could be
44# confusing when shown on the log. Suppress its output.
45pushd() {
46 builtin pushd "$1" &>/dev/null
47}
48popd() {
49 builtin popd &>/dev/null
50}
51
52# Copy a file to the $archive directory
53archive_file() {
54 local f out target md5
55 f="${1:?}"
56
57 out="${archive:?}"
58 [ ! -d "$out" ] && die "$out is not a directory"
59
60 target="$out/$(basename $f)"
61 if [ -f "$target" ]; then
62 # Prevent same file error
63 if [ "$(stat --format=%i "$target")" = \
64 "$(stat --format=%i "$f")" ]; then
65 return
66 fi
67 fi
68
69 md5="$(md5sum "$f" | awk '{print $1}')"
70 cp -t "$out" "$f"
71 echo "Archived: $f (md5: $md5)"
72}
73
74die() {
75 [ "$1" ] && echo "$1" >&2
76 exit 1
77}
78
79# Emit environment variables for the purpose of sourcing from shells and as
80# Jenkins property files. Whether the RHS is quoted depends on "$quote".
81emit_env() {
82 local env_file="${env_file:?}"
83 local var="${1:?}"
84
85 # Value parameter is mandatory, but allow for it to be empty
86 local val="${2?}"
87
88 if upon "$quote"; then
89 val="\"$val\""
90 else
91 # If RHS is not required to be quoted, any white space in it
92 # won't go well with a shell sourcing this file.
93 if echo "$var" | grep -q '\s'; then
94 die "$var: value '$val' has white space"
95 fi
96 fi
97
98 echo "$var=$val" >> "$env_file"
99}
100
Fathi Boudra422bf772019-12-02 11:10:16 +0200101fetch_directory() {
102 local base="$(basename "${url:?}")"
103 local sa
104
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200105 case "${url}" in
106 http*://*)
107 # Have exactly one trailing /
108 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200109
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200110 # Figure out the number of components between hostname and the
111 # final one
112 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
113 sa="${saveas:-$base}"
114 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500115 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200116 --reject="index.html*" "$modified_url"
117 if [ "$sa" != "$base" ]; then
118 mv "$base" "$sa"
119 fi
120 ;;
121 file://*)
122 sa="${saveas:-.}"
123 echo "Fetch: ${url} -> $sa"
124 cp -r "${url#file://}" "$sa"
125 ;;
126 *)
127 sa="${saveas:-.}"
128 echo "Fetch: ${url} -> $sa"
129 cp -r "${url}" "$sa"
130 ;;
131 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200132}
133
134fetch_file() {
135 local url="${url:?}"
136 local sa
137 local saveas
138
139 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200140 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200141 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200142 echo "Fetch: $url -> $saveas"
143 # Use curl to support file protocol
Paul Sokolovsky532a4882023-05-22 15:50:04 +0300144 curl --fail --no-progress-meter --connect-timeout 10 --retry 6 -LS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200145 else
146 sa="${saveas-.}"
147 echo "Fetch: $url -> $sa"
148 cp "$url" "$sa"
149 fi
150}
151
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100152fetch_and_archive() {
153 url=${url:?}
154 filename=${filename:-basename $url}
155
156 url="$url" saveas="$filename" fetch_file
157 archive_file "$filename"
158}
159
160filter_artefacts(){
161 local model_param_file="${model_param_file-$archive/model_params}"
162
163 # Bash doesn't have array values, we have to create references to the
164 # array of artefacts and the artefact filters.
165 declare -ga "$1"
166 declare -n artefacts="$1"
167 declare -n filters="$2"
168
169 for artefact in "${!filters[@]}"; do
170 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
171 artefacts+=("${artefact}")
172 fi
173 done
174}
175
176gen_lava_job_def() {
177 local yaml_template_file="${yaml_template_file:?}"
178 local yaml_file="${yaml_file:?}"
179 local yaml_job_file="${yaml_job_file}"
180
181 # Bash doesn't have array values, we have to create references to the
182 # array of artefacts and their urls.
183 declare -n artefacts="$1"
184 declare -n artefact_urls="$2"
185
186 readarray -t boot_arguments < "${lava_model_params}"
187
Harrison Mutaia6d6e682023-03-27 13:20:33 +0100188 # Source runtime environment variables now so that they are accessible from
189 # the LAVA job template.
190 local run_root="${archive}/run"
191 local run_env="${run_root}/env"
192
193 if [ -f "${run_env}" ]; then
194 source "${run_env}"
195 fi
196
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100197 # Generate the LAVA job definition, minus the test expectations
198 expand_template "${yaml_template_file}" > "${yaml_file}"
199
200 if [[ ! $model =~ "qemu" ]]; then
201 # Append expect commands into the job definition through
202 # test-interactive commands
203 gen_fvp_yaml_expect >> "$yaml_file"
204 fi
205
206 # create job.yaml
207 cp "$yaml_file" "$yaml_job_file"
208
209 # archive both yamls
210 archive_file "$yaml_file"
211 archive_file "$yaml_job_file"
212}
213
214gen_lava_model_params() {
215 local lava_model_params="${lava_model_params:?}"
216 declare -n macros="$1"
217
218 # Derive LAVA model parameters from the non-LAVA ones
219 cp "${archive}/model_params" "${lava_model_params}"
220
221 if [[ $model =~ "qemu" ]]; then
222 # Strip the model parameters of parameters already specified in the deploy
223 # overlay and job context.
224 sed -i '/-M/d;/kernel/d;/initrd/d;/bios/d;/cpu/d;/^[[:space:]]*$/d' \
225 $lava_model_params
226 elif [[ ! $model =~ "qemu" ]]; then
227 # FIXME find a way to properly match FVP configurations.
228 # Ensure braces in the FVP model parameters are not accidentally
229 # interpreted as LAVA macros.
230 sed -i -e 's/{/{{/g' "${lava_model_params}"
231 sed -i -e 's/}/}}/g' "${lava_model_params}"
232 else
233 echo "Unsupported emulated platform $model."
234 fi
235
236 # LAVA expects binary paths as macros, i.e. `{X}` instead of `x.bin`, so
237 # replace the file paths in our pre-generated model parameters.
238 for regex in "${!macros[@]}"; do
239 sed -i -e "s!${regex}!${macros[${regex}]}!" "${lava_model_params}"
240 done
241}
242
243gen_yaml_template() {
244 local target="${target-fvp}"
245 local yaml_template_file="${yaml_template_file-$workspace/${target}_template.yaml}"
246
247 local payload_type="${payload_type:?}"
248
249 cp "${ci_root}/script/lava-templates/${target}-${payload_type:?}.yaml" \
250 "${yaml_template_file}"
251
252 archive_file "$yaml_template_file"
253}
254
255# Generate link to an archived binary.
256gen_bin_url() {
257 local bin_mode="${bin_mode:?}"
258 local bin="${1:?}"
259
260 if upon "$jenkins_run"; then
261 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
262 else
263 echo "file://$workspace/artefacts/$bin_mode/$bin"
264 fi
265}
266
Harrison Mutaid993ce12023-03-27 13:21:28 +0100267get_boot_image() {
268 local image=${image:?}
269 local type=${type:?}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100270
Harrison Mutaid993ce12023-03-27 13:21:28 +0100271 declare -n image_list=${image_list-${image}_list}
272
273 local url="${image_list[${type}]}"
274
275 url="${url:?}" filename="${image}.bin" fetch_and_archive
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100276}
277
Harrison Mutaid993ce12023-03-27 13:21:28 +0100278get_boot_image_from_fip() {(
279 local url="${url:?}"
280 local image="${image:?}"
281 local output_name="${output_name-bl32.bin}"
282
283 cd "$(mktempdir)"
284
285 extract_fip "$url"
286 mv "$image" "$output_name"
287 archive_file "$output_name"
288)}
289
Chris Kay03ffbe72022-11-17 18:53:50 +0000290# Get the path to the run environment variables file.
291#
292# Run environment variables are the test-specific environment variables
293# configured by the CI's test configuration.
294#
295# Usage: get_run_env_path <archive>
296get_run_env_path() {
297 echo "${1:?}/run/env"
298}
299
300# Get a run environment variable.
301#
302# Run environment variables are the test-specific environment variables
303# configured by the CI's test configuration.
304#
305# Usage: get_run_env <archive> <variable> [default]
306get_run_env() {
307 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
308 . "$(get_run_env_path "${1:?}")"
309 fi
310
311 echo "${!2:-${3}}"
312}
313
314# Get the number of UARTs configured by the current test configuration. This
315# defaults to `4`.
316#
317# Usage: get_num_uarts <archive> [default]
318get_num_uarts() {
319 local default=4
320
321 get_run_env "${1:?}" num_uarts "${2-${default}}"
322}
323
324# Get the ports script configured by the current test configuration. This
325# defaults to `script/default-ports-script.awk`.
326#
327# Usage: get_ports_script <archive> [default]
328get_ports_script() {
329 local default="${ci_root}/script/default-ports-script.awk"
330
331 get_run_env "${1:?}" ports_script "${2-${default}}"
332}
333
334# Get the primary UART configured by the current test configuration. This
335# defaults to `0`.
336#
337# Usage: get_primary_uart <archive> [default]
338get_primary_uart() {
339 local default=0
340
341 get_run_env "${1:?}" primary_uart "${2-${default}}"
342}
343
344# Get the payload UART configured by the current test configuration. This
345# defaults to the primary UART.
346#
347# Usage: get_payload_uart <archive> [default]
348get_payload_uart() {
349 local default="$(get_primary_uart "${1:?}")"
350
351 get_run_env "${1:?}" payload_uart "${2-${default}}"
352}
353
354# Get the path to a UART's environment variable directory.
355#
356# UART environment variables are the UART-specific environment variables
357# configured by the CI's test configuration.
358#
359# Usage: get_uart_env_path <archive> <uart>
360get_uart_env_path() {
361 echo "${1:?}/run/uart${2:?}"
362}
363
364# Get a UART environment variable.
365#
366# UART environment variables are the UART-specific environment variables
367# configured by the CI's test configuration.
368#
369# Usage: get_uart_env <archive> <uart> <variable> [default]
370get_uart_env() {
371 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
372 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
373 else
Chris Kayfab6edc2022-11-17 19:18:32 +0000374 echo "${!3-${4}}"
Chris Kay03ffbe72022-11-17 18:53:50 +0000375 fi
376}
377
378# Get the path to the Expect script for a given UART. This defaults to nothing.
379#
380# Usage: get_uart_expect_script <archive> <uart> [default]
381get_uart_expect_script() {
382 local default=
383
384 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
385}
386
387# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
388#
389# Usage: get_uart_port <archive> <uart> [default]
390get_uart_port() {
391 local default="$(( 5000 + "${2:?}" ))"
392
393 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
394}
395
Chris Kay24d039f2022-11-23 12:53:30 +0000396# Set a UART environment variable.
397#
398# UART environment variables are the UART-specific environment variables
399# configured by the CI's test configuration.
400#
401# Usage: set_uart_env <archive> <uart> <variable> <value>
402set_uart_env() {
403 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
404
405 mkdir -p "${path}" && \
406 echo "${4:?}" > "${path}/${3:?}"
407}
408
409# Set the FVP port for a given UART.
410#
411# Usage: set_uart_port <archive> <uart> <port>
412set_uart_port() {
413 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
414}
415
Fathi Boudra422bf772019-12-02 11:10:16 +0200416# Make a temporary directory/file insdie workspace, so that it doesn't need to
417# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
418mktempdir() {
419 local ws="${workspace:?}"
420
421 mktemp -d --tmpdir="$ws"
422}
423mktempfile() {
424 local ws="${workspace:?}"
425
426 mktemp --tmpdir="$ws"
427}
428
429not_upon() {
430 ! upon "$1"
431}
432
433# Use "$1" as a boolean
434upon() {
435 case "$1" in
436 "" | "0" | "false") return 1;;
437 *) return 0;;
438 esac
439}
440
441# Check if the argument is a URL
442is_url() {
443 echo "$1" | grep -q "://"
444}
445
446# Check if a path is absolute
447is_abs() {
448 [ "${1:0:1}" = "/" ]
449}
450
451# Unset a variable based on its boolean value
452# If foo=, foo will be unset
453# If foo=blah, then leave it as is
454reset_var() {
455 local var="$1"
456 local val="${!var}"
457
458 if [ -z "$val" ]; then
459 unset "$var"
460 else
461 var="$val"
462 fi
463}
464
465default_var() {
466 local var="$1"
467 local val="${!var}"
468 local default="$2"
469
470 if [ -z "$val" ]; then
471 eval "$var=$default"
472 fi
473}
474
475# String various items joined by ":" to form a path. Items are prepended by
476# default; or 'op' can be set to 'append' to have them appended.
477# For example, to set: PATH=foo:bar:baz:$PATH
478extend_path() {
479 local path_var="$1"
480 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500481 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200482 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500483 local sep=':'
484 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200485
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500486 eval "array_val=\"\${$array_var[@]}\""
487 array_val="$(echo ${array_val// /:})"
488
489 [ -z "$path_val" ] && sep=''
490
491 if [ "$op" = "prepend" ]; then
492 array_val="${array_val}${sep}${path_val}"
493 elif [ "$op" = "append" ]; then
494 array_val="${path_val}${sep}${array_val}"
495 fi
496
497 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200498}
499
Chris Kay3d807882022-08-31 16:00:02 +0100500# Expand and evaluate Bash variables and expressions in a file, whose path is
501# given by the first parameter.
502#
503# For example, to expand a file containing the following:
504#
505# My name is ${name}!
506#
507# You might use:
508#
509# name="Chris" expand_template "path-to-my-file.txt"
510#
511# This would yield:
512#
513# My name is Chris!
514#
515# If you need to run multiple expansions on a file (e.g. to fill out information
516# incrementally), then you can escape expansion of a variable with a backslash,
517# e.g. `\${name}`.
518#
519# The expanded output is printed to the standard output stream.
520expand_template() {
521 local path="$1"
522
523 eval "cat <<-EOF
524 $(<${path})
525 EOF"
526}
527
Harrison Mutai013f6332022-02-16 16:06:33 +0000528# Fetch and extract the latest supported version of the LLVM toolchain from
529# a compressed archive file to a target directory, if it is required.
530setup_llvm_toolchain() {
531 link="${1:-$llvm_archive}"
532 archive="${2:-"$workspace/llvm.tar.xz"}"
533 target_dir="${3:-$llvm_dir}"
534
535 if is_arm_jenkins_env || upon "$local_ci"; then
536 url="$link" saveas="$archive" fetch_file
537 mkdir -p $target_dir
538 extract_tarball $archive $target_dir --strip-components=1 -k
539 fi
540}
541
542# Extract files from compressed archive to target directory. Supports .zip,
543# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500544extract_tarball() {
545 local archive="$1"
546 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500547 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500548
549 pushd "$target_dir"
550 case $(file --mime-type -b "$archive") in
551 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500552 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500553 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500554 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500555 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500556 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000557 application/x-xz)
558 tar -x $extra_params -f $archive
559 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500560 esac
Zelalem219df412020-05-17 19:21:20 -0500561 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500562}
563
Gary Morrison999a9d72022-03-14 18:29:06 -0500564# See if execution is done by Jenkins. If called with a parameter,
565# representing a 'domain', e.g. arm.com, it will also check if
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500566# JENKINS_URL contains the latter.
567is_jenkins_env () {
568 local domain="${1-}"
569
570 # check if running under Jenkins, if not, return non-zero
571 # the checks assumes Jenkins executing if JENKINS_HOME is set
572 [ -z "$JENKINS_HOME" ] && return 1
573
574 # if no parameter passed, no more checks, quit
575 [ -z "$domain" ] && return 0
576
577 if echo "$JENKINS_URL" | grep -q "$domain"; then
578 return 0
579 fi
580
581 return 1
582}
583
584
585# Check if execution is under ARM's jenkins
586is_arm_jenkins_env() {
587 local arm_domain="arm.com"
588 return $(is_jenkins_env "$arm_domain")
589}
590
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600591
592# Provide correct linaro cross toolchain based on environment
593set_cross_compile_gcc_linaro_toolchain() {
594 local cross_compile_path="/home/buildslave/tools"
595
596 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600597 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600598
599 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
600}
601
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500602if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200603 jenkins_run=1
604 umask 0002
605else
606 unset jenkins_run
607fi
608
609# Project scratch location for Trusted Firmware CI
610project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
611project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
612warehouse="${nfs_volume}/warehouse"
613jenkins_url="${JENKINS_URL%/*}"
614jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
615
laurenw-arm35faeaa2021-05-03 14:28:17 -0500616# 11.12 Model revisions
617model_version_11_12="11.12"
618model_build_11_12="38"
619model_flavour_11_12="Linux64_GCC-6.4"
620
laurenw-armafdc3bc2022-09-14 15:31:42 -0500621# 11.16 Model revisions
622model_version_11_16="11.16"
623model_build_11_16="16"
624model_flavour_11_16="Linux64_GCC-6.4"
625
626# 11.17 Model revisions
627model_version_11_17="11.17"
628model_build_11_17="21"
629model_flavour_11_17="Linux64_GCC-9.3"
630
Fathi Boudra422bf772019-12-02 11:10:16 +0200631# Model revisions
laurenw-armafdc3bc2022-09-14 15:31:42 -0500632model_version="${model_version:-11.19}"
633model_build="${model_build:-14}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100634model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200635
636# Model snapshots from filer are not normally not accessible from developer
637# systems. Ignore failures from picking real path for local runs.
638pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
639pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
640
Fathi Boudra422bf772019-12-02 11:10:16 +0200641tforg_gerrit_url="review.trustedfirmware.org"
642
643# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
644# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200645tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
646tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200647tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
648tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500649ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
650ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500651tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200652scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100653scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100654spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
655spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200656
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500657tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200658tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
659css_downloads="${css_downloads:-$tfa_downloads/css}"
660
Chris Kay52b8d432023-04-27 16:10:57 +0100661# SCP/MCP release binaries.
662scp_mcp_2_11_0_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}"
Chris Kay45b46552023-04-20 13:40:06 +0100663scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.12.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000664
Leonardo Sandoval15676062020-11-19 11:58:09 -0600665linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100666linaro_release="${linaro_release:-$linaro_2001_release}"
Maksims Svecovs94928582023-05-10 15:22:59 +0100667mbedtls_version="${mbedtls_version:-3.4.0}"
Zelalem219df412020-05-17 19:21:20 -0500668
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500669# mbedTLS archive public hosting available at github.com
Govindraj Raja827823f2023-02-28 14:19:00 +0000670mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200671
Harrison Mutai013f6332022-02-16 16:06:33 +0000672# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
673# LLVM archive public hosting available at github.com
674llvm_version="${llvm_version:-14.0.0}"
675llvm_dir="$workspace/llvm-$llvm_version"
676llvm_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}"
677
Mark Dykes30138ad2021-11-09 16:48:17 -0600678coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200679coverity_default_checkers=(
680"--all"
681"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200682"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500683"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200684"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200685"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500686"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200687)
688
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500689docker_registry="${docker_registry:-}"
690
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500691# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanand6d0e4ab2023-04-18 11:18:54 +0100692toolchain_version="12.2.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500693
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100694aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500695aarch64_none_elf_prefix="aarch64-none-elf-"
696
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100697arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500698arm_none_eabi_prefix="arm-none-eabi-"
699
Fathi Boudra422bf772019-12-02 11:10:16 +0200700path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500701 "${aarch64_none_elf_dir}/bin"
702 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000703 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500704 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
705 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200706)
707
708ld_library_path_list=(
709)
710
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200711license_path_list=${license_path_list-(
712)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200713
714# Setup various paths
715if upon "$retain_paths"; then
716 # If explicitly requested, retain local paths; apppend CI paths to the
717 # existing ones.
718 op="append" extend_path "PATH" "path_list"
719 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
720 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
721else
722 # Otherwise, prepend CI paths so that they take effect before local ones
723 extend_path "PATH" "path_list"
724 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
725 extend_path "LM_LICENSE_FILE" "license_path_list"
726fi
727
728export LD_LIBRARY_PATH
729export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200730export ARM_TOOL_VARIANT=ult
731
732# vim: set tw=80 sw=8 noet: