Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 3 | # Copyright (c) 2021-2023 Arm Limited. All rights reserved. |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | source "$ci_root/fvp_utils.sh" |
| 9 | |
sahil | 4621848 | 2022-07-26 12:53:17 +0530 | [diff] [blame] | 10 | n1sdp_release="N1SDP-2022.06.22" |
| 11 | n1sdp_prebuilts=${n1sdp_prebuilts:="$tfa_downloads/css/n1sdp/$n1sdp_release"} |
| 12 | scp_mcp_prebuilts=${scp_mcp_prebuilts:="$n1sdp_prebuilts"} |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 13 | |
| 14 | get_n1sdp_firmware() { |
| 15 | url=$n1sdp_firmware_bin_url saveas="n1sdp-board-firmware.zip" fetch_file |
| 16 | archive_file "n1sdp-board-firmware.zip" |
| 17 | } |
| 18 | |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 19 | fetch_prebuilt_fw_images() { |
| 20 | url="$n1sdp_prebuilts/n1sdp-board-firmware.zip" filename="n1sdp-board-firmware.zip" \ |
| 21 | fetch_and_archive |
| 22 | |
| 23 | #Fetch pre-built SCP/MCP binaries if they haven't been built |
| 24 | if [ ! -f "$archive/mcp_rom.bin" ]; then |
| 25 | url="$scp_mcp_prebuilts/mcp_romfw.bin" filename="mcp_rom.bin" \ |
| 26 | fetch_and_archive |
| 27 | fi |
| 28 | if [ ! -f "$archive/scp_rom.bin" ]; then |
| 29 | url="$scp_mcp_prebuilts/scp_romfw.bin" filename="scp_rom.bin" \ |
| 30 | fetch_and_archive |
| 31 | fi |
| 32 | if [ ! -f "$archive/scp_ram.bin" ]; then |
| 33 | url="$scp_mcp_prebuilts/scp_ramfw.bin" filename="scp_ram.bin" \ |
| 34 | fetch_and_archive |
| 35 | fi |
| 36 | if [ ! -f "$archive/mcp_ram.bin" ]; then |
| 37 | url="$scp_mcp_prebuilts/mcp_ramfw.bin" filename="mcp_ram.bin" \ |
| 38 | fetch_and_archive |
| 39 | fi |
| 40 | } |
| 41 | |
| 42 | gen_recovery_image() { |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 43 | local zip_dir="$workspace/$mode/n1sdp-board-firmware_primary" |
| 44 | local zip_file="${zip_dir}.zip" |
| 45 | |
| 46 | mkdir -p "$zip_dir" |
| 47 | |
| 48 | extract_tarball "$archive/n1sdp-board-firmware.zip" "$zip_dir" |
| 49 | |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 50 | scp_uuid="cfacc2c4-15e8-4668-82be-430a38fad705" |
| 51 | mcp_uuid="54464222-a4cf-4bf8-b1b6-cee7dade539e" |
| 52 | |
| 53 | # Create FIP for SCP |
| 54 | "$fiptool" create --blob \ |
| 55 | uuid=$scp_uuid,file=$tf_build_root/n1sdp/$bin_mode/bl1.bin \ |
| 56 | --scp-fw "$archive/scp_ram.bin" "scp_fw.bin" |
| 57 | |
| 58 | archive_file "scp_fw.bin" |
| 59 | |
| 60 | # Create FIP for MCP, this needs fixed uuid for now |
| 61 | "$fiptool" create --blob \ |
| 62 | uuid=$mcp_uuid,file="$archive/mcp_ram.bin" "mcp_fw.bin" |
| 63 | |
| 64 | archive_file "mcp_fw.bin" |
| 65 | |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 66 | cp -Rp --no-preserve=ownership "$archive/mcp_fw.bin" "$zip_dir/SOFTWARE" |
| 67 | cp -Rp --no-preserve=ownership "$archive/mcp_rom.bin" "$zip_dir/SOFTWARE" |
| 68 | cp -Rp --no-preserve=ownership "$archive/scp_fw.bin" "$zip_dir/SOFTWARE" |
| 69 | cp -Rp --no-preserve=ownership "$archive/scp_rom.bin" "$zip_dir/SOFTWARE" |
sahil | 4621848 | 2022-07-26 12:53:17 +0530 | [diff] [blame] | 70 | cp -Rp --no-preserve=ownership "$archive/fip.bin" "$zip_dir/SOFTWARE" |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 71 | |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 72 | (cd "$zip_dir" && zip -rq "$zip_file" -x \.* -- *) |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 73 | |
| 74 | archive_file "$zip_file" |
| 75 | } |
| 76 | |
| 77 | gen_n1sdp_yaml() { |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 78 | yaml_template_file="$workspace/n1sdp_template.yaml" |
| 79 | yaml_file="$workspace/n1sdp.yaml" |
| 80 | yaml_job_file="$workspace/job.yaml" |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 81 | |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 82 | # this function expects a template, quit if it is not present |
| 83 | if [ ! -f "$yaml_template_file" ]; then |
| 84 | return |
| 85 | fi |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 86 | |
Harrison Mutai | b472ff7 | 2023-04-20 09:46:09 +0100 | [diff] [blame] | 87 | yaml_template_file="$yaml_template_file" \ |
| 88 | yaml_file="$yaml_file" \ |
| 89 | yaml_job_file="$yaml_job_file" \ |
| 90 | recovery_img_url="$(gen_bin_url n1sdp-board-firmware_primary.zip)" \ |
| 91 | gen_lava_job_def |
Khasim Syed Mohammed | 430d594 | 2021-08-09 21:26:15 +0530 | [diff] [blame] | 92 | } |