blob: 711d12ee283ff83afcce63023e4a70029da723c4 [file] [log] [blame]
Javier Almansa Sobrino412d3612020-05-22 17:53:12 +01001#!/bin/bash
2#
3# Copyright (c) 2020, Arm Limited. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set -u
9
10#arm_fpga Kernel URLs
11declare -A arm_fpga_kernels
12arm_fpga_kernels=(
13[test-kernel-aarch64]="$tfa_downloads/arm-fpga/kernel-image"
14)
15
16#arm_fpga dtbs
17declare -A arm_fpga_dtbs
18arm_fpga_dtbs=(
19[zeus-dtb]="$tfa_downloads/arm-fpga/zeus.dtb"
20[hera-dtb]="$tfa_downloads/arm-fpga/hera.dtb"
21)
22
23#arm_fpga initramfs
24declare -A arm_fpga_initramfs
25arm_fpga_initramfs=(
26[busybox.initrd]="$tfa_downloads/arm-fpga/busybox.initrd"
27)
28
29get_kernel() {
30 local kernel_type="${kernel_type:?}"
31 local url="${arm_fpga_kernels[$kernel_type]}"
32 local kernel_saveas="kernel.bin"
33
34 url="${url:?}" saveas="${kernel_saveas:?}" fetch_file
35 archive_file "$kernel_saveas"
36}
37
38get_dtb() {
39 local dtb_type="${dtb_type:?}"
40 local dtb_url="${arm_fpga_dtbs[$dtb_type]}"
41 local dtb_saveas="dtb.bin"
42
43 url="${dtb_url:?}" saveas="${dtb_saveas:?}" fetch_file
44 archive_file "$dtb_saveas"
45}
46
47get_initrd() {
48 local initrd_type="${initrd_type:?}"
49 local url="${arm_fpga_initramfs[$initrd_type]}"
50 local initrd_saveas="initrd.bin"
51
52 url="${url:?}" saveas="${initrd_saveas:?}" fetch_file
53 archive_file "$initrd_saveas"
54}
55
56get_linkerscript() {
57 local url="$tfa_downloads/arm-fpga/model.lds"
58 local ld_saveas="linker.ld"
59 local artefacts_dir="${fullpath:?}"
60
61 url="${url:?}" saveas="${ld_saveas:?}" fetch_file
62 sed -i "s+<artefacts>+"$artefacts_dir"+g" $ld_saveas
63 archive_file "$ld_saveas"
64}
65
66link_fpga_images(){
67 local arch="${arch:-aarch64elf}"
68 local ld_file="${ld_file:-linker.ld}"
69 local out="${out:-image.elf}"
70 local cross_compile="${nfs_volume}/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
71
72 `echo "$cross_compile"ld` -m $arch -T $ld_file -o $out
73 archive_file "$out"
74}
75
76set +u