On 06/05/2020 12.00, Joakim Tjernlund wrote:
> On Wed, 2020-05-06 at 11:37 +0200, Rasmus Villemoes wrote:
>>
>> On 06/05/2020 11.21, Joakim Tjernlund wrote:
>>
>>> I can test NOR Flash ,I am on an older u-boot ATM but fw_setenv stuff 
>>> should be simple to backport
>>> How would fw_env.config be dealt with? Just ignored when auto size?
>>
>> AFAIK, the U-Boot configuration doesn't affect the userspace fw_env
>> tools, so auto size has to be opt-in separately in fw_env.config, which
>> is where I did use 0 to mean auto (see the referenced commit
>> e282c422e0). You should be able to test that part already with just
>> fw_setenv built from master and an appropriate fw_env.config [or perhaps
>> you need to add another "mtdinfo.type == ..." condition first].
> 
> Oh, I misunderstood then. I was mostly interested in fw_setenv ATM
> Looking at your fw_setenv commit I have one question:
> Will this auto mode also work when erase size < env size ?
> We have the case:
> 
> # MTD device name     Device offset   Env. size       Flash sector size
>  /dev/mtd1            0x0000          0x2000          0x00001000
> 
> Above does not work because EB < Env. size, one have to set the sector size
> to >= Env. size(0x2000)

Yes, it should work just fine. My own board has env size 0x2000, so it
spans two 4K sectors (on the boards with the newer flash). As long as
one leaves the fifth column (number of sectors) empty or 0, the logic a
bit further down will automatically compute how many sectors the
environment occupies.

Are you saying that the above config is not accepted by fw_setenv or
that it causes a run-time error when actually trying to save the env? If
so, I'd like to see a strace output.

Rasmus

Reply via email to