Skip to content
Snippets Groups Projects
Commit bc8c440f authored by Lukasz Majewski's avatar Lukasz Majewski Committed by Tom Rini
Browse files

bootcount: Rewrite autoboot to use wrapper functions from bootcount.h


The code has been refactored to use common wrappers from bootcount.h
header.

Signed-off-by: default avatarLukasz Majewski <lukma@denx.de>
Reviewed-by: default avatarStefan Roese <sr@denx.de>
Reviewed-by: default avatarTom Rini <trini@konsulko.com>
Reviewed-by: default avatarAlex Kiernan <alex.kiernan@gmail.com>
parent 0da70412
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <menu.h> #include <menu.h>
#include <post.h> #include <post.h>
#include <u-boot/sha256.h> #include <u-boot/sha256.h>
#include <bootcount.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -290,18 +291,8 @@ const char *bootdelay_process(void) ...@@ -290,18 +291,8 @@ const char *bootdelay_process(void)
{ {
char *s; char *s;
int bootdelay; int bootdelay;
#ifdef CONFIG_BOOTCOUNT_LIMIT
unsigned long bootcount = 0; bootcount_inc();
unsigned long bootlimit = 0;
#endif /* CONFIG_BOOTCOUNT_LIMIT */
#ifdef CONFIG_BOOTCOUNT_LIMIT
bootcount = bootcount_load();
bootcount++;
bootcount_store(bootcount);
env_set_ulong("bootcount", bootcount);
bootlimit = env_get_ulong("bootlimit", 10, 0);
#endif /* CONFIG_BOOTCOUNT_LIMIT */
s = env_get("bootdelay"); s = env_get("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
...@@ -323,13 +314,9 @@ const char *bootdelay_process(void) ...@@ -323,13 +314,9 @@ const char *bootdelay_process(void)
s = env_get("failbootcmd"); s = env_get("failbootcmd");
} else } else
#endif /* CONFIG_POST */ #endif /* CONFIG_POST */
#ifdef CONFIG_BOOTCOUNT_LIMIT if (bootcount_error())
if (bootlimit && (bootcount > bootlimit)) {
printf("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
(unsigned)bootlimit);
s = env_get("altbootcmd"); s = env_get("altbootcmd");
} else else
#endif /* CONFIG_BOOTCOUNT_LIMIT */
s = env_get("bootcmd"); s = env_get("bootcmd");
process_fdt_options(gd->fdt_blob); process_fdt_options(gd->fdt_blob);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment