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 | # |
Zelalem | 0a944bb | 2021-04-09 17:16:35 -0500 | [diff] [blame] | 3 | # Copyright (c) 2019-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 | |
Maksims Svecovs | a6c4dc2 | 2021-10-21 12:01:17 +0100 | [diff] [blame^] | 10 | # Pre-built SCP/MCP binaries |
| 11 | scp_bl1_url="$scp_mcp_downloads/juno/release/scp_bl1_bypass.bin" |
| 12 | scp_bl2_url="$scp_mcp_downloads/juno/release/scp_bl2.bin" |
Alexei Fedorov | 812ba0a | 2021-04-27 18:50:47 +0100 | [diff] [blame] | 13 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 14 | psci_reset2_scp_bl2_url="$tfa_downloads/psci_reset2/scp_bl2.bin" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 15 | uboot_bl33_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/bl33-uboot.bin" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 16 | optee_fip_url="$linaro_release/juno-ack-android-uboot/SOFTWARE/fip.bin" |
| 17 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 18 | juno_recovery_root="$linaro_release/juno-latest-oe-uboot" |
| 19 | |
| 20 | uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin" |
| 21 | juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 22 | juno32_recovery_root_oe="$linaro_release/juno32-latest-oe-uboot" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 23 | |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 24 | juno_rootfs_url="${juno_rootfs_url:-$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz}" |
| 25 | juno32_rootfs_url="${juno32_rootfs_url:-$linaro_release/linaro-image-alip-genericarmv7a-20150710-336.rootfs.tar.gz}" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 26 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 27 | get_optee_bin() { |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 28 | local tmpdir="$(mktempdir)" |
| 29 | |
| 30 | pushd "$tmpdir" |
| 31 | extract_fip "$optee_fip_url" |
| 32 | mv "tos-fw.bin" "bl32.bin" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 33 | archive_file "bl32.bin" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 34 | popd |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 35 | } |
| 36 | |
Zelalem | 0a944bb | 2021-04-09 17:16:35 -0500 | [diff] [blame] | 37 | # Get scp_bl1 and scp_bl2 binaries |
| 38 | # from $url and store as $saveas |
| 39 | get_scp_bl_bin() { |
| 40 | url="$url" saveas="$saveas" fetch_file |
| 41 | } |
| 42 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 43 | get_scp_bl2_bin() { |
| 44 | url="$scp_bl2_url" saveas="scp_bl2.bin" fetch_file |
| 45 | archive_file "scp_bl2.bin" |
| 46 | } |
| 47 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 48 | get_psci_reset2_scp_bl2_bin() { |
| 49 | url="$psci_reset2_scp_bl2_url" saveas="scp_bl2.bin" fetch_file |
| 50 | archive_file "scp_bl2.bin" |
| 51 | } |
| 52 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 53 | get_uboot32_bin() { |
| 54 | local tmpdir="$(mktempdir)" |
| 55 | |
| 56 | pushd "$tmpdir" |
| 57 | extract_fip "$uboot32_fip_url" |
| 58 | mv "nt-fw.bin" "uboot.bin" |
| 59 | archive_file "uboot.bin" |
| 60 | popd |
| 61 | } |
| 62 | |
| 63 | get_uboot_bin() { |
| 64 | url="$uboot_bl33_url" saveas="uboot.bin" fetch_file |
| 65 | archive_file "uboot.bin" |
| 66 | } |
| 67 | |
| 68 | gen_recovery_image32() { |
| 69 | url="$juno32_recovery_root" gen_recovery_image "$@" |
| 70 | } |
| 71 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 72 | gen_recovery_image32_oe() { |
| 73 | url="$juno32_recovery_root_oe" gen_recovery_image "$@" |
| 74 | } |
| 75 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 76 | gen_recovery_image() { |
| 77 | local zip_dir="$workspace/juno_recovery" |
| 78 | local zip_file="${zip_dir}.zip" |
| 79 | local url="${url:-$juno_recovery_root}" |
| 80 | |
| 81 | saveas="$zip_dir" url="$url" fetch_directory |
| 82 | if [ "$*" ]; then |
Zelalem | 0a944bb | 2021-04-09 17:16:35 -0500 | [diff] [blame] | 83 | # Copy scp_bl1 scp_bl2 binaries. Copying then first |
| 84 | # so that the subsequent copy can replace it if necessary. |
| 85 | url="$scp_bl1_url" saveas="$zip_dir/SOFTWARE/scp_bl1.bin" get_scp_bl_bin |
| 86 | url="$scp_bl2_url" saveas="$zip_dir/SOFTWARE/scp_bl2.bin" get_scp_bl_bin |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 87 | cp -f "$@" "$zip_dir/SOFTWARE" |
| 88 | fi |
| 89 | |
| 90 | # If an image.txt file was specified, replace all image.txt file inside |
| 91 | # the recovery with the specified one. |
| 92 | if upon "$image_txt"; then |
| 93 | find "$zip_dir" -name images.txt -exec cp -f "$image_txt" {} \; |
| 94 | fi |
| 95 | |
Leonardo Sandoval | 7fe8e55 | 2020-07-30 17:01:29 -0500 | [diff] [blame] | 96 | (cd "$zip_dir" && zip -rq "$zip_file" -- *) |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 97 | archive_file "$zip_file" |
| 98 | } |
| 99 | |
| 100 | gen_juno_yaml() { |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 101 | local yaml_file="$workspace/juno.yaml" |
| 102 | local job_file="$workspace/job.yaml" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 103 | local payload_type="${payload_type:?}" |
| 104 | |
| 105 | bin_mode="$mode" \ |
| 106 | "$ci_root/script/gen_juno_${payload_type}_yaml.sh" > "$yaml_file" |
| 107 | |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 108 | cp "$yaml_file" "$job_file" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 109 | archive_file "$yaml_file" |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 110 | archive_file "$job_file" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | juno_aarch32_runtime() { |
| 114 | # Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll |
| 115 | # lose the fiptool binary. Build that again for later use. |
| 116 | echo "Building BL32 in AArch32 for Juno:" |
| 117 | sed 's/^/\t/' < "${config_file:?}" |
| 118 | tf_build_config="$config_file" tf_build_targets="fiptool bl32" \ |
| 119 | build_tf |
| 120 | |
| 121 | # Copy BL32 to a temporary directoy, and update it in the FIP |
| 122 | local tmpdir="$(mktempdir)" |
| 123 | from="$tf_root/build/juno/$mode" to="$tmpdir" collect_build_artefacts |
| 124 | bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update |
| 125 | } |
| 126 | |
Sandrine Bailleux | dd2c255 | 2020-08-05 15:47:34 +0200 | [diff] [blame] | 127 | juno_manual_test_run() { |
| 128 | local zip_dir="$workspace/juno_recovery" |
| 129 | local zip_file="${zip_dir}.zip" |
| 130 | local tmpdir="$(mktempdir)" |
| 131 | |
| 132 | # $1: test name |
| 133 | # $2: timeout (seconds) |
| 134 | # $3: log file path |
| 135 | $ci_root/script/juno_manual.py console02.remote.oss.arm.com login login $zip_file $tmpdir $1 $2 $3 |
| 136 | } |
| 137 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 138 | set +u |