Leonardo Sandoval | 9dfdd1b | 2020-08-06 17:08:11 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 2 | # |
Jayanth Dodderi Chidanand | bf7369d | 2022-04-06 10:59:14 +0100 | [diff] [blame] | 3 | # Copyright (c) 2019-2022, Arm Limited. All rights reserved. |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 4 | # |
| 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 |
| 16 | ci_root="${ci_root:-$CI_ROOT}" |
| 17 | ci_root="${ci_root:?}" |
| 18 | |
Sandrine Bailleux | aaaffe0 | 2020-08-07 11:15:55 +0200 | [diff] [blame] | 19 | # Optionally source a file containing environmental settings. |
| 20 | if [ -n "$host_env" ]; then |
| 21 | source "$host_env" |
| 22 | else |
| 23 | # Are we running on Arm infrastructure? |
Gary Morrison | 999a9d7 | 2022-03-14 18:29:06 -0500 | [diff] [blame] | 24 | if echo "$JENKINS_URL" | grep -q "oss.arm.com"; then |
Sandrine Bailleux | aaaffe0 | 2020-08-07 11:15:55 +0200 | [diff] [blame] | 25 | source "$ci_root/arm-env.sh" |
| 26 | fi |
| 27 | fi |
| 28 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 29 | # Storage area to host toolchains, rootfs, tools, models, binaries, etc... |
| 30 | nfs_volume="${nfs_volume:-$NFS_VOLUME}" |
| 31 | nfs_volume="${nfs_volume:?}" |
| 32 | |
| 33 | # Override workspace for local runs |
| 34 | workspace="${workspace:-$WORKSPACE}" |
| 35 | workspace="${workspace:?}" |
| 36 | workspace="$(readlink -f "$workspace")" |
| 37 | artefacts="$workspace/artefacts" |
| 38 | |
| 39 | # pushd and popd outputs the directory stack every time, which could be |
| 40 | # confusing when shown on the log. Suppress its output. |
| 41 | pushd() { |
| 42 | builtin pushd "$1" &>/dev/null |
| 43 | } |
| 44 | popd() { |
| 45 | builtin popd &>/dev/null |
| 46 | } |
| 47 | |
| 48 | # Copy a file to the $archive directory |
| 49 | archive_file() { |
| 50 | local f out target md5 |
| 51 | f="${1:?}" |
| 52 | |
| 53 | out="${archive:?}" |
| 54 | [ ! -d "$out" ] && die "$out is not a directory" |
| 55 | |
| 56 | target="$out/$(basename $f)" |
| 57 | if [ -f "$target" ]; then |
| 58 | # Prevent same file error |
| 59 | if [ "$(stat --format=%i "$target")" = \ |
| 60 | "$(stat --format=%i "$f")" ]; then |
| 61 | return |
| 62 | fi |
| 63 | fi |
| 64 | |
| 65 | md5="$(md5sum "$f" | awk '{print $1}')" |
| 66 | cp -t "$out" "$f" |
| 67 | echo "Archived: $f (md5: $md5)" |
| 68 | } |
| 69 | |
| 70 | die() { |
| 71 | [ "$1" ] && echo "$1" >&2 |
| 72 | exit 1 |
| 73 | } |
| 74 | |
| 75 | # Emit environment variables for the purpose of sourcing from shells and as |
| 76 | # Jenkins property files. Whether the RHS is quoted depends on "$quote". |
| 77 | emit_env() { |
| 78 | local env_file="${env_file:?}" |
| 79 | local var="${1:?}" |
| 80 | |
| 81 | # Value parameter is mandatory, but allow for it to be empty |
| 82 | local val="${2?}" |
| 83 | |
| 84 | if upon "$quote"; then |
| 85 | val="\"$val\"" |
| 86 | else |
| 87 | # If RHS is not required to be quoted, any white space in it |
| 88 | # won't go well with a shell sourcing this file. |
| 89 | if echo "$var" | grep -q '\s'; then |
| 90 | die "$var: value '$val' has white space" |
| 91 | fi |
| 92 | fi |
| 93 | |
| 94 | echo "$var=$val" >> "$env_file" |
| 95 | } |
| 96 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 97 | fetch_directory() { |
| 98 | local base="$(basename "${url:?}")" |
| 99 | local sa |
| 100 | |
Fathi Boudra | dd31e7b | 2020-01-29 15:44:42 +0200 | [diff] [blame] | 101 | case "${url}" in |
| 102 | http*://*) |
| 103 | # Have exactly one trailing / |
| 104 | local modified_url="$(echo "${url}" | sed 's#/*$##')/" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 105 | |
Fathi Boudra | dd31e7b | 2020-01-29 15:44:42 +0200 | [diff] [blame] | 106 | # Figure out the number of components between hostname and the |
| 107 | # final one |
| 108 | local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')" |
| 109 | sa="${saveas:-$base}" |
| 110 | echo "Fetch: $modified_url -> $sa" |
laurenw-arm | 2d62c71 | 2022-09-13 14:27:15 -0500 | [diff] [blame] | 111 | wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \ |
Fathi Boudra | dd31e7b | 2020-01-29 15:44:42 +0200 | [diff] [blame] | 112 | --reject="index.html*" "$modified_url" |
| 113 | if [ "$sa" != "$base" ]; then |
| 114 | mv "$base" "$sa" |
| 115 | fi |
| 116 | ;; |
| 117 | file://*) |
| 118 | sa="${saveas:-.}" |
| 119 | echo "Fetch: ${url} -> $sa" |
| 120 | cp -r "${url#file://}" "$sa" |
| 121 | ;; |
| 122 | *) |
| 123 | sa="${saveas:-.}" |
| 124 | echo "Fetch: ${url} -> $sa" |
| 125 | cp -r "${url}" "$sa" |
| 126 | ;; |
| 127 | esac |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | fetch_file() { |
| 131 | local url="${url:?}" |
| 132 | local sa |
| 133 | local saveas |
| 134 | |
| 135 | if is_url "$url"; then |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 136 | saveas="${saveas-"$(basename "$url")"}" |
Sandrine Bailleux | 3da4bd1 | 2020-08-06 16:18:36 +0200 | [diff] [blame] | 137 | sa="${saveas+-o $saveas}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 138 | echo "Fetch: $url -> $saveas" |
| 139 | # Use curl to support file protocol |
Sandrine Bailleux | 2a05b9c | 2021-02-25 13:52:21 +0100 | [diff] [blame] | 140 | curl --fail -sLS $sa "$url" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 141 | else |
| 142 | sa="${saveas-.}" |
| 143 | echo "Fetch: $url -> $sa" |
| 144 | cp "$url" "$sa" |
| 145 | fi |
| 146 | } |
| 147 | |
| 148 | # Make a temporary directory/file insdie workspace, so that it doesn't need to |
| 149 | # be cleaned up. Jenkins is setup to clean up workspace before a job runs. |
| 150 | mktempdir() { |
| 151 | local ws="${workspace:?}" |
| 152 | |
| 153 | mktemp -d --tmpdir="$ws" |
| 154 | } |
| 155 | mktempfile() { |
| 156 | local ws="${workspace:?}" |
| 157 | |
| 158 | mktemp --tmpdir="$ws" |
| 159 | } |
| 160 | |
| 161 | not_upon() { |
| 162 | ! upon "$1" |
| 163 | } |
| 164 | |
| 165 | # Use "$1" as a boolean |
| 166 | upon() { |
| 167 | case "$1" in |
| 168 | "" | "0" | "false") return 1;; |
| 169 | *) return 0;; |
| 170 | esac |
| 171 | } |
| 172 | |
| 173 | # Check if the argument is a URL |
| 174 | is_url() { |
| 175 | echo "$1" | grep -q "://" |
| 176 | } |
| 177 | |
| 178 | # Check if a path is absolute |
| 179 | is_abs() { |
| 180 | [ "${1:0:1}" = "/" ] |
| 181 | } |
| 182 | |
| 183 | # Unset a variable based on its boolean value |
| 184 | # If foo=, foo will be unset |
| 185 | # If foo=blah, then leave it as is |
| 186 | reset_var() { |
| 187 | local var="$1" |
| 188 | local val="${!var}" |
| 189 | |
| 190 | if [ -z "$val" ]; then |
| 191 | unset "$var" |
| 192 | else |
| 193 | var="$val" |
| 194 | fi |
| 195 | } |
| 196 | |
| 197 | default_var() { |
| 198 | local var="$1" |
| 199 | local val="${!var}" |
| 200 | local default="$2" |
| 201 | |
| 202 | if [ -z "$val" ]; then |
| 203 | eval "$var=$default" |
| 204 | fi |
| 205 | } |
| 206 | |
| 207 | # String various items joined by ":" to form a path. Items are prepended by |
| 208 | # default; or 'op' can be set to 'append' to have them appended. |
| 209 | # For example, to set: PATH=foo:bar:baz:$PATH |
| 210 | extend_path() { |
| 211 | local path_var="$1" |
| 212 | local array_var="$2" |
Leonardo Sandoval | 2af9320 | 2020-07-16 17:29:18 -0500 | [diff] [blame] | 213 | local path_val="${!path_var}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 214 | local op="${op:-prepend}" |
Leonardo Sandoval | 2af9320 | 2020-07-16 17:29:18 -0500 | [diff] [blame] | 215 | local sep=':' |
| 216 | local array_val |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 217 | |
Leonardo Sandoval | 2af9320 | 2020-07-16 17:29:18 -0500 | [diff] [blame] | 218 | eval "array_val=\"\${$array_var[@]}\"" |
| 219 | array_val="$(echo ${array_val// /:})" |
| 220 | |
| 221 | [ -z "$path_val" ] && sep='' |
| 222 | |
| 223 | if [ "$op" = "prepend" ]; then |
| 224 | array_val="${array_val}${sep}${path_val}" |
| 225 | elif [ "$op" = "append" ]; then |
| 226 | array_val="${path_val}${sep}${array_val}" |
| 227 | fi |
| 228 | |
| 229 | eval "$path_var=\"$array_val\"" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 230 | } |
| 231 | |
Chris Kay | 3d80788 | 2022-08-31 16:00:02 +0100 | [diff] [blame] | 232 | #Â Expand and evaluate Bash variables and expressions in a file, whose path is |
| 233 | #Â given by the first parameter. |
| 234 | # |
| 235 | # For example, to expand a file containing the following: |
| 236 | # |
| 237 | # My name is ${name}! |
| 238 | # |
| 239 | # You might use: |
| 240 | # |
| 241 | # name="Chris" expand_template "path-to-my-file.txt" |
| 242 | # |
| 243 | # This would yield: |
| 244 | # |
| 245 | # My name is Chris! |
| 246 | # |
| 247 | # If you need to run multiple expansions on a file (e.g. to fill out information |
| 248 | # incrementally), then you can escape expansion of a variable with a backslash, |
| 249 | # e.g. `\${name}`. |
| 250 | # |
| 251 | #Â The expanded output is printed to the standard output stream. |
| 252 | expand_template() { |
| 253 | local path="$1" |
| 254 | |
| 255 | eval "cat <<-EOF |
| 256 | $(<${path}) |
| 257 | EOF" |
| 258 | } |
| 259 | |
Harrison Mutai | 013f633 | 2022-02-16 16:06:33 +0000 | [diff] [blame] | 260 | # Fetch and extract the latest supported version of the LLVM toolchain from |
| 261 | # a compressed archive file to a target directory, if it is required. |
| 262 | setup_llvm_toolchain() { |
| 263 | link="${1:-$llvm_archive}" |
| 264 | archive="${2:-"$workspace/llvm.tar.xz"}" |
| 265 | target_dir="${3:-$llvm_dir}" |
| 266 | |
| 267 | if is_arm_jenkins_env || upon "$local_ci"; then |
| 268 | url="$link" saveas="$archive" fetch_file |
| 269 | mkdir -p $target_dir |
| 270 | extract_tarball $archive $target_dir --strip-components=1 -k |
| 271 | fi |
| 272 | } |
| 273 | |
| 274 | # Extract files from compressed archive to target directory. Supports .zip, |
| 275 | # .tar.gz, and tar.xf format |
Madhukar Pappireddy | 4b686cf | 2020-03-31 13:05:14 -0500 | [diff] [blame] | 276 | extract_tarball() { |
| 277 | local archive="$1" |
| 278 | local target_dir="$2" |
Leonardo Sandoval | ec9e16c | 2020-09-09 14:32:40 -0500 | [diff] [blame] | 279 | local extra_params="${3:-}" |
Madhukar Pappireddy | 4b686cf | 2020-03-31 13:05:14 -0500 | [diff] [blame] | 280 | |
| 281 | pushd "$target_dir" |
| 282 | case $(file --mime-type -b "$archive") in |
| 283 | application/gzip) |
Leonardo Sandoval | ec9e16c | 2020-09-09 14:32:40 -0500 | [diff] [blame] | 284 | tar -xz $extra_params -f $archive |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 285 | ;; |
Madhukar Pappireddy | 4b686cf | 2020-03-31 13:05:14 -0500 | [diff] [blame] | 286 | application/zip) |
Leonardo Sandoval | ec9e16c | 2020-09-09 14:32:40 -0500 | [diff] [blame] | 287 | unzip -q $extra_params $archive |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 288 | ;; |
Harrison Mutai | 013f633 | 2022-02-16 16:06:33 +0000 | [diff] [blame] | 289 | application/x-xz) |
| 290 | tar -x $extra_params -f $archive |
| 291 | ;; |
Madhukar Pappireddy | 4b686cf | 2020-03-31 13:05:14 -0500 | [diff] [blame] | 292 | esac |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 293 | popd "$target_dir" |
Madhukar Pappireddy | 4b686cf | 2020-03-31 13:05:14 -0500 | [diff] [blame] | 294 | } |
| 295 | |
Gary Morrison | 999a9d7 | 2022-03-14 18:29:06 -0500 | [diff] [blame] | 296 | # See if execution is done by Jenkins. If called with a parameter, |
| 297 | # representing a 'domain', e.g. arm.com, it will also check if |
Leonardo Sandoval | 795b621 | 2020-08-14 16:20:00 -0500 | [diff] [blame] | 298 | # JENKINS_URL contains the latter. |
| 299 | is_jenkins_env () { |
| 300 | local domain="${1-}" |
| 301 | |
| 302 | # check if running under Jenkins, if not, return non-zero |
| 303 | # the checks assumes Jenkins executing if JENKINS_HOME is set |
| 304 | [ -z "$JENKINS_HOME" ] && return 1 |
| 305 | |
| 306 | # if no parameter passed, no more checks, quit |
| 307 | [ -z "$domain" ] && return 0 |
| 308 | |
| 309 | if echo "$JENKINS_URL" | grep -q "$domain"; then |
| 310 | return 0 |
| 311 | fi |
| 312 | |
| 313 | return 1 |
| 314 | } |
| 315 | |
| 316 | |
| 317 | # Check if execution is under ARM's jenkins |
| 318 | is_arm_jenkins_env() { |
| 319 | local arm_domain="arm.com" |
| 320 | return $(is_jenkins_env "$arm_domain") |
| 321 | } |
| 322 | |
Leonardo Sandoval | feae3a2 | 2020-11-17 16:53:59 -0600 | [diff] [blame] | 323 | |
| 324 | # Provide correct linaro cross toolchain based on environment |
| 325 | set_cross_compile_gcc_linaro_toolchain() { |
| 326 | local cross_compile_path="/home/buildslave/tools" |
| 327 | |
| 328 | # if under arm enviroment, overide cross-compilation path |
Madhukar Pappireddy | 21a5e67 | 2021-03-08 17:49:45 -0600 | [diff] [blame] | 329 | is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools" |
Leonardo Sandoval | feae3a2 | 2020-11-17 16:53:59 -0600 | [diff] [blame] | 330 | |
| 331 | echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-" |
| 332 | } |
| 333 | |
Leonardo Sandoval | 795b621 | 2020-08-14 16:20:00 -0500 | [diff] [blame] | 334 | if is_jenkins_env; then |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 335 | jenkins_run=1 |
| 336 | umask 0002 |
| 337 | else |
| 338 | unset jenkins_run |
| 339 | fi |
| 340 | |
| 341 | # Project scratch location for Trusted Firmware CI |
| 342 | project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw" |
| 343 | project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}" |
| 344 | warehouse="${nfs_volume}/warehouse" |
| 345 | jenkins_url="${JENKINS_URL%/*}" |
| 346 | jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}" |
| 347 | |
laurenw-arm | 35faeaa | 2021-05-03 14:28:17 -0500 | [diff] [blame] | 348 | # 11.12 Model revisions |
| 349 | model_version_11_12="11.12" |
| 350 | model_build_11_12="38" |
| 351 | model_flavour_11_12="Linux64_GCC-6.4" |
| 352 | |
laurenw-arm | afdc3bc | 2022-09-14 15:31:42 -0500 | [diff] [blame] | 353 | # 11.16 Model revisions |
| 354 | model_version_11_16="11.16" |
| 355 | model_build_11_16="16" |
| 356 | model_flavour_11_16="Linux64_GCC-6.4" |
| 357 | |
| 358 | # 11.17 Model revisions |
| 359 | model_version_11_17="11.17" |
| 360 | model_build_11_17="21" |
| 361 | model_flavour_11_17="Linux64_GCC-9.3" |
| 362 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 363 | # Model revisions |
laurenw-arm | afdc3bc | 2022-09-14 15:31:42 -0500 | [diff] [blame] | 364 | model_version="${model_version:-11.19}" |
| 365 | model_build="${model_build:-14}" |
Maksims Svecovs | 5c54251 | 2022-03-29 10:13:05 +0100 | [diff] [blame] | 366 | model_flavour="${model_flavour:-Linux64_GCC-9.3}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 367 | |
| 368 | # Model snapshots from filer are not normally not accessible from developer |
| 369 | # systems. Ignore failures from picking real path for local runs. |
| 370 | pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true |
| 371 | pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true |
| 372 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 373 | tforg_gerrit_url="review.trustedfirmware.org" |
| 374 | |
| 375 | # Repository URLs. We're using anonymous HTTP as they appear to be faster rather |
| 376 | # than any scheme with authentication. |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 377 | tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}" |
| 378 | tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 379 | tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}" |
| 380 | tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}" |
Jimmy Brisson | 29ca0a0 | 2020-09-22 16:15:35 -0500 | [diff] [blame] | 381 | ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}" |
| 382 | ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}" |
Zelalem | dd65527 | 2020-10-06 16:29:05 -0500 | [diff] [blame] | 383 | tf_ci_repo_url="$ci_src_repo_url" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 384 | scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}" |
Girish Pathak | 97f7ad4 | 2020-08-27 11:38:15 +0100 | [diff] [blame] | 385 | scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}" |
Olivier Deprez | 965a779 | 2019-12-16 14:09:03 +0100 | [diff] [blame] | 386 | spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}" |
| 387 | spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 388 | |
Leonardo Sandoval | d98f833 | 2021-04-13 16:46:38 -0500 | [diff] [blame] | 389 | tf_downloads="${tf_downloads:-file:///downloads/}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 390 | tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}" |
| 391 | css_downloads="${css_downloads:-$tfa_downloads/css}" |
| 392 | |
Jayanth Dodderi Chidanand | bf7369d | 2022-04-06 10:59:14 +0100 | [diff] [blame] | 393 | # SCP/MCP v2.10.0 release binaries. |
Manish V Badarkhe | 83e4b8d | 2022-10-26 12:02:41 +0100 | [diff] [blame] | 394 | scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}" |
Alexei Fedorov | 9e4473d | 2020-11-04 10:13:07 +0000 | [diff] [blame] | 395 | |
Leonardo Sandoval | 1567606 | 2020-11-19 11:58:09 -0600 | [diff] [blame] | 396 | linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}" |
Alexei Fedorov | e405cc3 | 2020-09-30 18:13:55 +0100 | [diff] [blame] | 397 | linaro_release="${linaro_release:-$linaro_2001_release}" |
Daniel Boulby | b63dd8c | 2022-09-23 11:55:20 +0100 | [diff] [blame] | 398 | mbedtls_version="${mbedtls_version:-2.28.1}" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 399 | |
Madhukar Pappireddy | 4b686cf | 2020-03-31 13:05:14 -0500 | [diff] [blame] | 400 | # mbedTLS archive public hosting available at github.com |
Sandrine Bailleux | df82389 | 2022-04-22 13:27:45 +0200 | [diff] [blame] | 401 | mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${mbedtls_version}.tar.gz}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 402 | |
Harrison Mutai | 013f633 | 2022-02-16 16:06:33 +0000 | [diff] [blame] | 403 | # FIXME: workaround to allow all on-prem host machines to access the latest LLVM |
| 404 | # LLVM archive public hosting available at github.com |
| 405 | llvm_version="${llvm_version:-14.0.0}" |
| 406 | llvm_dir="$workspace/llvm-$llvm_version" |
| 407 | llvm_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}" |
| 408 | |
Mark Dykes | 30138ad | 2021-11-09 16:48:17 -0600 | [diff] [blame] | 409 | coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 410 | coverity_default_checkers=( |
| 411 | "--all" |
| 412 | "--checker-option DEADCODE:no_dead_default:true" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 413 | "--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 414 | "--enable ENUM_AS_BOOLEAN" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 415 | "--enable-constraint-fpp" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 416 | "--ticker-mode none" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 417 | "--hfa" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 418 | ) |
| 419 | |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 420 | docker_registry="${docker_registry:-}" |
| 421 | |
Leonardo Sandoval | 1c24ae5 | 2020-07-08 11:47:23 -0500 | [diff] [blame] | 422 | # Define toolchain version and toolchain binary paths |
Jayanth Dodderi Chidanand | cc4d234 | 2022-09-12 14:44:21 +0100 | [diff] [blame] | 423 | toolchain_version="11.3.rel1" |
Leonardo Sandoval | 1c24ae5 | 2020-07-08 11:47:23 -0500 | [diff] [blame] | 424 | |
Jayanth Dodderi Chidanand | cc4d234 | 2022-09-12 14:44:21 +0100 | [diff] [blame] | 425 | aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf" |
Leonardo Sandoval | 1c24ae5 | 2020-07-08 11:47:23 -0500 | [diff] [blame] | 426 | aarch64_none_elf_prefix="aarch64-none-elf-" |
| 427 | |
Jayanth Dodderi Chidanand | cc4d234 | 2022-09-12 14:44:21 +0100 | [diff] [blame] | 428 | arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi" |
Leonardo Sandoval | 1c24ae5 | 2020-07-08 11:47:23 -0500 | [diff] [blame] | 429 | arm_none_eabi_prefix="arm-none-eabi-" |
| 430 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 431 | path_list=( |
Leonardo Sandoval | 1c24ae5 | 2020-07-08 11:47:23 -0500 | [diff] [blame] | 432 | "${aarch64_none_elf_dir}/bin" |
| 433 | "${arm_none_eabi_dir}/bin" |
Harrison Mutai | 013f633 | 2022-02-16 16:06:33 +0000 | [diff] [blame] | 434 | "${llvm_dir}/bin" |
Leonardo Sandoval | 1c24ae5 | 2020-07-08 11:47:23 -0500 | [diff] [blame] | 435 | "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin" |
| 436 | "$coverity_path/bin" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 437 | ) |
| 438 | |
| 439 | ld_library_path_list=( |
| 440 | ) |
| 441 | |
Sandrine Bailleux | a6a1d6e | 2020-08-07 10:24:17 +0200 | [diff] [blame] | 442 | license_path_list=${license_path_list-( |
| 443 | )} |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 444 | |
| 445 | # Setup various paths |
| 446 | if upon "$retain_paths"; then |
| 447 | # If explicitly requested, retain local paths; apppend CI paths to the |
| 448 | # existing ones. |
| 449 | op="append" extend_path "PATH" "path_list" |
| 450 | op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list" |
| 451 | op="append" extend_path "LM_LICENSE_FILE" "license_path_list" |
| 452 | else |
| 453 | # Otherwise, prepend CI paths so that they take effect before local ones |
| 454 | extend_path "PATH" "path_list" |
| 455 | extend_path "LD_LIBRARY_PATH" "ld_library_path_list" |
| 456 | extend_path "LM_LICENSE_FILE" "license_path_list" |
| 457 | fi |
| 458 | |
| 459 | export LD_LIBRARY_PATH |
| 460 | export LM_LICENSE_FILE |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 461 | export ARM_TOOL_VARIANT=ult |
| 462 | |
| 463 | # vim: set tw=80 sw=8 noet: |