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