[U-Boot] fw_setenv broken?

Steve Sakoman sakoman at gmail.com
Wed Nov 17 21:05:08 CET 2010


On Wed, Nov 17, 2010 at 9:39 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Stefano Babic,
>
> In message <4CE4092B.7090209 at denx.de> you wrote:
>> On 11/17/2010 05:30 PM, Steve Sakoman wrote:
>> > I'm seeing some strange behavior with the fw_setenv tools on OMAP.
>> >
>> > Here's what I see when using the tools on OMAP (overo in this case):
>> >
>> > 1. fw_printenv prints the environment with no issues [1]
>> > 2. fw_setenv allows me to change a variable with no reported errors [2]
>> > 3. fw_printenv will print the changed environment, however the variables
>> > are not sorted [3]
>>
>> I tested yesterday on a davinci board, I can confirm this behavior, I
>> have not thought was an error. I do not see any code in fw_env.c to sort
>> variables. I konow the variables are sorted in u-boot, but do we ever
>> have this feature on the userland fw_printenv ?
>
> Indeed this behaviour is normal. fw_printenv does not sort the output
> (not yet - patches welcome).
>
>> > I added debug printf's to readenv() in env_nand.c and the root cause is
>> > an error return from ret=nand_read(&nand_info[0], offset, &len,
>> > char_ptr)).  I get an error code of -74
>> >
>> > Before I spend too much time on this I wanted to check to see if others
>> > are seeing this issue, or whether it might be OMAP specific.
>>
>> At least this should not be a general failure, because it works on my
>> target. It could be also nand specific.
>
> Thanks for confirming this.
>
> Well, the next step should be a review of the code, where error -74
> gets set and what that probably means...

I've experimented on a couple of boards and it seems to always fail.

The nand_do_read_ops function in nand_base.c ends like so:

	if (mtd->ecc_stats.failed - stats.failed)
		return -EBADMSG;

	return  mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN : 0;
}

After writing the environment with fw_setenv in linux, u-boot's read
of the environment on the subsequent boot always fails with either
EBADMSG or EUCLEAN.

I'll keep digging, but perhaps the above might mean something to
someone with more knowledge of the nand driver.

Steve


More information about the U-Boot mailing list