[U-Boot] U-boot Saveenv question --> final tested solution

Jerry Van Baren gvb.uboot at gmail.com
Wed Oct 8 00:24:07 CEST 2008


Suresh Bhaskaran wrote:
> 
> -----Original Message-----
> From: Jerry Van Baren [mailto:gerald.vanbaren at ge.com] 
> Sent: Monday, October 06, 2008 10:07 AM
> To: Suresh Bhaskaran
> Cc: Andrejs Cainikovs; u-boot at lists.denx.de
> Subject: Re: [U-Boot] U-boot Saveenv question
> 
> Suresh Bhaskaran wrote:
>> 1.  I verified flash contents using the md.w command in u-boot
>> 2.  I've already verified correct flash r/w operation using the cp.w
>> command
>> 3.  Yes, the CONFIG_ENV_OVERWRITE flag is defined in my boardfile
>> 4.  Flinfo shows the correct flash configuration (sectors, etc) of the
>> flash
>>
>> I can see the new env variable (e.g. set serverip 10.0.0.1) at the end
>> of the saveenv area in flash (after I do a saveenv).  (the original
>> entry is removed from the list in flash, and the new updated entry is
>> added to the end of the list in flash).
>>
>> Still, when I reboot u-boot, I don't get the new environment variable
>> updated from flash.
>>
>> What am I missing?
>>
>> Thanks.
>> Suresh
> 
> Please don't top post.
> 
> Are you using DHCP (BOOTP)?  If you are, serverip is probably being sent
> 
> by your DHCP server and overriding the value you have set in your env.
> 
> I'm assuming you are *not* getting env CRC failure warnings on boot.
> 
> If neither of the above guesses solve the problem, please copy what is 
> printed to the console on start up.  Without more information, we're 
> just guessing.
> 
> Best regards,
> gvb
> 
> -------------------------------------------------------------
> 
> Thanks for help:
> 
> I've got it working:
> 
> Final answer:

Sorry, workaround for you, this isn't the final answer.

> 1.  If *only* CONFIG_ENV_OVERWRITE is turned on in board file, then crc
> is not written to flash [don't know if it's bug, or if I am setting
> incorrect flags]

This may work for you, but there is something else wrong for you.  From 
the README file:
                 If CONFIG_ENV_OVERWRITE is #defined in your config
                 file, the write protection for vendor parameters is
                 completely disabled. Anybody can change or delete
                 these parameters.
so CONFIG_ENV_OVERWRITE controls some logic WRT what can be changed in 
the env, but it doesn't directly affect flash writing.

> 2.  But if CFG_ENV_ADDR_REDUND is also set, then it sets CRC to flash,
> and it works correctly.

s/CFG/CONFIG/  What version is your u-boot?  They have been renamed 
CONFIG_* for several months now.

Again from the README:
         - CONFIG_ENV_ADDR_REDUND
           CONFIG_ENV_SIZE_REDUND

            These settings describe a second storage area used to hold
            a redundant copy of the environment data, so that there is
            a valid backup copy in case there is a power failure during
            a "saveenv" operation.
...so this *does* directly affect flash writing.  In particular, it 
causes "extra" flash writing.

My first suspicion is that you have a buffering/caching problem so that 
a non-redundant flash write doesn't actually go to completion (doesn't 
actually make it into the flash or the writes get reordered by the 
processor's bus interface unit).  By setting the redundancy config 
option, your program does another flash write operation which forces the 
"hung" write out to flash.

I would check if your data cache is disabled or handled properly if 
enabled and I would check if you have the right "sync" magic to flush 
the flash write operations out the bus interface unit properly.

> In any case, setup 2. works for me.
> 
> Thanks for all the help.
> 
> Suresh

Best regards,
gvb


More information about the U-Boot mailing list