README.bootcount 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. Boot Count Limit
  3. ================
  4. This is enabled by CONFIG_BOOTCOUNT_LIMIT.
  5. This allows to detect multiple failed attempts to boot Linux.
  6. After a power-on reset, the "bootcount" variable will be initialized to 1, and
  7. each reboot will increment the value by 1.
  8. If, after a reboot, the new value of "bootcount" exceeds the value of
  9. "bootlimit", then instead of the standard boot action (executing the contents of
  10. "bootcmd"), an alternate boot action will be performed, and the contents of
  11. "altbootcmd" will be executed.
  12. If the variable "bootlimit" is not defined in the environment, the Boot Count
  13. Limit feature is disabled. If it is enabled, but "altbootcmd" is not defined,
  14. then U-Boot will drop into interactive mode and remain there.
  15. It is the responsibility of some application code (typically a Linux
  16. application) to reset the variable "bootcount" to 0 when the system booted
  17. successfully, thus allowing for more boot cycles.
  18. CONFIG_BOOTCOUNT_EXT
  19. --------------------
  20. This adds support for maintaining boot count in a file on an EXT filesystem.
  21. The file to use is defined by:
  22. CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE
  23. CONFIG_SYS_BOOTCOUNT_EXT_DEVPART
  24. CONFIG_SYS_BOOTCOUNT_EXT_NAME
  25. The format of the file is:
  26. ==== =================
  27. type entry
  28. ==== =================
  29. u8 magic
  30. u8 version
  31. u8 bootcount
  32. u8 upgrade_available
  33. ==== =================
  34. To prevent unattended usage of "altbootcmd", the "upgrade_available" variable is
  35. used.
  36. If "upgrade_available" is 0, "bootcount" is not saved.
  37. If "upgrade_available" is 1, "bootcount" is saved.
  38. So a userspace application should take care of setting the "upgrade_available"
  39. and "bootcount" variables to 0, if the system boots successfully.
  40. This also avoids writing the "bootcount" information on all reboots.