arm_fpga: Add post-build linker script
For the Arm Ltd. FPGAs to run, we need to load several payloads into the
FPGA's memory:
- Some trampoline code at address 0x0, to jump to BL31's entry point.
- The actual BL31 binary at the beginning of DRAM.
- The (generic) DTB image to describe the hardware.
- The actual non-secure payloads (kernel, ramdisks, ...)
The latter is application specific, but the first three blobs are rather
generic.
Since the uploader tool supports ELF binaries, it seems helpful to
combine these three images into one .axf file, as this also simplifies
the command line.
Add a post-build linker script, that combines those three bits into one
ELF file, together with their specific load addresses.
Include a call to "ld" with this linker script in the platform Makefile,
so it will be build automatically. The result will be called "bl31.axf".
Change-Id: I4a90da16fa1e0e83b51d19e5b1daf61f5a0bbfca
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-09-16 17:13:33 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, ARM Limited. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*
|
|
|
|
* Linker script for the Arm Ltd. FPGA boards to generate an ELF file that
|
|
|
|
* contains the ROM trampoline, BL31 and the DTB.
|
|
|
|
*
|
|
|
|
* This allows to pass just one file to the uploader tool, and automatically
|
|
|
|
* provides the correct load addresses.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <platform_def.h>
|
|
|
|
|
|
|
|
OUTPUT_FORMAT("elf64-littleaarch64")
|
|
|
|
OUTPUT_ARCH(aarch64)
|
|
|
|
|
|
|
|
INPUT(./bl31/bl31.elf)
|
|
|
|
INPUT(./rom_trampoline.o)
|
feat(arm_fpga): add kernel trampoline
The arm64 Linux kernel needed to be loaded at a certain offset within any
2MB aligned region; this value was configured at compile time and stored
in the Linux kernel image header. The default value was always 512KiB,
so this is the value we use in the TF-A build system for the kernel
load address.
However the whole scheme around the TEXT_OFFSET changed in Linux v5.8:
Linux kernels became fully relocatable, so this value is largely ignored
now, and its default value changed to 0. The only remainder is a warning
message at boot time in case there is a mismatch:
[Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!
To avoid this warning, and to make TF-A Linux kernel boot protocol
compliant, we should load newer kernels to offset 0 of a 2 MB
region. This can be done by the user at FPGA boot time, but BL31 needs
to know about this address. As we can't change the build default to 0
without breaking older kernels, we should try to make a build dealing
with both versions:
This patch introduces a small trampoline code, which gets loaded at
512KB of DRAM, and branches up to 2MB. If users load their newer
kernels at 2MB, this trampoline will cover them. In case an older kernel
is loaded at 512KB, it will overwrite this trampoline code, so it would
still work.
Change-Id: If49ca86f5dca380036caf2555349748722901277
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-05-14 16:13:28 +01:00
|
|
|
INPUT(./kernel_trampoline.o)
|
arm_fpga: Add post-build linker script
For the Arm Ltd. FPGAs to run, we need to load several payloads into the
FPGA's memory:
- Some trampoline code at address 0x0, to jump to BL31's entry point.
- The actual BL31 binary at the beginning of DRAM.
- The (generic) DTB image to describe the hardware.
- The actual non-secure payloads (kernel, ramdisks, ...)
The latter is application specific, but the first three blobs are rather
generic.
Since the uploader tool supports ELF binaries, it seems helpful to
combine these three images into one .axf file, as this also simplifies
the command line.
Add a post-build linker script, that combines those three bits into one
ELF file, together with their specific load addresses.
Include a call to "ld" with this linker script in the platform Makefile,
so it will be build automatically. The result will be called "bl31.axf".
Change-Id: I4a90da16fa1e0e83b51d19e5b1daf61f5a0bbfca
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-09-16 17:13:33 +01:00
|
|
|
|
|
|
|
TARGET(binary)
|
|
|
|
INPUT(./fdts/arm_fpga.dtb)
|
|
|
|
|
|
|
|
ENTRY(_start)
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
.rom (0x0): {
|
|
|
|
*rom_trampoline.o(.text*)
|
|
|
|
KEEP(*(.rom))
|
|
|
|
}
|
|
|
|
|
|
|
|
.bl31 (BL31_BASE): {
|
|
|
|
ASSERT(. == ALIGN(PAGE_SIZE), "BL31_BASE is not page aligned");
|
|
|
|
*bl31.elf(.text* .data* .rodata* ro* .bss*)
|
|
|
|
}
|
|
|
|
|
|
|
|
.dtb (FPGA_PRELOADED_DTB_BASE): {
|
|
|
|
ASSERT(. == ALIGN(8), "DTB address is not 8-byte aligned");
|
|
|
|
*arm_fpga.dtb
|
|
|
|
}
|
|
|
|
|
feat(arm_fpga): add kernel trampoline
The arm64 Linux kernel needed to be loaded at a certain offset within any
2MB aligned region; this value was configured at compile time and stored
in the Linux kernel image header. The default value was always 512KiB,
so this is the value we use in the TF-A build system for the kernel
load address.
However the whole scheme around the TEXT_OFFSET changed in Linux v5.8:
Linux kernels became fully relocatable, so this value is largely ignored
now, and its default value changed to 0. The only remainder is a warning
message at boot time in case there is a mismatch:
[Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!
To avoid this warning, and to make TF-A Linux kernel boot protocol
compliant, we should load newer kernels to offset 0 of a 2 MB
region. This can be done by the user at FPGA boot time, but BL31 needs
to know about this address. As we can't change the build default to 0
without breaking older kernels, we should try to make a build dealing
with both versions:
This patch introduces a small trampoline code, which gets loaded at
512KB of DRAM, and branches up to 2MB. If users load their newer
kernels at 2MB, this trampoline will cover them. In case an older kernel
is loaded at 512KB, it will overwrite this trampoline code, so it would
still work.
Change-Id: If49ca86f5dca380036caf2555349748722901277
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-05-14 16:13:28 +01:00
|
|
|
.kern_tramp (PRELOADED_BL33_BASE): {
|
|
|
|
*kernel_trampoline.o(.text*)
|
|
|
|
KEEP(*(.kern_tramp))
|
|
|
|
}
|
|
|
|
|
2021-08-20 16:23:23 +01:00
|
|
|
/DISCARD/ : { *(stacks) }
|
arm_fpga: Add post-build linker script
For the Arm Ltd. FPGAs to run, we need to load several payloads into the
FPGA's memory:
- Some trampoline code at address 0x0, to jump to BL31's entry point.
- The actual BL31 binary at the beginning of DRAM.
- The (generic) DTB image to describe the hardware.
- The actual non-secure payloads (kernel, ramdisks, ...)
The latter is application specific, but the first three blobs are rather
generic.
Since the uploader tool supports ELF binaries, it seems helpful to
combine these three images into one .axf file, as this also simplifies
the command line.
Add a post-build linker script, that combines those three bits into one
ELF file, together with their specific load addresses.
Include a call to "ld" with this linker script in the platform Makefile,
so it will be build automatically. The result will be called "bl31.axf".
Change-Id: I4a90da16fa1e0e83b51d19e5b1daf61f5a0bbfca
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-09-16 17:13:33 +01:00
|
|
|
/DISCARD/ : { *(.debug_*) }
|
|
|
|
/DISCARD/ : { *(.note*) }
|
|
|
|
/DISCARD/ : { *(.comment*) }
|
|
|
|
}
|