[PATCH] common: Add CONFIG_SKIP_RELOCATE

Jesse Taube mr.bossman075 at gmail.com
Wed Apr 2 02:37:38 CEST 2025


Add a check for CONFIG_SKIP_RELOCATE in reserve_uboot to skip the
relocation of the U-Boot image.
CONFIG_SKIP_RELOCATE skips relocation of U-Boot to the end of RAM
allowing for systems that have extremely limited ram to run U-Boot.

Signed-off-by: Jesse Taube <Mr.Bossman075 at gmail.com>
---
 Kconfig          | 7 +++++++
 common/board_f.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/Kconfig b/Kconfig
index 6379a454166..f518768615f 100644
--- a/Kconfig
+++ b/Kconfig
@@ -443,6 +443,13 @@ config TOOLS_DEBUG
 	  it is possible to set breakpoints on particular lines, single-step
 	  debug through the source code, etc.
 
+config SKIP_RELOCATE
+	bool "Skips relocation of U-Boot to end of RAM"
+	default n
+	help
+	  Skips relocation of U-Boot allowing for systems that have extremely
+	  limited ram to run U-Boot.
+
 endif # EXPERT
 
 config PHYS_64BIT
diff --git a/common/board_f.c b/common/board_f.c
index 99616fdac80..d51696b8eda 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -476,6 +476,13 @@ static int reserve_trace(void)
 
 static int reserve_uboot(void)
 {
+	/*
+	 * This should be the first place GD_FLG_SKIP_RELOC is read from.
+	 * Set GD_FLG_SKIP_RELOC flag if CONFIG_SKIP_RELOCATE is enabled.
+	 */
+	if (CONFIG_IS_ENABLED(SKIP_RELOCATE))
+		gd->flags |= GD_FLG_SKIP_RELOC;
+
 	if (!(gd->flags & GD_FLG_SKIP_RELOC)) {
 		/*
 		 * reserve memory for U-Boot code, data & bss
-- 
2.49.0



More information about the U-Boot mailing list