Skip to contentSkip to conversation

common: Add CONFIG_SKIP_RELOCATE

PATCH Superseded Jesse Taube 4 participants 4 messages Apr 2, 2025 – Apr 8, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: Add CONFIG_SKIP_RELOCATE

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.

---
 Kconfig          | 7 +++++++
 common/board_f.c | 7 +++++++
 2 files changed, 14 insertions(+)
Kconfig +7 -0
index 6379a454166..f518768615f 100644
@@ -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
common/board_f.c +7 -0
index 99616fdac80..d51696b8eda 100644
@@ -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
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Jesse Taube

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.

---
 Kconfig          | 7 +++++++
 common/board_f.c | 7 +++++++
 2 files changed, 14 insertions(+)
Kconfig +0 -0
index 6379a454166..f518768615f 100644

Kconfig config TOOLS_DEBUG · line 448

Quoted 6 lines
Kconfig +3 -0
@@ -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

Note that "n" is the default so we don't need this line. Otherwise:

Signature · 1 line
Tom
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jesse Taube
Quoted 6 lines · Jesse Taube

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.

Quoted 40 lines
  Kconfig          | 7 +++++++
  common/board_f.c | 7 +++++++
  2 files changed, 14 insertions(+)
Kconfig +7 -0
index 6379a454166..f518768615f 100644
@@ -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
common/board_f.c +7 -0
index 99616fdac80..d51696b8eda 100644
@@ -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
Signature · 1 line
Caleb (they/them)
#3 lore raw
In reply to Jesse Taube
Quoted 5 lines · Jesse Taube

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.

Nit: s/ram/RAM

Quoted 12 lines
---
 Kconfig          | 7 +++++++
 common/board_f.c | 7 +++++++
 2 files changed, 14 insertions(+)
Kconfig +0 -0
index 6379a454166..f518768615f 100644

Kconfig config TOOLS_DEBUG · line 448

Quoted 6 lines
Kconfig +3 -0
@@ -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

As Tom pointed out, please drop this line.

Kconfig config TOOLS_DEBUG · line 451

Quoted 3 lines
Kconfig +3 -0
+       help
+         Skips relocation of U-Boot allowing for systems that have extremely
+         limited ram to run U-Boot.

s/ram/RAM