[U-Boot-Users] Question about CFG_ENV_ADDR during RAMBOOT

Jerry Van Baren gerald.vanbaren at smiths-aerospace.com
Tue May 22 22:53:57 CEST 2007


Timur Tabi wrote:
> Doesn't anyone have an answer to this question?
> 
> Timur Tabi wrote:
>> On a lot of boards, if CFG_RAMBOOT is defined, the following code is compiled:
>>
>>    #define CFG_ENV_ADDR		(CFG_MONITOR_BASE - 0x1000)
>>    #define CFG_ENV_SIZE		0x2000
>>
>> This means that the environment is stored 0x1000 bytes before the start of u-boot.bin. 
>> Doesn't that mean that if the environment is larger than 0x1000 bytes, that it will 
>> overwrite the beginning of u-boot.bin whenever someone does a saveenv?

Looks like it to me. Looks like somebody increased the size without 
fixing the address offset to match.

Looks to me like it would be better defined:
#define CFG_ENV_SIZE		0x2000
#define CFG_ENV_ADDR		(CFG_MONITOR_BASE - CFG_ENV_SIZE)

The saving grace here is probably:
* For a RAMBOOT image, there isn't any incentive to save lots of stuff 
in the env since it (generally) disappears on a reboot and definitely 
disappears on a power cycle.

* On the PowerPC, at least, the first 12K of u-boot.bin is the HRCW and 
vectors which aren't used by a RAMBOOT image so overwriting them is a 
non-fatal error.

* 4K is fairly large for an env, so people probably don't run into the 
problem.

Best regards,
gvb




More information about the U-Boot mailing list