blob: ba24e9ce4916bd05df125c5a1aa8e36137c82ebe [file] [log] [blame]
Fathi Boudra422bf772019-12-02 11:10:16 +02001#!/bin/bash
2#
3# Copyright (c) 2019, Arm Limited. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set -u
9
10scp_bl2_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/scp_bl2.bin"
Zelalem219df412020-05-17 19:21:20 -050011psci_reset2_scp_bl2_url="$tfa_downloads/psci_reset2/scp_bl2.bin"
Fathi Boudra422bf772019-12-02 11:10:16 +020012uboot_bl33_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/bl33-uboot.bin"
Zelalem219df412020-05-17 19:21:20 -050013optee_fip_url="$linaro_release/juno-ack-android-uboot/SOFTWARE/fip.bin"
14
Fathi Boudra422bf772019-12-02 11:10:16 +020015juno_recovery_root="$linaro_release/juno-latest-oe-uboot"
16
17uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin"
18juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot"
Zelalem219df412020-05-17 19:21:20 -050019juno32_recovery_root_oe="$linaro_release/juno32-latest-oe-uboot"
Fathi Boudra422bf772019-12-02 11:10:16 +020020
21juno_rootfs_url="$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz"
Zelalem219df412020-05-17 19:21:20 -050022juno32_rootfs_url="$linaro_release/linaro-image-alip-genericarmv7a-20150710-336.rootfs.tar.gz"
Fathi Boudra422bf772019-12-02 11:10:16 +020023
24# FIXME use optee pre-built binaries
25get_optee_bin() {
Zelalem219df412020-05-17 19:21:20 -050026 local tmpdir="$(mktempdir)"
27
28 pushd "$tmpdir"
29 extract_fip "$optee_fip_url"
30 mv "tos-fw.bin" "bl32.bin"
Fathi Boudra422bf772019-12-02 11:10:16 +020031 archive_file "bl32.bin"
Zelalem219df412020-05-17 19:21:20 -050032 popd
Fathi Boudra422bf772019-12-02 11:10:16 +020033}
34
35get_scp_bl2_bin() {
36 url="$scp_bl2_url" saveas="scp_bl2.bin" fetch_file
37 archive_file "scp_bl2.bin"
38}
39
Zelalem219df412020-05-17 19:21:20 -050040get_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 Boudra422bf772019-12-02 11:10:16 +020045get_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
55get_uboot_bin() {
56 url="$uboot_bl33_url" saveas="uboot.bin" fetch_file
57 archive_file "uboot.bin"
58}
59
60gen_recovery_image32() {
61 url="$juno32_recovery_root" gen_recovery_image "$@"
62}
63
Zelalem219df412020-05-17 19:21:20 -050064gen_recovery_image32_oe() {
65 url="$juno32_recovery_root_oe" gen_recovery_image "$@"
66}
67
Fathi Boudra422bf772019-12-02 11:10:16 +020068gen_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
Leonardo Sandoval7fe8e552020-07-30 17:01:29 -050084 (cd "$zip_dir" && zip -rq "$zip_file" -- *)
Fathi Boudra422bf772019-12-02 11:10:16 +020085 archive_file "$zip_file"
86}
87
88gen_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
98juno_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
112set +u