From: Lukasz Majewski Date: Mon, 26 Feb 2018 13:22:45 +0100 Subject: [U-Boot] [PATCH v1 4/5] bootcount: display5: spl: Extend SPL to support bootcount checking In-Reply-To: <20180226122246.10595-1-lukma@denx.de> References: <20180226122246.10595-1-lukma@denx.de> Message-ID: <20180226122246.10595-5-lukma@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This patch is necessary for providing basic bootcount checking in the case of using "falcon" boot mode. It forces u-boot proper boot, when we exceed the number of errors. Signed-off-by: Lukasz Majewski --- board/liebherr/display5/spl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 0a36e656c0..5812f71dfc 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "common.h" DECLARE_GLOBAL_DATA_PTR; @@ -194,6 +195,9 @@ void board_init_f(ulong dummy) /* Clear the BSS. */ memset(__bss_start, 0, __bss_end - __bss_start); + /* Increment bootcount */ + bootcount_inc(); + /* load/boot image from boot device */ board_init_r(NULL, 0); } @@ -214,7 +218,7 @@ void board_boot_order(u32 *spl_boot_list) env_load(); s = env_get("BOOT_FROM"); - if (s && strcmp(s, "ACTIVE") == 0) { + if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) { spl_boot_list[0] = BOOT_DEVICE_MMC1; spl_boot_list[1] = spl_boot_device(); } -- 2.11.0