[U-Boot] boot count feature with eMMC booting

I want to implement fail-safe booting feature in my project. Basically my logic is, i will increase any u-boot environment variable each time and up on successful bring up, i want to decrease the value of that again. If the value of u-boot environment variable is more than 5, it will boot from the other image. As i am using the eMMC for booting, i am not getting how i will access the u-boot environment variable from the linux application. I also dont know whether i can save the environment variable in the eMMC or not? What mechanism i should use to achieve this feature. I have read about the fw_printenv and fw_savenv, but from where this utility will access the variable.
Thanks, Jags Gediya

On Fri, Sep 12, 2014 at 02:52:05PM +0530, jags gediya wrote:
I want to implement fail-safe booting feature in my project. Basically my logic is, i will increase any u-boot environment variable each time and up on successful bring up, i want to decrease the value of that again. If the value of u-boot environment variable is more than 5, it will boot from the other image. As i am using the eMMC for booting, i am not getting how i will access the u-boot environment variable from the linux application. I also dont know whether i can save the environment variable in the eMMC or not? What mechanism i should use to achieve this feature. I have read about the fw_printenv and fw_savenv, but from where this utility will access the variable.
Yes, this is possible using some combination of the existing bootcount driver, CONFIG_BOOTCOUNT_LIMIT and altbootcmd. You'll also want a driver in Linux to clear the count so you know when you have successfully booted up.
participants (2)
-
jags gediya
-
Tom Rini