#include <menu.h>
#include <post.h>
#include <u-boot/sha256.h>
+#include <bootcount.h>
DECLARE_GLOBAL_DATA_PTR;
{
char *s;
int bootdelay;
-#ifdef CONFIG_BOOTCOUNT_LIMIT
- unsigned long bootcount = 0;
- 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 */
+
+ bootcount_inc();
s = env_get("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
s = env_get("failbootcmd");
} else
#endif /* CONFIG_POST */
-#ifdef CONFIG_BOOTCOUNT_LIMIT
- if (bootlimit && (bootcount > bootlimit)) {
- printf("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
- (unsigned)bootlimit);
+ if (bootcount_error())
s = env_get("altbootcmd");
- } else
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
+ else
s = env_get("bootcmd");
process_fdt_options(gd->fdt_blob);