blob: 9fa1b0d4cf833d3016f72f9cd10b7ddd85909ff7 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval579c7372020-10-23 15:23:32 -05003# Copyright (c) 2019-2020 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
10scp_bl2_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/scp_bl2.bin"
Zelalem219df412020-05-17 19:21:20 -050011psci_reset2_scp_bl2_url="$tfa_downloads/psci_reset2/scp_bl2.bin"
Fathi Boudra422bf772019-12-02 11:10:16 +020012uboot_bl33_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/bl33-uboot.bin"
Zelalem219df412020-05-17 19:21:20 -050013optee_fip_url="$linaro_release/juno-ack-android-uboot/SOFTWARE/fip.bin"
14
Fathi Boudra422bf772019-12-02 11:10:16 +020015juno_recovery_root="$linaro_release/juno-latest-oe-uboot"
16
17uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin"
18juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot"
Zelalem219df412020-05-17 19:21:20 -050019juno32_recovery_root_oe="$linaro_release/juno32-latest-oe-uboot"
Fathi Boudra422bf772019-12-02 11:10:16 +020020
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -050021juno_rootfs_url="${juno_rootfs_url:-$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz}"
22juno32_rootfs_url="${juno32_rootfs_url:-$linaro_release/linaro-image-alip-genericarmv7a-20150710-336.rootfs.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +020023
Fathi Boudra422bf772019-12-02 11:10:16 +020024get_optee_bin() {
Zelalem219df412020-05-17 19:21:20 -050025 local tmpdir="$(mktempdir)"
26
27 pushd "$tmpdir"
28 extract_fip "$optee_fip_url"
29 mv "tos-fw.bin" "bl32.bin"
Fathi Boudra422bf772019-12-02 11:10:16 +020030 archive_file "bl32.bin"
Zelalem219df412020-05-17 19:21:20 -050031 popd
Fathi Boudra422bf772019-12-02 11:10:16 +020032}
33
34get_scp_bl2_bin() {
35 url="$scp_bl2_url" saveas="scp_bl2.bin" fetch_file
36 archive_file "scp_bl2.bin"
37}
38
Zelalem219df412020-05-17 19:21:20 -050039get_psci_reset2_scp_bl2_bin() {
40 url="$psci_reset2_scp_bl2_url" saveas="scp_bl2.bin" fetch_file
41 archive_file "scp_bl2.bin"
42}
43
Fathi Boudra422bf772019-12-02 11:10:16 +020044get_uboot32_bin() {
45 local tmpdir="$(mktempdir)"
46
47 pushd "$tmpdir"
48 extract_fip "$uboot32_fip_url"
49 mv "nt-fw.bin" "uboot.bin"
50 archive_file "uboot.bin"
51 popd
52}
53
54get_uboot_bin() {
55 url="$uboot_bl33_url" saveas="uboot.bin" fetch_file
56 archive_file "uboot.bin"
57}
58
59gen_recovery_image32() {
60 url="$juno32_recovery_root" gen_recovery_image "$@"
61}
62
Zelalem219df412020-05-17 19:21:20 -050063gen_recovery_image32_oe() {
64 url="$juno32_recovery_root_oe" gen_recovery_image "$@"
65}
66
Fathi Boudra422bf772019-12-02 11:10:16 +020067gen_recovery_image() {
68 local zip_dir="$workspace/juno_recovery"
69 local zip_file="${zip_dir}.zip"
70 local url="${url:-$juno_recovery_root}"
71
72 saveas="$zip_dir" url="$url" fetch_directory
73 if [ "$*" ]; then
74 cp -f "$@" "$zip_dir/SOFTWARE"
75 fi
76
77 # If an image.txt file was specified, replace all image.txt file inside
78 # the recovery with the specified one.
79 if upon "$image_txt"; then
80 find "$zip_dir" -name images.txt -exec cp -f "$image_txt" {} \;
81 fi
82
Leonardo Sandoval7fe8e552020-07-30 17:01:29 -050083 (cd "$zip_dir" && zip -rq "$zip_file" -- *)
Fathi Boudra422bf772019-12-02 11:10:16 +020084 archive_file "$zip_file"
85}
86
87gen_juno_yaml() {
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -050088 local yaml_file="$workspace/juno.yaml"
89 local job_file="$workspace/job.yaml"
Fathi Boudra422bf772019-12-02 11:10:16 +020090 local payload_type="${payload_type:?}"
91
92 bin_mode="$mode" \
93 "$ci_root/script/gen_juno_${payload_type}_yaml.sh" > "$yaml_file"
94
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -050095 cp "$yaml_file" "$job_file"
Fathi Boudra422bf772019-12-02 11:10:16 +020096 archive_file "$yaml_file"
Leonardo Sandovalbe690bd2020-10-12 17:59:39 -050097 archive_file "$job_file"
Fathi Boudra422bf772019-12-02 11:10:16 +020098}
99
100juno_aarch32_runtime() {
101 # Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll
102 # lose the fiptool binary. Build that again for later use.
103 echo "Building BL32 in AArch32 for Juno:"
104 sed 's/^/\t/' < "${config_file:?}"
105 tf_build_config="$config_file" tf_build_targets="fiptool bl32" \
106 build_tf
107
108 # Copy BL32 to a temporary directoy, and update it in the FIP
109 local tmpdir="$(mktempdir)"
110 from="$tf_root/build/juno/$mode" to="$tmpdir" collect_build_artefacts
111 bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update
112}
113
Sandrine Bailleuxdd2c2552020-08-05 15:47:34 +0200114juno_manual_test_run() {
115 local zip_dir="$workspace/juno_recovery"
116 local zip_file="${zip_dir}.zip"
117 local tmpdir="$(mktempdir)"
118
119 # $1: test name
120 # $2: timeout (seconds)
121 # $3: log file path
122 $ci_root/script/juno_manual.py console02.remote.oss.arm.com login login $zip_file $tmpdir $1 $2 $3
123}
124
Fathi Boudra422bf772019-12-02 11:10:16 +0200125set +u