
Dear Robert,
In message alpine.LFD.2.20.1607260734020.10018@localhost.localdomain you wrote:
ok, i am now *totally* confused, so let's start at the beginning. it's my understanding that selecting CONFIG_BOOTCOUNT_LIMIT means you
right.
want to use the boot counter, it does *not* select what method you want to use to store the boot counter, correct? but here's the confusing part.
Which exact part is confusing?
#ifdef CONFIG_BOOTCOUNT_LIMIT bootcount = bootcount_load(); bootcount++; bootcount_store(bootcount); setenv_ulong("bootcount", bootcount); <----- ????? bootlimit = getenv_ulong("bootlimit", 10, 0); #endif /* CONFIG_BOOTCOUNT_LIMIT */
This is only the equivalent of a "setenv", so you have a variable in the environment which you can use in scripts or compare against "bootlimit".
There is NO automatic "saveenv" here...
and that's what confuses the heck out of me. i thought that, depending on the technique i wanted to use to store the boot counter (RAM, I2C,
The key word here is "store", i. e. store in such a way that the value survives a warm boot / reset. The copy in RAM which is created above does NOT survive.
whatever), it would use *exclusively* that technique, and while i can see the use of the routines bootcount_load() and bootcount_store(), which are redefined based on the technique you select:
These methods access the persistent copy of the variable. The setenv_ulong() just creates a transient work copy.
it appears that, no matter what, the environment *is* updated every single time because of this line in the bootdelay_process() routine:
setenv_ulong("bootcount", bootcount);
Yes, it is. But it is NOT saved to persistent storage.
Best regards,
Wolfgang Denk