[U-Boot] [Bug] ARM: early environment broken
Stefan Althoefer
stefan.althoefer at web.de
Mon Dec 8 22:52:32 CET 2008
Hi,
---+ Problem
in git u-boot(-arm) early access to environment (e.g. during
serial_init) is broken (for CONFIG_ENV_IS_IN_EEPROM).
---+ Reason
---- start_armboot()----
__asm__ __volatile__("": : :"memory");
memset ((void*)gd, 0, sizeof (gd_t));
gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
memset (gd->bd, 0, sizeof (bd_t));
gd->flags |= GD_FLG_RELOC;
monitor_flash_len = _bss_start - _armboot_start;
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
hang ();
}
}
<snip>
/* initialize environment */
env_relocate ();
----------------------
Relocation is finished and indicated in flags before init_sequence is
executed.
env_eeprom::env_init() - as called by init_sequence - however initializes
EEPROM environment assuming it is not relocated.
On the other hand env_common::env_get_char() does evaluate gd->flags to
check whether relocation has been performed.
That is, until env_relocate() is called (see code sniplett) nothing
can be read from the environment.
---+ Suggestion
I assume that there is good reason to set "gd->flags |= GD_FLG_RELOC;"
exactly where it is.
env_relocate() should be added to init_functions, just after env_init().
This should not break other architectures where things might be
different.
More information about the U-Boot
mailing list