-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjuno_utils.sh
More file actions
142 lines (114 loc) · 4.68 KB
/
juno_utils.sh
File metadata and controls
142 lines (114 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env bash
#
# Copyright (c) 2019-2023 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
set -u
# Pre-built SCP/MCP binaries
scp_bl1_url="$scp_mcp_downloads/juno/platform_variant_BOARD/release/juno-bl1-bypass.bin"
scp_bl2_url="$scp_mcp_downloads/juno/platform_variant_BOARD/release/juno-bl2.bin"
psci_reset2_scp_bl2_url="$scp_mcp_downloads/juno/psci_reset2/juno-bl2.bin"
uboot_bl33_url="$linaro_release/juno-latest-oe-uboot/SOFTWARE/bl33-uboot.bin"
ml_uboot_bl33_url="$DOWNLOAD_SERVER_TF_A_URL/linux_boot/u-boot-juno.bin"
uboot_env_url="$DOWNLOAD_SERVER_TF_A_URL/linux_boot/u-boot-env.bin"
optee_fip_url="$linaro_release/juno-ack-android-uboot/SOFTWARE/fip.bin"
linux_image_url="$DOWNLOAD_SERVER_TF_A_URL/linux_boot/Image.gz"
# Busybox based initrd
linux_busybox_initrd_url="$DOWNLOAD_SERVER_TF_A_URL/linux_boot/initbb.img"
juno_recovery_root="$linaro_release/juno-latest-oe-uboot"
uboot32_fip_url="$linaro_release/juno32-latest-oe-uboot/SOFTWARE/fip.bin"
juno32_recovery_root="$linaro_release/juno32-latest-busybox-uboot"
juno32_recovery_root_oe="$linaro_release/juno32-latest-oe-uboot"
juno_rootfs_url="https://downloads.trustedfirmware.org/infra-assets/linaro_artifacts/releases/openembedded/aarch64/17.01/linaro-image-minimal-genericarmv8-20170127-888.rootfs.tar.gz"
juno32_rootfs_url="https://downloads.trustedfirmware.org/infra-assets/linaro_artifacts/releases/openembedded/aarch32/17.01/linaro-image-minimal-genericarmv7a-20170127-460.rootfs.tar.gz"
get_juno_recovery_image_url() {
local mode="${1:?}"
if upon "${jenkins_run}"; then
echo "${jenkins_url}/job/${JOB_NAME}/${BUILD_NUMBER}/artifact/artefacts/${mode}/juno_recovery.zip"
else
echo "file://${workspace}/artefacts/${mode}/juno_recovery.zip"
fi
}
get_ml_uboot_bin() {
url="$ml_uboot_bl33_url" saveas="uboot.bin" fetch_file
archive_file "uboot.bin"
url="$uboot_env_url" saveas="blank.img" fetch_file
archive_file "blank.img"
}
get_linux_image() {
url="$linux_image_url" saveas="Image" fetch_file
archive_file "Image"
url="$linux_busybox_initrd_url" saveas="ramdisk.img" fetch_file
archive_file "ramdisk.img"
}
gen_recovery_image32() {
url="$juno32_recovery_root" gen_recovery_image "$@"
}
gen_recovery_image32_oe() {
url="$juno32_recovery_root_oe" gen_recovery_image "$@"
}
gen_recovery_image() {
local zip_dir="$workspace/juno_recovery"
local zip_file="${zip_dir}.zip"
local url="${url:-$juno_recovery_root}"
saveas="$zip_dir" url="$url" fetch_directory
if [ "$*" ]; then
# Replace files needed for this test. Copying them first so
# that the subsequent copy can replace it if necessary.
url="$scp_bl1_url" saveas="$zip_dir/SOFTWARE/scp_bl1.bin" fetch_file
cp -f "$@" "$zip_dir/SOFTWARE"
fi
# The Linaro recovery image has a bug in the images.txt files, which
# puts the U-Boot environment in the wrong place (the address is
# relative to the beginning of NOR flash, it's not an absolute MMIO
# address). Fix that up so that we can update the environment.
sed -ie "s/0x0BFC0000/0x03FC0000/" "$zip_dir"/SITE1/HBI0262?/images.txt
# If an image.txt file was specified, replace all image.txt file inside
# the recovery with the specified one.
if upon "$image_txt"; then
find "$zip_dir" -name images.txt -exec cp -f "$image_txt" {} \;
fi
(cd "$zip_dir" && zip -rq "$zip_file" -- *)
archive_file "$zip_file"
}
gen_juno_yaml() {
local yaml_file="$workspace/juno.yaml"
local job_file="$workspace/job.yaml"
local payload_type="${payload_type:?}"
{
local template_file="${ci_root}/script/lava-templates/juno-${payload_type//_/-}.yaml"
local recovery_img_url="${recovery_img_url:-$(get_juno_recovery_image_url "${mode:?}")}"
local -i reboot_count
if [[ "${payload_type}" == "tftf_power_cycle" ]]; then
case "$(get_tftf_opt TESTS)" in
manual-shutdown) reboot_count=2 ;;
esac
fi
expand_template "${template_file}"
} > "${yaml_file}"
cp "$yaml_file" "$job_file"
archive_file "$yaml_file"
archive_file "$job_file"
}
juno_aarch32_runtime() {
echo "Building BL32 in AArch32 for Juno:"
sed 's/^/\t/' < "${config_file:?}"
# Build BL32 for Juno in AArch32. Since build_tf does a realclean, we'll
# lose the tools binaries. Build that again for later use.
if upon "$(get_tf_opt TRUSTED_BOARD_BOOT)"; then
tf_build_targets="fiptool certtool bl32"
else
tf_build_targets="fiptool bl32"
fi
# rebuilding with a different commandline doesn't always produce sane
# results. So start fresh.
clean_tf
tf_build_config="$config_file" tf_build_targets="$tf_build_targets" \
build_tf
# Copy BL32 to a temporary directoy, and update it in the FIP
local tmpdir="$(mktempdir)"
from="$tf_build_root/juno/$mode" to="$tmpdir" collect_build_artefacts
bin_name="tos-fw" src="$tmpdir/bl32.bin" fip_update
}
set +u