[U-Boot-Users] Dynamic location of the environment sector
Angelos Manousarides
amanous at inaccessnetworks.com
Wed Jun 21 19:21:45 CEST 2006
Angelos Manousarides wrote:
> Another problem I encountered has to do with the manipulation of the
> environment with the "saveenv" command. The image I produced was ok, I
> booted and the default environment was recognized. I saw that the file
> common/environment.c defines before the environment the env_size
> variable, therefore placing the environment at 0x4004 than 0x4000 that
> is my hard coded offset. This causes a problem with the saveenv command,
> since here (common/env_flash.c):
>
> #ifdef CMD_SAVEENV
> /* static env_t *flash_addr = (env_t *)(&environment[0]);-broken on
> ARM-wd-*/
> static env_t *flash_addr = (env_t *)(CFG_ENV_ADDR + sizeof(unsigned long));
> #endif
>
> the address the command uses is the initial offset (0x4000) and not the
> actual offset after the env_size variable.
>
> Is this a bug introduced by the workaround for the flash_addr? Or am I
> doing something wrong and the env_size variable should never have
> appeared in my code?
>
Ooops, sorry I forgot to mention that with the above line changed to:
static env_t *flash_addr = (env_t *)(CFG_ENV_ADDR + sizeof(unsigned long));
the saveenv command produced the desired result. I am not so sure if
this is the appropriate solution, it is a bit hard-coded, but I thought
I should mention it. It would be more desirable to infer the address of
the environment directly, but I am not sure how this can be done for the
PXA architecture (or in a unified way for all architectures for that
matter).
Regards,
Angelos Manousaridis
More information about the U-Boot
mailing list