1 // SPDX-License-Identifier: GPL-2.0+
7 static int do_bootcount_print(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
10 printf("%lu\n", bootcount_load());
11 return CMD_RET_SUCCESS
;
14 static int do_bootcount_reset(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
18 * note that we're explicitly not resetting the environment
19 * variable, so you still have the old bootcounter available
22 return CMD_RET_SUCCESS
;
25 static cmd_tbl_t bootcount_sub
[] = {
26 U_BOOT_CMD_MKENT(print
, 1, 1, do_bootcount_print
, "", ""),
27 U_BOOT_CMD_MKENT(reset
, 1, 1, do_bootcount_reset
, "", ""),
30 static int do_bootcount(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
38 /* drop initial "bootcount" arg */
42 cp
= find_cmd_tbl(argv
[0], bootcount_sub
, ARRAY_SIZE(bootcount_sub
));
44 return cp
->cmd(cmdtp
, flag
, argc
, argv
);
49 #if CONFIG_IS_ENABLED(SYS_LONGHELP)
50 static char bootcount_help_text
[] =
51 "print - print current bootcounter\n"
52 "reset - reset the bootcounter"
56 U_BOOT_CMD(bootcount
, 2, 1, do_bootcount
,
58 #if CONFIG_IS_ENABLED(SYS_LONGHELP)