Skip to contentSkip to conversation

Set GD_FLG_RELOC for boards skipping relocation to RAM

PATCH New Remy Bohmer 4 participants 6 messages Jul 22, 2008 – Aug 4, 2008

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 Set GD_FLG_RELOC for boards skipping relocation to RAM

Quoted 19 lines · Remy Bohmer

If CONFIG_SKIP_RELOCATE_UBOOT is set the flag GD_FLG_RELOC is usually never set, because relocation to RAM is actually never done by U-boot itself. However, several pieces of code check if this flag is set at some time.

So, to make sure this flag is set on boards skipping relocation, this is added to the initialisation of U-boot at a moment where it is safe to do so.

---
 lib_arm/board.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Index: u-boot-git-almost-1.3.4/lib_arm/board.c
===================================================================

lib_arm/board.c +0 -0
@@ -233,6 +233,17 @@ static int init_func_i2c (void)
 }

lib_arm/board.c static int init_func_i2c (void) · line 243

Quoted 10 lines
lib_arm/board.c +8 -0
 #endif
 
+#ifdef CONFIG_SKIP_RELOCATE_UBOOT
+/*
+ * This routine sets the relocation done flag, because even if
+ * relocation is skipped, the flag is used by other generic code.
+ */
+static int reloc_init(void)
+{
+	gd->flags |= GD_FLG_RELOC;

you need to return 0 at least

Quoted 8 lines
lib_arm/board.c +3 -0
+}
+#endif
+
 /*
  * Breathe some life into the board...
  *
@@ -262,6 +273,11 @@ int print_cpuinfo (void); /* test-only *
 

lib_arm/board.c int print_cpuinfo (void); /* test-only * · line 283

Quoted 10 lines
lib_arm/board.c +5 -0
 init_fnc_t *init_sequence[] = {
 	cpu_init,		/* basic cpu dependent setup */
+#if defined(CONFIG_SKIP_RELOCATE_UBOOT)
+	reloc_init,		/* Set the relocation done flag, must
+				   do this AFTER cpu_init(), but as soon
+				   as possible */
+#endif
 	board_init,		/* basic board dependent setup */
 	interrupt_init,		/* set up exceptions */
 	env_init,		/* initialize environment */

Best Regards,
J.

#2 lore raw

PATCH 1/1 Set GD_FLG_RELOC for boards skipping relocation to RAM

Hello Jean-Christophe,

Quoted 4 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+static int reloc_init(void)
+{
+     gd->flags |= GD_FLG_RELOC;

you need to return 0 at least

Oops, You are right... (I forgot it somehow)
Thanks!

Remy

#4 lore raw

PATCH 1/1 (V2) Set GD_FLG_RELOC for boards skipping relocation to RAM

Quoted 8 lines · In message <[email protected]>> you wrote:

If CONFIG_SKIP_RELOCATE_UBOOT is set the flag GD_FLG_RELOC is usually never set, because relocation to RAM is actually never done by U-boot itself. However, several pieces of code check if this flag is set at some time.

So, to make sure this flag is set on boards skipping relocation, this is added to the initialisation of U-boot at a moment where it is safe to do so.

Quoted 6 lines

V2: Forgot to add 'return 0;' to reloc_init() routine.

---
 lib_arm/board.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The perversity of nature is nowhere better demonstrated by  the  fact
that,  when  exposed to the same atmosphere, bread becomes hard while
crackers become soft.
#5 lore raw

PATCH 1/1 (V2) Set GD_FLG_RELOC for boards skipping relocation to RAM

Hi

Quoted 9 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]>> you wrote:

If CONFIG_SKIP_RELOCATE_UBOOT is set the flag GD_FLG_RELOC is usually never set, because relocation to RAM is actually never done by U-boot itself. However, several pieces of code check if this flag is set at some time.

So, to make sure this flag is set on boards skipping relocation, this is added to the initialisation of U-boot at a moment where it is safe to do so.

Quoted 8 lines
Quoted 6 lines

V2: Forgot to add 'return 0;' to reloc_init() routine.

---
 lib_arm/board.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Applied, thanks.

To me it seems like GD_FLG_RELOC is not set unless CONFIG_SKIP_RELOCATE_UBOOT is set. Other boards (mips, ppc etc) set GD_FLG_RELOC in their board_init_r function but as far as I can see this does not happen for ARM boards. Shouldn't it be set in lib_arm/board.c:start_armboot right after the gd pointer has been initialized?

I just took the latest git tree and built an i.MX31 Litekit binary (with defining CONFIG_SKIP_RELOCATE_UBOOT) and GD_FLG_RELOC is not set after boot.

Thanks, Magnus