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