On 06/05/2020 12.18, Joakim Tjernlund wrote: > On Wed, 2020-05-06 at 12:00 +0200, Joakim Tjernlund wrote: >> On Wed, 2020-05-06 at 11:37 +0200, Rasmus Villemoes wrote: >>> CAUTION: This email originated from outside of the organization. Do not >>> click links or open attachments unless you recognize the sender and know >>> the content is safe. >>> >>> >>> 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 > > From my POV, this "Flash sector size" name is misleading. "Size to erase" > would be better. > It must be >= Env. size and a multiple of EB size. > auto would mean to select a size >= Env. size, round up to closest multiple > of EB size.
No, it is indeed supposed to be the flash sector size, and _not_ the size to erase; that's why the code has logic to compute how many sectors to erase (which you can also optionally specify in a fifth column, but as I said, that's done automatically if not specified), and the erase size is then, later yet, of course computed as (erase size)*#sectors. All that has nothing at all to do with my patch, that's how it all used to work. >> /dev/mtd1 0x0000 0x2000 0x00001000 >> >> Above does not work because EB < Env. size, one have to set the sector size >> to >= Env. size(0x2000) Are you sure? As I said, it works just fine on my end. The only thing my auto-patch does is to make /dev/mtd1 0x0000 0x2000 0x00001000 equivalent to /dev/mtd1 0x0000 0x2000 0 if the flash does have 4k erase size, so my patch wouldn't make the latter work if the former didn't already. [But again, the reason I can't use the former is to be compatible with the boards that have 64K erase size]. Rasmus

