blob: d9d026bb6c3325d1d4c8f17e508d67e728c1db97 [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"
11uboot_bl33_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/bl33-uboot.bin"
12juno_recovery_root="$linaro_release/juno-latest-oe-uboot"
13
14uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin"
15juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot"
16
17juno_rootfs_url="$linaro_release/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz"
18
19# FIXME use optee pre-built binaries
20get_optee_bin() {
21 url="$jenkins_url/job/tf-optee-build/PLATFORM_FLAVOR=juno,label=arch-dev/lastSuccessfulBuild/artifact/artefacts/tee.bin" \
22 saveas="bl32.bin" fetch_file
23 archive_file "bl32.bin"
24}
25
26get_scp_bl2_bin() {
27 url="$scp_bl2_url" saveas="scp_bl2.bin" fetch_file
28 archive_file "scp_bl2.bin"
29}
30
31get_uboot32_bin() {
32 local tmpdir="$(mktempdir)"
33
34 pushd "$tmpdir"
35 extract_fip "$uboot32_fip_url"
36 mv "nt-fw.bin" "uboot.bin"
37 archive_file "uboot.bin"
38 popd
39}
40
41get_uboot_bin() {
42 url="$uboot_bl33_url" saveas="uboot.bin" fetch_file
43 archive_file "uboot.bin"
44}
45
46gen_recovery_image32() {
47 url="$juno32_recovery_root" gen_recovery_image "$@"
48}
49
50gen_recovery_image() {
51 local zip_dir="$workspace/juno_recovery"
52 local zip_file="${zip_dir}.zip"
53 local url="${url:-$juno_recovery_root}"
54
55 saveas="$zip_dir" url="$url" fetch_directory
56 if [ "$*" ]; then
57 cp -f "$@" "$zip_dir/SOFTWARE"
58 fi
59
60 # If an image.txt file was specified, replace all image.txt file inside
61 # the recovery with the specified one.
62 if upon "$image_txt"; then
63 find "$zip_dir" -name images.txt -exec cp -f "$image_txt" {} \;
64 fi
65
66 (cd "$zip_dir" && zip -rq "$zip_file" *)
67 archive_file "$zip_file"
68}
69
70gen_juno_yaml() {
71 local yaml_file="$workspace/juno.yaml"
72 local payload_type="${payload_type:?}"
73
74 bin_mode="$mode" \
75 "$ci_root/script/gen_juno_${payload_type}_yaml.sh" > "$yaml_file"
76
77 archive_file "$yaml_file"
78}
79
80juno_aarch32_runtime() {
81 # Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll
82 # lose the fiptool binary. Build that again for later use.
83 echo "Building BL32 in AArch32 for Juno:"
84 sed 's/^/\t/' < "${config_file:?}"
85 tf_build_config="$config_file" tf_build_targets="fiptool bl32" \
86 build_tf
87
88 # Copy BL32 to a temporary directoy, and update it in the FIP
89 local tmpdir="$(mktempdir)"
90 from="$tf_root/build/juno/$mode" to="$tmpdir" collect_build_artefacts
91 bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update
92}
93
94set +u