From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Althoefer Date: Mon, 08 Dec 2008 22:52:32 +0100 Subject: [U-Boot] [Bug] ARM: early environment broken Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 (); } } /* 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.