blob: d270d5652fa1b39c81b6c4582bf8118af3036e8d [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval00ced1f2020-12-07 12:55:08 -06003# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set -u
9
10bl1_addr="${bl1_addr:-0x0}"
Zelalem219df412020-05-17 19:21:20 -050011bl31_addr="${bl31_addr:-0x04001000}"
Zelalem1b874612020-08-04 18:08:18 -050012bl32_addr="${bl32_addr:-0x04003000}"
Fathi Boudra422bf772019-12-02 11:10:16 +020013bl33_addr="${bl33_addr:-0x88000000}"
14dtb_addr="${dtb_addr:-0x82000000}"
15fip_addr="${fip_addr:-0x08000000}"
16initrd_addr="${initrd_addr:-0x84000000}"
17kernel_addr="${kernel_addr:-0x80080000}"
18el3_payload_addr="${el3_payload_addr:-0x80000000}"
19
Manish Pandey3c435582020-07-15 12:14:26 +010020# SPM requires following addresses for RESET_TO_BL31 case
21spm_addr="${spm_addr:-0x6000000}"
22spmc_manifest_addr="${spmc_addr:-0x0403f000}"
23sp1_addr="${sp1_addr:-0x7000000}"
24sp2_addr="${sp2_addr:-0x7100000}"
Olivier Deprez0b834092020-08-21 08:36:01 +020025sp3_addr="${sp3_addr:-0x7200000}"
Manish Pandey1e7be852020-11-09 16:04:48 +000026# SPM out directories
27export spm_secure_out_dir="${spm_secure_out_dir:-secure_aem_v8a_fvp_clang}"
28export spm_non_secure_out_dir="${spm_non_secure_out_dir:-aem_v8a_fvp_clang}"
Manish Pandey3c435582020-07-15 12:14:26 +010029
Fathi Boudra422bf772019-12-02 11:10:16 +020030ns_bl1u_addr="${ns_bl1u_addr:-0x0beb8000}"
31fwu_fip_addr="${fwu_fip_addr:-0x08400000}"
32backup_fip_addr="${backup_fip_addr:-0x09000000}"
33romlib_addr="${romlib_addr:-0x03ff2000}"
34
Sandrine Bailleux3f3b51d2021-02-24 14:45:49 +010035optee_fip_url="$linaro_release/fvp-ack-busybox-uboot/fip.bin"
36
Fathi Boudra422bf772019-12-02 11:10:16 +020037uboot32_fip_url="$linaro_release/fvp32-latest-busybox-uboot/fip.bin"
38
Alexei Fedorove405cc32020-09-30 18:13:55 +010039rootfs_url="$linaro_release/lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz"
Fathi Boudra422bf772019-12-02 11:10:16 +020040
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -050041# Default FVP model variables
42default_model_dtb="fvp-base-gicv3-psci.dtb"
43
Leonardo Sandoval00ced1f2020-12-07 12:55:08 -060044# FVP containers and model paths
45fvp_arm_std_library="fvp:fvp_arm_std_library_${model_version}_${model_build};/opt/model/FVP_ARM_Std_Library/models/${model_flavour}"
46fvp_base_revc_2xaemv8a="fvp:fvp_base_revc-2xaemv8a_${model_version}_${model_build};/opt/model/Base_RevC_AEMv8A_pkg/models/${model_flavour}"
47foundation_platform="fvp:foundation_platform_${model_version}_${model_build};/opt/model/Foundation_Platformpkg/models/${model_flavour}"
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -050048
Leonardo Sandoval00ced1f2020-12-07 12:55:08 -060049# FVP associate array, run_config are keys and fvp container parameters are the values
50# Container parameters syntax: <model name>;<model dir>;<model bin>
51# FIXMEs: fix those ;;; values with real values
52
53declare -A fvp_models
54fvp_models=(
55[base-aemv8a-quad]=";;;"
56[base-aemv8a-revb]=";;;"
57[base-aemv8a-latest-revb]=";;;"
58[base-aemva]=";;;"
59[foundationv8]="${foundation_platform};Foundation_Platform"
60[base-aemv8a]="${fvp_base_revc_2xaemv8a};FVP_Base_RevC-2xAEMv8A"
61[cortex-a32x4]="${fvp_arm_std_library};FVP_Base_Cortex-A32x4"
62[cortex-a35x4]="${fvp_arm_std_library};FVP_Base_Cortex-A35x4"
63[cortex-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A53x4"
64[cortex-a55x4-a75x4]="${fvp_arm_std_library};FVP_Base_Cortex-A55x4-A75x4"
65[cortex-a55x4-a76x2]="${fvp_arm_std_library};FVP_Base_Cortex-A55x4-A76x2"
66[cortex-a57x1-a53x1]="${fvp_arm_std_library};FVP_Base_Cortex-A57x1-A53x1"
67[cortex-a57x2-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A57x2-A53x4"
68[cortex-a57x4]="${fvp_arm_std_library};FVP_Base_Cortex-A57x4"
69[cortex-a57x4-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A57x4-A53x4"
70[cortex-a65aex8]="${fvp_arm_std_library};FVP_Base_Cortex-A65AEx8"
71[cortex-a65x4]="${fvp_arm_std_library};FVP_Base_Cortex-A65x4"
72[cortex-a72x4]="${fvp_arm_std_library};FVP_Base_Cortex-A72x4"
73[cortex-a72x4-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A72x4-A53x4"
74[cortex-a73x4]="${fvp_arm_std_library};FVP_Base_Cortex-A73x4"
75[cortex-a73x4-a53x4]="${fvp_arm_std_library};FVP_Base_Cortex-A73x4-A53x4"
76[cortex-a75x4]="${fvp_arm_std_library};FVP_Base_Cortex-A75x4"
77[cortex-a76aex4]="${fvp_arm_std_library};FVP_Base_Cortex-A76AEx4"
78[cortex-a76aex2]="${fvp_arm_std_library};FVP_Base_Cortex-A76AEx2"
79[cortex-a76x4]="${fvp_arm_std_library};FVP_Base_Cortex-A76x4"
80[cortex-a77x4]="${fvp_arm_std_library};FVP_Base_Cortex-A77x4"
81[cortex-a78x4]="${fvp_arm_std_library};FVP_Base_Cortex-A78x4"
82[neoverse_e1x1]="${fvp_arm_std_library};FVP_Base_Neoverse-E1x1"
83[neoverse_e1x2]="${fvp_arm_std_library};FVP_Base_Neoverse-E1x2"
84[neoverse_e1x4]="${fvp_arm_std_library};FVP_Base_Neoverse-E1x4"
85[neoverse_n1]="${fvp_arm_std_library};FVP_Base_Neoverse-N1x1"
86[neoverse_n2]=";;;"
87[neoverse-v1x4]=";;;"
88[css-rdv1]=";;;"
89[css-rde1edge]=";;;"
90[css-rdn1edge]=";;;"
91[css-rdn1edgex2]=";;;"
92[css-sgi575]=";;;"
93[css-sgm775]=";;;"
94[tc0]=";;;"
95)
96
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -050097
Fathi Boudra422bf772019-12-02 11:10:16 +020098# FVP Kernel URLs
99declare -A fvp_kernels
100fvp_kernels=(
101[fvp-aarch32-zimage]="$linaro_release/fvp32-latest-busybox-uboot/Image"
102[fvp-busybox-uboot]="$linaro_release/fvp-latest-busybox-uboot/Image"
103[fvp-oe-uboot32]="$linaro_release/fvp32-latest-oe-uboot/Image"
104[fvp-oe-uboot]="$linaro_release/fvp-latest-oe-uboot/Image"
105[fvp-quad-busybox-uboot]="$tfa_downloads/quad_cluster/Image"
106)
107
Fathi Boudra422bf772019-12-02 11:10:16 +0200108# FVP initrd URLs
109declare -A fvp_initrd_urls
110fvp_initrd_urls=(
111[aarch32-ramdisk]="$linaro_release/fvp32-latest-busybox-uboot/ramdisk.img"
Fathi Boudra422bf772019-12-02 11:10:16 +0200112[dummy-ramdisk]="$linaro_release/fvp-latest-oe-uboot/ramdisk.img"
113[dummy-ramdisk32]="$linaro_release/fvp32-latest-oe-uboot/ramdisk.img"
114[default]="$linaro_release/fvp-latest-busybox-uboot/ramdisk.img"
115)
116
Fathi Boudra422bf772019-12-02 11:10:16 +0200117get_optee_bin() {
Sandrine Bailleux3f3b51d2021-02-24 14:45:49 +0100118 local tmpdir="$(mktempdir)"
119
120 pushd "$tmpdir"
121 extract_fip "$optee_fip_url"
122 mv "tos-fw.bin" "bl32.bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200123 archive_file "bl32.bin"
Sandrine Bailleux3f3b51d2021-02-24 14:45:49 +0100124 popd
Fathi Boudra422bf772019-12-02 11:10:16 +0200125}
126
Javier Almansa Sobrino98de5032020-09-17 12:47:05 +0100127# For Measured Boot tests using a TA based on OPTEE, it is necessary to use a
128# specific build rather than the default one generated by Jenkins.
129get_ftpm_optee_bin() {
Javier Almansa Sobrinode647722020-10-08 19:17:44 +0100130 url="$tfa_downloads/ftpm/optee/tee-header_v2.bin" \
Javier Almansa Sobrino98de5032020-09-17 12:47:05 +0100131 saveas="bl32.bin" fetch_file
132 archive_file "bl32.bin"
133
Javier Almansa Sobrinode647722020-10-08 19:17:44 +0100134 url="$tfa_downloads/ftpm/optee/tee-pager_v2.bin" \
Javier Almansa Sobrino98de5032020-09-17 12:47:05 +0100135 saveas="bl32_extra1.bin" fetch_file
136 archive_file "bl32_extra1.bin"
137
Javier Almansa Sobrinode647722020-10-08 19:17:44 +0100138 url="$tfa_downloads/ftpm/optee/tee-pageable_v2.bin" \
Javier Almansa Sobrino98de5032020-09-17 12:47:05 +0100139 saveas="bl32_extra2.bin" fetch_file
140 archive_file "bl32_extra2.bin"
141}
142
Fathi Boudra422bf772019-12-02 11:10:16 +0200143get_uboot32_bin() {
144 local tmpdir="$(mktempdir)"
145
146 pushd "$tmpdir"
147 extract_fip "$uboot32_fip_url"
148 mv "nt-fw.bin" "uboot.bin"
149 archive_file "uboot.bin"
150 popd
151}
152
153get_uboot_bin() {
154 local uboot_url="$linaro_release/fvp-latest-busybox-uboot/bl33-uboot.bin"
155
156 url="$uboot_url" saveas="uboot.bin" fetch_file
157 archive_file "uboot.bin"
158}
159
160get_uefi_bin() {
Zelalem219df412020-05-17 19:21:20 -0500161 uefi_downloads="${uefi_downloads:-http://files.oss.arm.com/downloads/uefi}"
162 uefi_ci_bin_url="${uefi_ci_bin_url:-$uefi_downloads/Artifacts/Linux/github/fvp/static/DEBUG_GCC5/FVP_AARCH64_EFI.fd}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200163
164 url=$uefi_ci_bin_url saveas="uefi.bin" fetch_file
165 archive_file "uefi.bin"
166}
167
168get_kernel() {
169 local kernel_type="${kernel_type:?}"
170 local url="${fvp_kernels[$kernel_type]}"
171
172 url="${url:?}" saveas="kernel.bin" fetch_file
173 archive_file "kernel.bin"
174}
175
176get_initrd() {
177 local initrd_type="${initrd_type:?}"
178 local url="${fvp_initrd_urls[$initrd_type]}"
179
180 url="${url:?}" saveas="initrd.bin" fetch_file
181 archive_file "initrd.bin"
182}
183
184get_dtb() {
185 local dtb_type="${dtb_type:?}"
186 local dtb_url
187 local dtb_saveas="$workspace/dtb.bin"
Zelalem219df412020-05-17 19:21:20 -0500188 local cc="$(get_tf_opt CROSS_COMPILE)"
189 local pp_flags="-P -nostdinc -undef -x assembler-with-cpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200190
191 case "$dtb_type" in
192 "fvp-base-quad-cluster-gicv3-psci")
193 # Get the quad-cluster FDT from pdsw area
194 dtb_url="$tfa_downloads/quad_cluster/fvp-base-quad-cluster-gicv3-psci.dtb"
195 url="$dtb_url" saveas="$dtb_saveas" fetch_file
196 ;;
197 "sgm775")
198 # Get the SGM775 FDT from pdsw area
199 dtb_url="$sgm_prebuilts/sgm775.dtb"
200 url="$dtb_url" saveas="$dtb_saveas" fetch_file
201 ;;
202 *)
Zelalem219df412020-05-17 19:21:20 -0500203 # Preprocess DTS file
204 ${cc}gcc -E ${pp_flags} -I"$tf_root/fdts" -I"$tf_root/include" \
205 -o "$workspace/${dtb_type}.pre.dts" \
206 "$tf_root/fdts/${dtb_type}.dts"
207 # Generate DTB file from DTS
Fathi Boudra422bf772019-12-02 11:10:16 +0200208 dtc -I dts -O dtb \
Zelalem219df412020-05-17 19:21:20 -0500209 "$workspace/${dtb_type}.pre.dts" -o "$dtb_saveas"
Fathi Boudra422bf772019-12-02 11:10:16 +0200210 esac
211
212 archive_file "$dtb_saveas"
213}
214
215get_rootfs() {
216 local tmpdir
217 local fs_base="$(echo $(basename $rootfs_url) | sed 's/\.gz$//')"
218 local cached="$project_filer/ci-files/$fs_base"
219
220 if upon "$jenkins_run" && [ -f "$cached" ]; then
221 # Job workspace is limited in size, and the root file system is
222 # quite large. This means, parallel runs of root file system
223 # tests could fail. So, for Jenkins runs, copy and use the root
224 # file system image from the $CI_SCRATCH location
225 local private="$CI_SCRATCH/$JOB_NAME-$BUILD_NUMBER"
226 mkdir -p "$private"
227 rm -f "$private/rootfs.bin"
228 url="$cached" saveas="$private/rootfs.bin" fetch_file
229 ln -s "$private/rootfs.bin" "$archive/rootfs.bin"
230 return
231 fi
232
233 tmpdir="$(mktempdir)"
234 pushd "$tmpdir"
235 url="$rootfs_url" saveas="rootfs.bin" fetch_file
236
237 # Possibly, the filesystem image we just downloaded is compressed.
238 # Decompress it if required.
239 if file "rootfs.bin" | grep -iq 'gzip compressed data'; then
240 echo "Decompressing root file system image rootfs.bin ..."
241 gunzip --stdout "rootfs.bin" > uncompressed_fs.bin
242 mv uncompressed_fs.bin "rootfs.bin"
243 fi
244
245 archive_file "rootfs.bin"
246 popd
247}
248
Zelalem219df412020-05-17 19:21:20 -0500249fvp_romlib_jmptbl_backup="$(mktempdir)/jmptbl.i"
250
Fathi Boudra422bf772019-12-02 11:10:16 +0200251fvp_romlib_runtime() {
252 local tmpdir="$(mktempdir)"
253
254 # Save BL1 and romlib binaries from original build
255 mv "${tf_build_root:?}/${plat:?}/${mode:?}/romlib/romlib.bin" "$tmpdir/romlib.bin"
256 mv "${tf_build_root:?}/${plat:?}/${mode:?}/bl1.bin" "$tmpdir/bl1.bin"
257
258 # Patch index file
Zelalem219df412020-05-17 19:21:20 -0500259 cp "${tf_root:?}/plat/arm/board/fvp/jmptbl.i" "$fvp_romlib_jmptbl_backup"
260 sed -i '/fdt/ s/.$/&\ patch/' ${tf_root:?}/plat/arm/board/fvp/jmptbl.i
Fathi Boudra422bf772019-12-02 11:10:16 +0200261
262 # Rebuild with patched file
263 echo "Building patched romlib:"
264 build_tf
265
Fathi Boudra422bf772019-12-02 11:10:16 +0200266 # Retrieve original BL1 and romlib binaries
267 mv "$tmpdir/romlib.bin" "${tf_build_root:?}/${plat:?}/${mode:?}/romlib/romlib.bin"
268 mv "$tmpdir/bl1.bin" "${tf_build_root:?}/${plat:?}/${mode:?}/bl1.bin"
269}
270
Zelalem219df412020-05-17 19:21:20 -0500271fvp_romlib_cleanup() {
272 # Restore original index
273 mv "$fvp_romlib_jmptbl_backup" "${tf_root:?}/plat/arm/board/fvp/jmptbl.i"
274}
275
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500276
277fvp_gen_bin_url() {
278 local bin_mode="${bin_mode:?}"
279 local bin="${1:?}"
280
281 if upon "$jenkins_run"; then
282 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
283 else
284 echo "file://$workspace/artefacts/$bin_mode/$bin"
285 fi
286}
287
288gen_fvp_yaml_template() {
289 local yaml_template_file="$workspace/fvp_template.yaml"
290
291 # must parameters for yaml generation
292 local payload_type="${payload_type:?}"
293
294 "$ci_root/script/gen_fvp_${payload_type}_yaml.sh" > "$yaml_template_file"
295
296 archive_file "$yaml_template_file"
297}
298
299gen_fvp_yaml() {
Leonardo Sandoval00ced1f2020-12-07 12:55:08 -0600300 local model="${model:?}"
301
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500302 local yaml_template_file="$workspace/fvp_template.yaml"
303 local yaml_file="$workspace/fvp.yaml"
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500304 local yaml_job_file="$workspace/job.yaml"
305 local lava_model_params="$workspace/lava_model_params"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500306
Leonardo Sandovalfda4f292020-10-06 15:59:26 -0500307 # this function expects a template, quit if it is not present
308 if [ ! -f "$yaml_template_file" ]; then
309 return
310 fi
311
Leonardo Sandoval00ced1f2020-12-07 12:55:08 -0600312 local model_params="${fvp_models[$model]}"
313 local model_name="$(echo "${model_params}" | awk -F ';' '{print $1}')"
314 local model_dir="$(echo "${model_params}" | awk -F ';' '{print $2}')"
315 local model_bin="$(echo "${model_params}" | awk -F ';' '{print $3}')"
316
317 # model params are required for correct yaml creation, quit if empty
318 if [ -z "${model_name}" ]; then
319 echo "FVP model param 'model_name' variable empty, yaml not produced"
320 return
321 elif [ -z "${model_dir}" ]; then
322 echo "FVP model param 'model_dir' variable empty, yaml not produced"
323 return
324 elif [ -z "${model_bin}" ]; then
325 echo "FVP model param 'model_bin' variable empty, yaml not produced"
326 return
327 fi
328
329 echo "FVP model params: model_name=$model_name model_dir=$model_dir model_bin=$model_bin"
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500330
Leonardo Sandovale5cdd362020-12-11 14:59:37 -0600331 # FIXME: Foundation plaforms (model=foundationv8) are failing because LAVA [1]
332 # should read two ports, 5000 and 5002, but LAVA does not support this
333 # feature, so for the moment avoid creating any LAVA test job definition
334 # for this model until a solution is found.
335 # [1] https://tf.validation.linaro.org/scheduler/job/33871
Leonardo Sandoval239450c2021-01-11 17:51:12 -0600336 if ! is_arm_jenkins_env; then
337 if [ "${model}" = "foundationv8" ]; then
338 return
339 fi
Leonardo Sandovale5cdd362020-12-11 14:59:37 -0600340 fi
341
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500342 # optional parameters, defaults to globals
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500343 local model_dtb="${model_dtb:-$default_model_dtb}"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500344
345 # general artefacts
346 bl1="$(fvp_gen_bin_url bl1.bin)"
347 fip="$(fvp_gen_bin_url fip.bin)"
348
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500349 dtb="$(fvp_gen_bin_url ${model_dtb})"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500350 image="$(fvp_gen_bin_url kernel.bin)"
351 ramdisk="$(fvp_gen_bin_url initrd.bin)"
352
Leonardo Sandoval44ac9aa2020-11-09 12:55:57 -0600353 # tftf's ns_bl[1|2]u.bin and el3_payload artefacts
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500354 ns_bl1u="$(fvp_gen_bin_url ns_bl1u.bin)"
355 ns_bl2u="$(fvp_gen_bin_url ns_bl2u.bin)"
Leonardo Sandoval44ac9aa2020-11-09 12:55:57 -0600356 el3_payload="$(fvp_gen_bin_url el3_payload.bin)"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500357
358 docker_registry="${docker_registry:-}"
359 docker_registry="$(docker_registry_append)"
360
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500361 docker_name="${docker_registry}$model_name"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500362
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -0500363 # generic version string
364 local version_string="\"Fast Models"' [^\\n]+'"\""
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500365
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -0500366 sed -e "s|\${ARMLMD_LICENSE_FILE}|${armlmd_license_file}|" \
367 -e "s|\${ACTIONS_DEPLOY_IMAGES_BL1}|${bl1}|" \
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500368 -e "s|\${ACTIONS_DEPLOY_IMAGES_FIP}|${fip}|" \
369 -e "s|\${ACTIONS_DEPLOY_IMAGES_DTB}|${dtb}|" \
370 -e "s|\${ACTIONS_DEPLOY_IMAGES_IMAGE}|${image}|" \
371 -e "s|\${ACTIONS_DEPLOY_IMAGES_RAMDISK}|${ramdisk}|" \
372 -e "s|\${ACTIONS_DEPLOY_IMAGES_NS_BL1U}|${ns_bl1u}|" \
373 -e "s|\${ACTIONS_DEPLOY_IMAGES_NS_BL2U}|${ns_bl2u}|" \
Leonardo Sandoval44ac9aa2020-11-09 12:55:57 -0600374 -e "s|\${ACTIONS_DEPLOY_IMAGES_EL3_PAYLOAD}|${el3_payload}|" \
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500375 -e "s|\${BOOT_DOCKER_NAME}|${docker_name}|" \
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500376 -e "s|\${BOOT_IMAGE_DIR}|${model_dir}|" \
377 -e "s|\${BOOT_IMAGE_BIN}|${model_bin}|" \
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500378 -e "s|\${BOOT_VERSION_STRING}|${version_string}|" \
Leonardo Sandoval7efdea02020-12-14 13:47:25 -0600379 -e "s|\${MODEL}|${model}|" \
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500380 < "$yaml_template_file" \
381 > "$yaml_file"
382
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -0500383 # LAVA expects 'macro' names for binaries, so replace them
384 sed -e "s|bl1.bin|{BL1}|" \
385 -e "s|fip.bin|{FIP}|" \
Leonardo Sandoval44ac9aa2020-11-09 12:55:57 -0600386 -e "s|ns_bl1u.bin|{NS_BL1U}|" \
387 -e "s|ns_bl2u.bin|{NS_BL2U}|" \
388 -e "s|el3_payload.bin|{EL3_PAYLOAD}|" \
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -0500389 -e "s|kernel.bin|{IMAGE}|" \
390 -e "s|initrd.bin|{RAMDISK}|" \
391 < "$archive/model_params" \
392 > "$lava_model_params"
393
394
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500395 # include the model parameters
396 while read -r line; do
397 if [ -n "$line" ]; then
398 yaml_line="- \"${line}\""
399 sed -i -e "/\${BOOT_ARGUMENTS}/i \ \ \ \ $yaml_line" "$yaml_file"
400 fi
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -0500401 done < "$lava_model_params"
402
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500403 sed -i -e '/\${BOOT_ARGUMENTS}/d' "$yaml_file"
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500404 cp "$yaml_file" "$yaml_job_file"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500405
406 archive_file "$yaml_file"
Leonardo Sandoval5d90dff2020-10-12 17:59:39 -0500407 archive_file "$yaml_job_file"
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500408}
409
410docker_registry_append() {
411 # if docker_registry is empty, just use local docker registry
412 [ -z "$docker_registry" ] && return
413
414 local last=-1
415 local last_char="${docker_registry:last}"
416
417 if [ "$last_char" != '/' ]; then
418 docker_registry="${docker_registry}/";
419 fi
420 echo "$docker_registry"
421}
422
Fathi Boudra422bf772019-12-02 11:10:16 +0200423set +u