Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2019, Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | set -u |
| 9 | |
| 10 | scp_bl2_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/scp_bl2.bin" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame^] | 11 | psci_reset2_scp_bl2_url="$tfa_downloads/psci_reset2/scp_bl2.bin" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 12 | uboot_bl33_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/bl33-uboot.bin" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame^] | 13 | optee_fip_url="$linaro_release/juno-ack-android-uboot/SOFTWARE/fip.bin" |
| 14 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 15 | juno_recovery_root="$linaro_release/juno-latest-oe-uboot" |
| 16 | |
| 17 | uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin" |
| 18 | juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame^] | 19 | juno32_recovery_root_oe="$linaro_release/juno32-latest-oe-uboot" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 20 | |
| 21 | juno_rootfs_url="$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame^] | 22 | 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] | 23 | |
| 24 | # FIXME use optee pre-built binaries |
| 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 | |
| 35 | get_scp_bl2_bin() { |
| 36 | url="$scp_bl2_url" saveas="scp_bl2.bin" fetch_file |
| 37 | archive_file "scp_bl2.bin" |
| 38 | } |
| 39 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame^] | 40 | get_psci_reset2_scp_bl2_bin() { |
| 41 | url="$psci_reset2_scp_bl2_url" saveas="scp_bl2.bin" fetch_file |
| 42 | archive_file "scp_bl2.bin" |
| 43 | } |
| 44 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 45 | get_uboot32_bin() { |
| 46 | local tmpdir="$(mktempdir)" |
| 47 | |
| 48 | pushd "$tmpdir" |
| 49 | extract_fip "$uboot32_fip_url" |
| 50 | mv "nt-fw.bin" "uboot.bin" |
| 51 | archive_file "uboot.bin" |
| 52 | popd |
| 53 | } |
| 54 | |
| 55 | get_uboot_bin() { |
| 56 | url="$uboot_bl33_url" saveas="uboot.bin" fetch_file |
| 57 | archive_file "uboot.bin" |
| 58 | } |
| 59 | |
| 60 | gen_recovery_image32() { |
| 61 | url="$juno32_recovery_root" gen_recovery_image "$@" |
| 62 | } |
| 63 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame^] | 64 | gen_recovery_image32_oe() { |
| 65 | url="$juno32_recovery_root_oe" gen_recovery_image "$@" |
| 66 | } |
| 67 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 68 | gen_recovery_image() { |
| 69 | local zip_dir="$workspace/juno_recovery" |
| 70 | local zip_file="${zip_dir}.zip" |
| 71 | local url="${url:-$juno_recovery_root}" |
| 72 | |
| 73 | saveas="$zip_dir" url="$url" fetch_directory |
| 74 | if [ "$*" ]; then |
| 75 | cp -f "$@" "$zip_dir/SOFTWARE" |
| 76 | fi |
| 77 | |
| 78 | # If an image.txt file was specified, replace all image.txt file inside |
| 79 | # the recovery with the specified one. |
| 80 | if upon "$image_txt"; then |
| 81 | find "$zip_dir" -name images.txt -exec cp -f "$image_txt" {} \; |
| 82 | fi |
| 83 | |
| 84 | (cd "$zip_dir" && zip -rq "$zip_file" *) |
| 85 | archive_file "$zip_file" |
| 86 | } |
| 87 | |
| 88 | gen_juno_yaml() { |
| 89 | local yaml_file="$workspace/juno.yaml" |
| 90 | local payload_type="${payload_type:?}" |
| 91 | |
| 92 | bin_mode="$mode" \ |
| 93 | "$ci_root/script/gen_juno_${payload_type}_yaml.sh" > "$yaml_file" |
| 94 | |
| 95 | archive_file "$yaml_file" |
| 96 | } |
| 97 | |
| 98 | juno_aarch32_runtime() { |
| 99 | # Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll |
| 100 | # lose the fiptool binary. Build that again for later use. |
| 101 | echo "Building BL32 in AArch32 for Juno:" |
| 102 | sed 's/^/\t/' < "${config_file:?}" |
| 103 | tf_build_config="$config_file" tf_build_targets="fiptool bl32" \ |
| 104 | build_tf |
| 105 | |
| 106 | # Copy BL32 to a temporary directoy, and update it in the FIP |
| 107 | local tmpdir="$(mktempdir)" |
| 108 | from="$tf_root/build/juno/$mode" to="$tmpdir" collect_build_artefacts |
| 109 | bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update |
| 110 | } |
| 111 | |
| 112 | set +u |