[U-Boot-Users] [patch 1/1] Set GD_FLG_RELOC for boards skipping relocation to RAM

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.
Signed-off-by: Remy Bohmer linux@bohmer.net --- lib_arm/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Index: u-boot-git-almost-1.3.4/lib_arm/board.c =================================================================== --- u-boot-git-almost-1.3.4.orig/lib_arm/board.c 2008-07-21 11:53:23.000000000 +0200 +++ u-boot-git-almost-1.3.4/lib_arm/board.c 2008-07-21 12:25:32.000000000 +0200 @@ -233,6 +233,17 @@ static int init_func_i2c (void) } #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; +} +#endif + /* * Breathe some life into the board... * @@ -262,6 +273,11 @@ int print_cpuinfo (void); /* test-only *
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 */

On 14:20 Tue 22 Jul , Remy Bohmer 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.
Signed-off-by: Remy Bohmer linux@bohmer.net
lib_arm/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Index: u-boot-git-almost-1.3.4/lib_arm/board.c
--- u-boot-git-almost-1.3.4.orig/lib_arm/board.c 2008-07-21 11:53:23.000000000 +0200 +++ u-boot-git-almost-1.3.4/lib_arm/board.c 2008-07-21 12:25:32.000000000 +0200 @@ -233,6 +233,17 @@ static int init_func_i2c (void) } #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
+} +#endif
/*
- Breathe some life into the board...
@@ -262,6 +273,11 @@ int print_cpuinfo (void); /* test-only *
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.

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.
V2: Forgot to add 'return 0;' to reloc_init() routine.
Signed-off-by: Remy Bohmer linux@bohmer.net --- lib_arm/board.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Index: u-boot-git-almost-1.3.4/lib_arm/board.c =================================================================== --- u-boot-git-almost-1.3.4.orig/lib_arm/board.c 2008-07-22 16:18:22.000000000 +0200 +++ u-boot-git-almost-1.3.4/lib_arm/board.c 2008-07-22 16:19:15.000000000 +0200 @@ -233,6 +233,18 @@ static int init_func_i2c (void) } #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; + return 0; +} +#endif + /* * Breathe some life into the board... * @@ -262,6 +274,11 @@ int print_cpuinfo (void); /* test-only *
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 */

In message 20080722142321.319882523@bohmer.net> 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.
V2: Forgot to add 'return 0;' to reloc_init() routine.
Signed-off-by: Remy Bohmer linux@bohmer.net
lib_arm/board.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Applied, thanks.
Best regards,
Wolfgang Denk

Hi
On Wed, Jul 30, 2008 at 12:13 AM, Wolfgang Denk wd@denx.de wrote:
In message 20080722142321.319882523@bohmer.net> 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.
V2: Forgot to add 'return 0;' to reloc_init() routine.
Signed-off-by: Remy Bohmer linux@bohmer.net
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
participants (4)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Magnus Lilja
-
Remy Bohmer
-
Wolfgang Denk