Javier Almansa Sobrino | 412d361 | 2020-05-22 17:53:12 +0100 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2020, Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | set -u |
| 9 | |
| 10 | #arm_fpga Kernel URLs |
| 11 | declare -A arm_fpga_kernels |
| 12 | arm_fpga_kernels=( |
| 13 | [test-kernel-aarch64]="$tfa_downloads/arm-fpga/kernel-image" |
| 14 | ) |
| 15 | |
| 16 | #arm_fpga dtbs |
| 17 | declare -A arm_fpga_dtbs |
| 18 | arm_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 |
| 24 | declare -A arm_fpga_initramfs |
| 25 | arm_fpga_initramfs=( |
| 26 | [busybox.initrd]="$tfa_downloads/arm-fpga/busybox.initrd" |
| 27 | ) |
| 28 | |
| 29 | get_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 | |
| 38 | get_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 | |
| 47 | get_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 | |
| 56 | get_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 | |
| 66 | link_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 | |
| 76 | set +u |