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 | # |
Harrison Mutai | 6582818 | 2023-03-27 14:18:18 +0100 | [diff] [blame] | 3 | # Copyright (c) 2019-2023 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 |
Manish V Badarkhe | fac74d3 | 2024-01-29 18:44:03 +0000 | [diff] [blame] | 11 | scp_bl1_url="$scp_mcp_downloads/juno/platform_variant_BOARD/release/juno-bl1-bypass.bin" |
| 12 | scp_bl2_url="$scp_mcp_downloads/juno/platform_variant_BOARD/release/juno-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" |
Andre Przywara | 139d58d | 2021-12-03 13:39:11 +0000 | [diff] [blame] | 16 | ml_uboot_bl33_url="$tfa_downloads/linux_boot/u-boot-juno.bin" |
| 17 | uboot_env_url="$tfa_downloads/linux_boot/u-boot-env.bin" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 18 | optee_fip_url="$linaro_release/juno-ack-android-uboot/SOFTWARE/fip.bin" |
| 19 | |
Andre Przywara | 139d58d | 2021-12-03 13:39:11 +0000 | [diff] [blame] | 20 | linux_image_url="$tfa_downloads/linux_boot/Image.gz" |
| 21 | # Busybox based initrd |
| 22 | linux_busybox_initrd_url="$tfa_downloads/linux_boot/initbb.img" |
| 23 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 24 | juno_recovery_root="$linaro_release/juno-latest-oe-uboot" |
| 25 | |
| 26 | uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin" |
| 27 | juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot" |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 28 | juno32_recovery_root_oe="$linaro_release/juno32-latest-oe-uboot" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 29 | |
Leonardo Sandoval | be690bd | 2020-10-12 17:59:39 -0500 | [diff] [blame] | 30 | juno_rootfs_url="${juno_rootfs_url:-$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz}" |
| 31 | 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] | 32 | |
Andre Przywara | 139d58d | 2021-12-03 13:39:11 +0000 | [diff] [blame] | 33 | get_ml_uboot_bin() { |
| 34 | url="$ml_uboot_bl33_url" saveas="uboot.bin" fetch_file |
| 35 | archive_file "uboot.bin" |
| 36 | url="$uboot_env_url" saveas="blank.img" fetch_file |
| 37 | archive_file "blank.img" |
| 38 | } |
| 39 | |
| 40 | get_linux_image() { |
| 41 | url="$linux_image_url" saveas="Image" fetch_file |
| 42 | archive_file "Image" |
| 43 | url="$linux_busybox_initrd_url" saveas="ramdisk.img" fetch_file |
| 44 | archive_file "ramdisk.img" |
| 45 | } |
| 46 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 47 | gen_recovery_image32() { |
| 48 | url="$juno32_recovery_root" gen_recovery_image "$@" |
| 49 | } |
| 50 | |
Zelalem | 219df41 | 2020-05-17 19:21:20 -0500 | [diff] [blame] | 51 | gen_recovery_image32_oe() { |
| 52 | url="$juno32_recovery_root_oe" gen_recovery_image "$@" |
| 53 | } |
| 54 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 55 | gen_recovery_image() { |
| 56 | local zip_dir="$workspace/juno_recovery" |
| 57 | local zip_file="${zip_dir}.zip" |
| 58 | local url="${url:-$juno_recovery_root}" |
| 59 | |
| 60 | saveas="$zip_dir" url="$url" fetch_directory |
| 61 | if [ "$*" ]; then |
Andre Przywara | cb15479 | 2021-12-03 13:24:03 +0000 | [diff] [blame] | 62 | # Replace files needed for this test. Copying them first so |
| 63 | # that the subsequent copy can replace it if necessary. |
| 64 | url="$scp_bl1_url" saveas="$zip_dir/SOFTWARE/scp_bl1.bin" fetch_file |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 65 | cp -f "$@" "$zip_dir/SOFTWARE" |
| 66 | fi |
| 67 | |
Andre Przywara | 139d58d | 2021-12-03 13:39:11 +0000 | [diff] [blame] | 68 | # The Linaro recovery image has a bug in the images.txt files, which |
| 69 | # puts the U-Boot environment in the wrong place (the address is |
| 70 | # relative to the beginning of NOR flash, it's not an absolute MMIO |
| 71 | # address). Fix that up so that we can update the environment. |
| 72 | sed -ie "s/0x0BFC0000/0x03FC0000/" "$zip_dir"/SITE1/HBI0262?/images.txt |
| 73 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 74 | # If an image.txt file was specified, replace all image.txt file inside |
| 75 | # the recovery with the specified one. |
| 76 | if upon "$image_txt"; then |
| 77 | find "$zip_dir" -name images.txt -exec cp -f "$image_txt" {} \; |
| 78 | fi |
| 79 | |
Leonardo Sandoval | 7fe8e55 | 2020-07-30 17:01:29 -0500 | [diff] [blame] | 80 | (cd "$zip_dir" && zip -rq "$zip_file" -- *) |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 81 | archive_file "$zip_file" |
| 82 | } |
| 83 | |
| 84 | gen_juno_yaml() { |
Harrison Mutai | 6582818 | 2023-03-27 14:18:18 +0100 | [diff] [blame] | 85 | local yaml_file="$workspace/juno.yaml" |
| 86 | local job_file="$workspace/job.yaml" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 87 | local payload_type="${payload_type:?}" |
| 88 | |
Nicola Mazzucato | a519254 | 2022-05-13 17:13:24 +0100 | [diff] [blame] | 89 | bin_mode="$mode" juno_revision="$juno_revision" \ |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 90 | "$ci_root/script/gen_juno_${payload_type}_yaml.sh" > "$yaml_file" |
| 91 | |
Harrison Mutai | 6582818 | 2023-03-27 14:18:18 +0100 | [diff] [blame] | 92 | cp "$yaml_file" "$job_file" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 93 | archive_file "$yaml_file" |
Harrison Mutai | 6582818 | 2023-03-27 14:18:18 +0100 | [diff] [blame] | 94 | archive_file "$job_file" |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | juno_aarch32_runtime() { |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 98 | echo "Building BL32 in AArch32 for Juno:" |
| 99 | sed 's/^/\t/' < "${config_file:?}" |
Manish V Badarkhe | 224bf18 | 2022-03-07 21:14:07 +0000 | [diff] [blame] | 100 | |
| 101 | # Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll |
| 102 | # lose the tools binaries. Build that again for later use. |
| 103 | if upon "$(get_tf_opt TRUSTED_BOARD_BOOT)"; then |
| 104 | tf_build_targets="fiptool certtool bl32" |
| 105 | else |
| 106 | tf_build_targets="fiptool bl32" |
| 107 | fi |
| 108 | |
| 109 | tf_build_config="$config_file" tf_build_targets="$tf_build_targets" \ |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 110 | build_tf |
| 111 | |
| 112 | # Copy BL32 to a temporary directoy, and update it in the FIP |
| 113 | local tmpdir="$(mktempdir)" |
| 114 | from="$tf_root/build/juno/$mode" to="$tmpdir" collect_build_artefacts |
| 115 | bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update |
| 116 | } |
| 117 | |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 118 | set +u |