blob: 890f02644f08d3485fdb0e991b51254e5f0b4cb2 [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
21juno_rootfs_url="$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz"
Zelalem219df412020-05-17 19:21:20 -050022juno32_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() {
88 local yaml_file="$workspace/juno.yaml"
89 local payload_type="${payload_type:?}"
90
91 bin_mode="$mode" \
92 "$ci_root/script/gen_juno_${payload_type}_yaml.sh" > "$yaml_file"
93
94 archive_file "$yaml_file"
95}
96
97juno_aarch32_runtime() {
98 # Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll
99 # lose the fiptool binary. Build that again for later use.
100 echo "Building BL32 in AArch32 for Juno:"
101 sed 's/^/\t/' < "${config_file:?}"
102 tf_build_config="$config_file" tf_build_targets="fiptool bl32" \
103 build_tf
104
105 # Copy BL32 to a temporary directoy, and update it in the FIP
106 local tmpdir="$(mktempdir)"
107 from="$tf_root/build/juno/$mode" to="$tmpdir" collect_build_artefacts
108 bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update
109}
110
Sandrine Bailleuxdd2c2552020-08-05 15:47:34 +0200111juno_manual_test_run() {
112 local zip_dir="$workspace/juno_recovery"
113 local zip_file="${zip_dir}.zip"
114 local tmpdir="$(mktempdir)"
115
116 # $1: test name
117 # $2: timeout (seconds)
118 # $3: log file path
119 $ci_root/script/juno_manual.py console02.remote.oss.arm.com login login $zip_file $tmpdir $1 $2 $3
120}
121
Fathi Boudra422bf772019-12-02 11:10:16 +0200122set +u