README.bootcount 1.6 KB

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