diff mbox series

[v2,6/6] qemu-arm64: Enable POSITION_INDEPENDENT

Message ID 20200930163918.24995-7-andre.przywara@arm.com
State Accepted
Delegated to: Tom Rini
Headers show
Series qemu-arm64: Allow booting via Trusted Firmware | expand

Commit Message

André Przywara Sept. 30, 2020, 4:39 p.m. UTC
Now that PIE works when U-Boot is started from ROM, let's enable
CONFIG_POSITION_INDEPENDENT, which allows to load U-Boot also via
ARM Trusted-Firmware's fip.bin to DRAM, without tweaking the
configuration.

To get a writable initial stack, we need to keep the fixed initial
stack pointer, which points to DRAM in our case.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
---
 arch/arm/Kconfig             | 1 +
 configs/qemu_arm64_defconfig | 1 +
 2 files changed, 2 insertions(+)

Comments

Tom Rini Oct. 9, 2020, 1:03 p.m. UTC | #1
On Wed, Sep 30, 2020 at 05:39:18PM +0100, Andre Przywara wrote:

> Now that PIE works when U-Boot is started from ROM, let's enable
> CONFIG_POSITION_INDEPENDENT, which allows to load U-Boot also via
> ARM Trusted-Firmware's fip.bin to DRAM, without tweaking the
> configuration.
> 
> To get a writable initial stack, we need to keep the fixed initial
> stack pointer, which points to DRAM in our case.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5ffa84c1d98..8ba73680699 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -22,6 +22,7 @@  config POSITION_INDEPENDENT
 
 config INIT_SP_RELATIVE
 	bool "Specify the early stack pointer relative to the .bss section"
+	default n if ARCH_QEMU
 	default y if POSITION_INDEPENDENT
 	help
 	  U-Boot typically uses a hard-coded value for the stack pointer
diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig
index 31ea2d342fc..4450e7ced42 100644
--- a/configs/qemu_arm64_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -1,6 +1,7 @@ 
 CONFIG_ARM=y
 CONFIG_ARCH_QEMU=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_POSITION_INDEPENDENT=y
 CONFIG_ENV_SIZE=0x40000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_AHCI=y