[PATCH 2/2] arm: crt0_64: support skip u-boot relocation

Peng Fan (OSS) peng.fan at oss.nxp.com
Wed Oct 13 11:54:45 CEST 2021


From: Peng Fan <peng.fan at nxp.com>

U-Boot binary is quite large with more options enabled, it not hurt
on real silicon with high performance. But on simulation platform,
it is quite slow to relocate the U-Boot binary to new address,
so let's support skipping relocation.

Users could use 'gd->flags |= GD_FLG_SKIP_RELOC;' in board_early_init_f
or other place that early than relocate_code.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/lib/crt0_64.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 680e674fa3..d57ca84ee4 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -12,6 +12,7 @@
 #include <config.h>
 #include <asm-offsets.h>
 #include <asm/macro.h>
+#include <asm-generic/global_data.h>
 #include <linux/linkage.h>
 
 /*
@@ -95,6 +96,7 @@ ENTRY(_main)
 	bl	board_init_f
 
 #if !defined(CONFIG_SPL_BUILD)
+	ldr	x1, [x18, #GD_FLAGS]
 /*
  * Set up intermediate environment (new sp and gd) and call
  * relocate_code(addr_moni). Trick here is that we'll return
@@ -122,6 +124,10 @@ ENTRY(_main)
 	ldr	x9, [x18, #GD_RELOC_OFF]	/* x9 <- gd->reloc_off */
 	add	lr, lr, x9	/* new return address after relocation */
 	ldr	x0, [x18, #GD_RELOCADDR]	/* x0 <- gd->relocaddr */
+
+	tst	x1, #GD_FLG_SKIP_RELOC
+	bne	relocation_return
+
 	b	relocate_code
 
 relocation_return:
-- 
2.30.0



More information about the U-Boot mailing list