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 | # |
Leonardo Sandoval | 00ced1f | 2020-12-07 12:55:08 -0600 | [diff] [blame] | 3 | # Copyright (c) 2020-2021, 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 | set -u |
| 9 | |
| 10 | bl1_addr="${bl1_addr:-0x0}" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 11 | bl31_addr="${bl31_addr:-0x04001000}" |
Zelalem | 1b87461 | 2020-08-04 18:08:18 -0500 | [diff] [blame] | 12 | bl32_addr="${bl32_addr:-0x04003000}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 13 | bl33_addr="${bl33_addr:-0x88000000}" |
| 14 | dtb_addr="${dtb_addr:-0x82000000}" |
| 15 | fip_addr="${fip_addr:-0x08000000}" |
| 16 | initrd_addr="${initrd_addr:-0x84000000}" |
| 17 | kernel_addr="${kernel_addr:-0x80080000}" |
| 18 | el3_payload_addr="${el3_payload_addr:-0x80000000}" |
| 19 | |
Manish Pandey | 3c43558 | 2020-07-15 12:14:26 +0100 | [diff] [blame] | 20 | # SPM requires following addresses for RESET_TO_BL31 case |
| 21 | spm_addr="${spm_addr:-0x6000000}" |
| 22 | spmc_manifest_addr="${spmc_addr:-0x0403f000}" |
| 23 | sp1_addr="${sp1_addr:-0x7000000}" |
| 24 | sp2_addr="${sp2_addr:-0x7100000}" |
Olivier Deprez | 0b83409 | 2020-08-21 08:36:01 +0200 | [diff] [blame] | 25 | sp3_addr="${sp3_addr:-0x7200000}" |
Manish Pandey | 1e7be85 | 2020-11-09 16:04:48 +0000 | [diff] [blame] | 26 | # SPM out directories |
| 27 | export spm_secure_out_dir="${spm_secure_out_dir:-secure_aem_v8a_fvp_clang}" |
| 28 | export spm_non_secure_out_dir="${spm_non_secure_out_dir:-aem_v8a_fvp_clang}" |
Manish Pandey | 3c43558 | 2020-07-15 12:14:26 +0100 | [diff] [blame] | 29 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 30 | ns_bl1u_addr="${ns_bl1u_addr:-0x0beb8000}" |
| 31 | fwu_fip_addr="${fwu_fip_addr:-0x08400000}" |
| 32 | backup_fip_addr="${backup_fip_addr:-0x09000000}" |
| 33 | romlib_addr="${romlib_addr:-0x03ff2000}" |
| 34 | |
| 35 | uboot32_fip_url="$linaro_release/fvp32-latest-busybox-uboot/fip.bin" |
| 36 | |
Alexei Fedorov | e405cc3 | 2020-09-30 18:13:55 +0100 | [diff] [blame] | 37 | rootfs_url="$linaro_release/lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 38 | |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 39 | # Default FVP model variables |
| 40 | default_model_dtb="fvp-base-gicv3-psci.dtb" |
| 41 | |
Leonardo Sandoval | 00ced1f | 2020-12-07 12:55:08 -0600 | [diff] [blame] | 42 | # FVP containers and model paths |
| 43 | fvp_arm_std_library="fvp:fvp_arm_std_library_${model_version}_${model_build};/opt/model/FVP_ARM_Std_Library/models/${model_flavour}" |
| 44 | fvp_base_revc_2xaemv8a="fvp:fvp_base_revc-2xaemv8a_${model_version}_${model_build};/opt/model/Base_RevC_AEMv8A_pkg/models/${model_flavour}" |
| 45 | foundation_platform="fvp:foundation_platform_${model_version}_${model_build};/opt/model/Foundation_Platformpkg/models/${model_flavour}" |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 46 | |
Leonardo Sandoval | 00ced1f | 2020-12-07 12:55:08 -0600 | [diff] [blame] | 47 | # FVP associate array, run_config are keys and fvp container parameters are the values |
| 48 | # Container parameters syntax: <model name>;<model dir>;<model bin> |
| 49 | # FIXMEs: fix those ;;; values with real values |
| 50 | |
| 51 | declare -A fvp_models |
| 52 | fvp_models=( |
| 53 | [base-aemv8a-quad]=";;;" |
| 54 | [base-aemv8a-revb]=";;;" |
| 55 | [base-aemv8a-latest-revb]=";;;" |
| 56 | [base-aemva]=";;;" |
| 57 | [foundationv8]="${foundation_platform};Foundation_Platform" |
| 58 | [base-aemv8a]="${fvp_base_revc_2xaemv8a};FVP_Base_RevC-2xAEMv8A" |
| 59 | [cortex-a32x4]="${fvp_arm_std_library};FVP_Base_Cortex-A32x4" |
| 60 | [cortex-a35x4]="${fvp_arm_std_library};FVP_Base_Cortex-A35x4" |
| 61 | [cortex-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A53x4" |
| 62 | [cortex-a55x4-a75x4]="${fvp_arm_std_library};FVP_Base_Cortex-A55x4-A75x4" |
| 63 | [cortex-a55x4-a76x2]="${fvp_arm_std_library};FVP_Base_Cortex-A55x4-A76x2" |
| 64 | [cortex-a57x1-a53x1]="${fvp_arm_std_library};FVP_Base_Cortex-A57x1-A53x1" |
| 65 | [cortex-a57x2-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A57x2-A53x4" |
| 66 | [cortex-a57x4]="${fvp_arm_std_library};FVP_Base_Cortex-A57x4" |
| 67 | [cortex-a57x4-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A57x4-A53x4" |
| 68 | [cortex-a65aex8]="${fvp_arm_std_library};FVP_Base_Cortex-A65AEx8" |
| 69 | [cortex-a65x4]="${fvp_arm_std_library};FVP_Base_Cortex-A65x4" |
| 70 | [cortex-a72x4]="${fvp_arm_std_library};FVP_Base_Cortex-A72x4" |
| 71 | [cortex-a72x4-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A72x4-A53x4" |
| 72 | [cortex-a73x4]="${fvp_arm_std_library};FVP_Base_Cortex-A73x4" |
| 73 | [cortex-a73x4-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A73x4-A53x4" |
| 74 | [cortex-a75x4]="${fvp_arm_std_library};FVP_Base_Cortex-A75x4" |
| 75 | [cortex-a76aex4]="${fvp_arm_std_library};FVP_Base_Cortex-A76AEx4" |
| 76 | [cortex-a76aex2]="${fvp_arm_std_library};FVP_Base_Cortex-A76AEx2" |
| 77 | [cortex-a76x4]="${fvp_arm_std_library};FVP_Base_Cortex-A76x4" |
| 78 | [cortex-a77x4]="${fvp_arm_std_library};FVP_Base_Cortex-A77x4" |
| 79 | [cortex-a78x4]="${fvp_arm_std_library};FVP_Base_Cortex-A78x4" |
| 80 | [neoverse_e1x1]="${fvp_arm_std_library};FVP_Base_Neoverse-E1x1" |
| 81 | [neoverse_e1x2]="${fvp_arm_std_library};FVP_Base_Neoverse-E1x2" |
| 82 | [neoverse_e1x4]="${fvp_arm_std_library};FVP_Base_Neoverse-E1x4" |
| 83 | [neoverse_n1]="${fvp_arm_std_library};FVP_Base_Neoverse-N1x1" |
| 84 | [neoverse_n2]=";;;" |
| 85 | [neoverse-v1x4]=";;;" |
| 86 | [css-rdv1]=";;;" |
| 87 | [css-rde1edge]=";;;" |
| 88 | [css-rdn1edge]=";;;" |
| 89 | [css-rdn1edgex2]=";;;" |
| 90 | [css-sgi575]=";;;" |
| 91 | [css-sgm775]=";;;" |
| 92 | [tc0]=";;;" |
| 93 | ) |
| 94 | |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 95 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 96 | # FVP Kernel URLs |
| 97 | declare -A fvp_kernels |
| 98 | fvp_kernels=( |
| 99 | [fvp-aarch32-zimage]="$linaro_release/fvp32-latest-busybox-uboot/Image" |
| 100 | [fvp-busybox-uboot]="$linaro_release/fvp-latest-busybox-uboot/Image" |
| 101 | [fvp-oe-uboot32]="$linaro_release/fvp32-latest-oe-uboot/Image" |
| 102 | [fvp-oe-uboot]="$linaro_release/fvp-latest-oe-uboot/Image" |
| 103 | [fvp-quad-busybox-uboot]="$tfa_downloads/quad_cluster/Image" |
| 104 | ) |
| 105 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 106 | # FVP initrd URLs |
| 107 | declare -A fvp_initrd_urls |
| 108 | fvp_initrd_urls=( |
| 109 | [aarch32-ramdisk]="$linaro_release/fvp32-latest-busybox-uboot/ramdisk.img" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 110 | [dummy-ramdisk]="$linaro_release/fvp-latest-oe-uboot/ramdisk.img" |
| 111 | [dummy-ramdisk32]="$linaro_release/fvp32-latest-oe-uboot/ramdisk.img" |
| 112 | [default]="$linaro_release/fvp-latest-busybox-uboot/ramdisk.img" |
| 113 | ) |
| 114 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 115 | get_optee_bin() { |
Sandrine Bailleux | 25ff294 | 2021-02-25 14:00:10 +0100 | [diff] [blame^] | 116 | url="$tfa_downloads/optee/tee.bin" \ |
| 117 | saveas="bl32.bin" fetch_file |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 118 | archive_file "bl32.bin" |
| 119 | } |
| 120 | |
Javier Almansa Sobrino | 98de503 | 2020-09-17 12:47:05 +0100 | [diff] [blame] | 121 | # For Measured Boot tests using a TA based on OPTEE, it is necessary to use a |
| 122 | # specific build rather than the default one generated by Jenkins. |
| 123 | get_ftpm_optee_bin() { |
Javier Almansa Sobrino | de64772 | 2020-10-08 19:17:44 +0100 | [diff] [blame] | 124 | url="$tfa_downloads/ftpm/optee/tee-header_v2.bin" \ |
Javier Almansa Sobrino | 98de503 | 2020-09-17 12:47:05 +0100 | [diff] [blame] | 125 | saveas="bl32.bin" fetch_file |
| 126 | archive_file "bl32.bin" |
| 127 | |
Javier Almansa Sobrino | de64772 | 2020-10-08 19:17:44 +0100 | [diff] [blame] | 128 | url="$tfa_downloads/ftpm/optee/tee-pager_v2.bin" \ |
Javier Almansa Sobrino | 98de503 | 2020-09-17 12:47:05 +0100 | [diff] [blame] | 129 | saveas="bl32_extra1.bin" fetch_file |
| 130 | archive_file "bl32_extra1.bin" |
| 131 | |
Javier Almansa Sobrino | de64772 | 2020-10-08 19:17:44 +0100 | [diff] [blame] | 132 | url="$tfa_downloads/ftpm/optee/tee-pageable_v2.bin" \ |
Javier Almansa Sobrino | 98de503 | 2020-09-17 12:47:05 +0100 | [diff] [blame] | 133 | saveas="bl32_extra2.bin" fetch_file |
| 134 | archive_file "bl32_extra2.bin" |
| 135 | } |
| 136 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 137 | get_uboot32_bin() { |
| 138 | local tmpdir="$(mktempdir)" |
| 139 | |
| 140 | pushd "$tmpdir" |
| 141 | extract_fip "$uboot32_fip_url" |
| 142 | mv "nt-fw.bin" "uboot.bin" |
| 143 | archive_file "uboot.bin" |
| 144 | popd |
| 145 | } |
| 146 | |
| 147 | get_uboot_bin() { |
| 148 | local uboot_url="$linaro_release/fvp-latest-busybox-uboot/bl33-uboot.bin" |
| 149 | |
| 150 | url="$uboot_url" saveas="uboot.bin" fetch_file |
| 151 | archive_file "uboot.bin" |
| 152 | } |
| 153 | |
| 154 | get_uefi_bin() { |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 155 | uefi_downloads="${uefi_downloads:-http://files.oss.arm.com/downloads/uefi}" |
| 156 | uefi_ci_bin_url="${uefi_ci_bin_url:-$uefi_downloads/Artifacts/Linux/github/fvp/static/DEBUG_GCC5/FVP_AARCH64_EFI.fd}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 157 | |
| 158 | url=$uefi_ci_bin_url saveas="uefi.bin" fetch_file |
| 159 | archive_file "uefi.bin" |
| 160 | } |
| 161 | |
| 162 | get_kernel() { |
| 163 | local kernel_type="${kernel_type:?}" |
| 164 | local url="${fvp_kernels[$kernel_type]}" |
| 165 | |
| 166 | url="${url:?}" saveas="kernel.bin" fetch_file |
| 167 | archive_file "kernel.bin" |
| 168 | } |
| 169 | |
| 170 | get_initrd() { |
| 171 | local initrd_type="${initrd_type:?}" |
| 172 | local url="${fvp_initrd_urls[$initrd_type]}" |
| 173 | |
| 174 | url="${url:?}" saveas="initrd.bin" fetch_file |
| 175 | archive_file "initrd.bin" |
| 176 | } |
| 177 | |
| 178 | get_dtb() { |
| 179 | local dtb_type="${dtb_type:?}" |
| 180 | local dtb_url |
| 181 | local dtb_saveas="$workspace/dtb.bin" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 182 | local cc="$(get_tf_opt CROSS_COMPILE)" |
| 183 | local pp_flags="-P -nostdinc -undef -x assembler-with-cpp" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 184 | |
| 185 | case "$dtb_type" in |
| 186 | "fvp-base-quad-cluster-gicv3-psci") |
| 187 | # Get the quad-cluster FDT from pdsw area |
| 188 | dtb_url="$tfa_downloads/quad_cluster/fvp-base-quad-cluster-gicv3-psci.dtb" |
| 189 | url="$dtb_url" saveas="$dtb_saveas" fetch_file |
| 190 | ;; |
| 191 | "sgm775") |
| 192 | # Get the SGM775 FDT from pdsw area |
| 193 | dtb_url="$sgm_prebuilts/sgm775.dtb" |
| 194 | url="$dtb_url" saveas="$dtb_saveas" fetch_file |
| 195 | ;; |
| 196 | *) |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 197 | # Preprocess DTS file |
| 198 | ${cc}gcc -E ${pp_flags} -I"$tf_root/fdts" -I"$tf_root/include" \ |
| 199 | -o "$workspace/${dtb_type}.pre.dts" \ |
| 200 | "$tf_root/fdts/${dtb_type}.dts" |
| 201 | # Generate DTB file from DTS |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 202 | dtc -I dts -O dtb \ |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 203 | "$workspace/${dtb_type}.pre.dts" -o "$dtb_saveas" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 204 | esac |
| 205 | |
| 206 | archive_file "$dtb_saveas" |
| 207 | } |
| 208 | |
| 209 | get_rootfs() { |
| 210 | local tmpdir |
| 211 | local fs_base="$(echo $(basename $rootfs_url) | sed 's/\.gz$//')" |
| 212 | local cached="$project_filer/ci-files/$fs_base" |
| 213 | |
| 214 | if upon "$jenkins_run" && [ -f "$cached" ]; then |
| 215 | # Job workspace is limited in size, and the root file system is |
| 216 | # quite large. This means, parallel runs of root file system |
| 217 | # tests could fail. So, for Jenkins runs, copy and use the root |
| 218 | # file system image from the $CI_SCRATCH location |
| 219 | local private="$CI_SCRATCH/$JOB_NAME-$BUILD_NUMBER" |
| 220 | mkdir -p "$private" |
| 221 | rm -f "$private/rootfs.bin" |
| 222 | url="$cached" saveas="$private/rootfs.bin" fetch_file |
| 223 | ln -s "$private/rootfs.bin" "$archive/rootfs.bin" |
| 224 | return |
| 225 | fi |
| 226 | |
| 227 | tmpdir="$(mktempdir)" |
| 228 | pushd "$tmpdir" |
| 229 | url="$rootfs_url" saveas="rootfs.bin" fetch_file |
| 230 | |
| 231 | # Possibly, the filesystem image we just downloaded is compressed. |
| 232 | # Decompress it if required. |
| 233 | if file "rootfs.bin" | grep -iq 'gzip compressed data'; then |
| 234 | echo "Decompressing root file system image rootfs.bin ..." |
| 235 | gunzip --stdout "rootfs.bin" > uncompressed_fs.bin |
| 236 | mv uncompressed_fs.bin "rootfs.bin" |
| 237 | fi |
| 238 | |
| 239 | archive_file "rootfs.bin" |
| 240 | popd |
| 241 | } |
| 242 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 243 | fvp_romlib_jmptbl_backup="$(mktempdir)/jmptbl.i" |
| 244 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 245 | fvp_romlib_runtime() { |
| 246 | local tmpdir="$(mktempdir)" |
| 247 | |
| 248 | # Save BL1 and romlib binaries from original build |
| 249 | mv "${tf_build_root:?}/${plat:?}/${mode:?}/romlib/romlib.bin" "$tmpdir/romlib.bin" |
| 250 | mv "${tf_build_root:?}/${plat:?}/${mode:?}/bl1.bin" "$tmpdir/bl1.bin" |
| 251 | |
| 252 | # Patch index file |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 253 | cp "${tf_root:?}/plat/arm/board/fvp/jmptbl.i" "$fvp_romlib_jmptbl_backup" |
| 254 | sed -i '/fdt/ s/.$/&\ patch/' ${tf_root:?}/plat/arm/board/fvp/jmptbl.i |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 255 | |
| 256 | # Rebuild with patched file |
| 257 | echo "Building patched romlib:" |
| 258 | build_tf |
| 259 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 260 | # Retrieve original BL1 and romlib binaries |
| 261 | mv "$tmpdir/romlib.bin" "${tf_build_root:?}/${plat:?}/${mode:?}/romlib/romlib.bin" |
| 262 | mv "$tmpdir/bl1.bin" "${tf_build_root:?}/${plat:?}/${mode:?}/bl1.bin" |
| 263 | } |
| 264 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 265 | fvp_romlib_cleanup() { |
| 266 | # Restore original index |
| 267 | mv "$fvp_romlib_jmptbl_backup" "${tf_root:?}/plat/arm/board/fvp/jmptbl.i" |
| 268 | } |
| 269 | |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 270 | |
| 271 | fvp_gen_bin_url() { |
| 272 | local bin_mode="${bin_mode:?}" |
| 273 | local bin="${1:?}" |
| 274 | |
| 275 | if upon "$jenkins_run"; then |
| 276 | echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin" |
| 277 | else |
| 278 | echo "file://$workspace/artefacts/$bin_mode/$bin" |
| 279 | fi |
| 280 | } |
| 281 | |
| 282 | gen_fvp_yaml_template() { |
| 283 | local yaml_template_file="$workspace/fvp_template.yaml" |
| 284 | |
| 285 | # must parameters for yaml generation |
| 286 | local payload_type="${payload_type:?}" |
| 287 | |
| 288 | "$ci_root/script/gen_fvp_${payload_type}_yaml.sh" > "$yaml_template_file" |
| 289 | |
| 290 | archive_file "$yaml_template_file" |
| 291 | } |
| 292 | |
| 293 | gen_fvp_yaml() { |
Leonardo Sandoval | 00ced1f | 2020-12-07 12:55:08 -0600 | [diff] [blame] | 294 | local model="${model:?}" |
| 295 | |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 296 | local yaml_template_file="$workspace/fvp_template.yaml" |
| 297 | local yaml_file="$workspace/fvp.yaml" |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 298 | local yaml_job_file="$workspace/job.yaml" |
| 299 | local lava_model_params="$workspace/lava_model_params" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 300 | |
Leonardo Sandoval | fda4f29 | 2020-10-06 15:59:26 -0500 | [diff] [blame] | 301 | # this function expects a template, quit if it is not present |
| 302 | if [ ! -f "$yaml_template_file" ]; then |
| 303 | return |
| 304 | fi |
| 305 | |
Leonardo Sandoval | 00ced1f | 2020-12-07 12:55:08 -0600 | [diff] [blame] | 306 | local model_params="${fvp_models[$model]}" |
| 307 | local model_name="$(echo "${model_params}" | awk -F ';' '{print $1}')" |
| 308 | local model_dir="$(echo "${model_params}" | awk -F ';' '{print $2}')" |
| 309 | local model_bin="$(echo "${model_params}" | awk -F ';' '{print $3}')" |
| 310 | |
| 311 | # model params are required for correct yaml creation, quit if empty |
| 312 | if [ -z "${model_name}" ]; then |
| 313 | echo "FVP model param 'model_name' variable empty, yaml not produced" |
| 314 | return |
| 315 | elif [ -z "${model_dir}" ]; then |
| 316 | echo "FVP model param 'model_dir' variable empty, yaml not produced" |
| 317 | return |
| 318 | elif [ -z "${model_bin}" ]; then |
| 319 | echo "FVP model param 'model_bin' variable empty, yaml not produced" |
| 320 | return |
| 321 | fi |
| 322 | |
| 323 | echo "FVP model params: model_name=$model_name model_dir=$model_dir model_bin=$model_bin" |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 324 | |
Leonardo Sandoval | e5cdd36 | 2020-12-11 14:59:37 -0600 | [diff] [blame] | 325 | # FIXME: Foundation plaforms (model=foundationv8) are failing because LAVA [1] |
| 326 | # should read two ports, 5000 and 5002, but LAVA does not support this |
| 327 | # feature, so for the moment avoid creating any LAVA test job definition |
| 328 | # for this model until a solution is found. |
| 329 | # [1] https://tf.validation.linaro.org/scheduler/job/33871 |
Leonardo Sandoval | 239450c | 2021-01-11 17:51:12 -0600 | [diff] [blame] | 330 | if ! is_arm_jenkins_env; then |
| 331 | if [ "${model}" = "foundationv8" ]; then |
| 332 | return |
| 333 | fi |
Leonardo Sandoval | e5cdd36 | 2020-12-11 14:59:37 -0600 | [diff] [blame] | 334 | fi |
| 335 | |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 336 | # optional parameters, defaults to globals |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 337 | local model_dtb="${model_dtb:-$default_model_dtb}" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 338 | |
| 339 | # general artefacts |
| 340 | bl1="$(fvp_gen_bin_url bl1.bin)" |
| 341 | fip="$(fvp_gen_bin_url fip.bin)" |
| 342 | |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 343 | dtb="$(fvp_gen_bin_url ${model_dtb})" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 344 | image="$(fvp_gen_bin_url kernel.bin)" |
| 345 | ramdisk="$(fvp_gen_bin_url initrd.bin)" |
| 346 | |
Leonardo Sandoval | 44ac9aa | 2020-11-09 12:55:57 -0600 | [diff] [blame] | 347 | # tftf's ns_bl[1|2]u.bin and el3_payload artefacts |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 348 | ns_bl1u="$(fvp_gen_bin_url ns_bl1u.bin)" |
| 349 | ns_bl2u="$(fvp_gen_bin_url ns_bl2u.bin)" |
Leonardo Sandoval | 44ac9aa | 2020-11-09 12:55:57 -0600 | [diff] [blame] | 350 | el3_payload="$(fvp_gen_bin_url el3_payload.bin)" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 351 | |
| 352 | docker_registry="${docker_registry:-}" |
| 353 | docker_registry="$(docker_registry_append)" |
| 354 | |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 355 | docker_name="${docker_registry}$model_name" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 356 | |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 357 | # generic version string |
| 358 | local version_string="\"Fast Models"' [^\\n]+'"\"" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 359 | |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 360 | sed -e "s|\${ARMLMD_LICENSE_FILE}|${armlmd_license_file}|" \ |
| 361 | -e "s|\${ACTIONS_DEPLOY_IMAGES_BL1}|${bl1}|" \ |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 362 | -e "s|\${ACTIONS_DEPLOY_IMAGES_FIP}|${fip}|" \ |
| 363 | -e "s|\${ACTIONS_DEPLOY_IMAGES_DTB}|${dtb}|" \ |
| 364 | -e "s|\${ACTIONS_DEPLOY_IMAGES_IMAGE}|${image}|" \ |
| 365 | -e "s|\${ACTIONS_DEPLOY_IMAGES_RAMDISK}|${ramdisk}|" \ |
| 366 | -e "s|\${ACTIONS_DEPLOY_IMAGES_NS_BL1U}|${ns_bl1u}|" \ |
| 367 | -e "s|\${ACTIONS_DEPLOY_IMAGES_NS_BL2U}|${ns_bl2u}|" \ |
Leonardo Sandoval | 44ac9aa | 2020-11-09 12:55:57 -0600 | [diff] [blame] | 368 | -e "s|\${ACTIONS_DEPLOY_IMAGES_EL3_PAYLOAD}|${el3_payload}|" \ |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 369 | -e "s|\${BOOT_DOCKER_NAME}|${docker_name}|" \ |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 370 | -e "s|\${BOOT_IMAGE_DIR}|${model_dir}|" \ |
| 371 | -e "s|\${BOOT_IMAGE_BIN}|${model_bin}|" \ |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 372 | -e "s|\${BOOT_VERSION_STRING}|${version_string}|" \ |
Leonardo Sandoval | 7efdea0 | 2020-12-14 13:47:25 -0600 | [diff] [blame] | 373 | -e "s|\${MODEL}|${model}|" \ |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 374 | < "$yaml_template_file" \ |
| 375 | > "$yaml_file" |
| 376 | |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 377 | # LAVA expects 'macro' names for binaries, so replace them |
| 378 | sed -e "s|bl1.bin|{BL1}|" \ |
| 379 | -e "s|fip.bin|{FIP}|" \ |
Leonardo Sandoval | 44ac9aa | 2020-11-09 12:55:57 -0600 | [diff] [blame] | 380 | -e "s|ns_bl1u.bin|{NS_BL1U}|" \ |
| 381 | -e "s|ns_bl2u.bin|{NS_BL2U}|" \ |
| 382 | -e "s|el3_payload.bin|{EL3_PAYLOAD}|" \ |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 383 | -e "s|kernel.bin|{IMAGE}|" \ |
| 384 | -e "s|initrd.bin|{RAMDISK}|" \ |
| 385 | < "$archive/model_params" \ |
| 386 | > "$lava_model_params" |
| 387 | |
| 388 | |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 389 | # include the model parameters |
| 390 | while read -r line; do |
| 391 | if [ -n "$line" ]; then |
| 392 | yaml_line="- \"${line}\"" |
| 393 | sed -i -e "/\${BOOT_ARGUMENTS}/i \ \ \ \ $yaml_line" "$yaml_file" |
| 394 | fi |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 395 | done < "$lava_model_params" |
| 396 | |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 397 | sed -i -e '/\${BOOT_ARGUMENTS}/d' "$yaml_file" |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 398 | cp "$yaml_file" "$yaml_job_file" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 399 | |
| 400 | archive_file "$yaml_file" |
Leonardo Sandoval | 5d90dff | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 401 | archive_file "$yaml_job_file" |
Leonardo Sandoval | d76d1e2 | 2020-10-06 16:02:52 -0500 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | docker_registry_append() { |
| 405 | # if docker_registry is empty, just use local docker registry |
| 406 | [ -z "$docker_registry" ] && return |
| 407 | |
| 408 | local last=-1 |
| 409 | local last_char="${docker_registry:last}" |
| 410 | |
| 411 | if [ "$last_char" != '/' ]; then |
| 412 | docker_registry="${docker_registry}/"; |
| 413 | fi |
| 414 | echo "$docker_registry" |
| 415 | } |
| 416 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 417 | set +u |