[U-Boot] [PATCH v2 5/7] bootcount: spl: Extend SPL to support bootcount incrementation

Lukasz Majewski lukma at denx.de
Wed Mar 14 17:24:47 UTC 2018


This patch adds support for incrementation of the bootcount in SPL.
Such feature is necessary when we do want to use this feature with
'falcon' boot mode (which loads OS directly in SPL).

Signed-off-by: Lukasz Majewski <lukma at denx.de>

---

Changes in v2:
- New patch - as suggested by Stefan Roese - bootcount_inc() is called
  in common SPL code (./common/spl/spl.c), so other boards can also
  reuse it without modification

 common/spl/spl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index b1ce56d0d0..01e7989869 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -20,6 +20,9 @@
 #include <dm/root.h>
 #include <linux/compiler.h>
 #include <fdt_support.h>
+#ifdef CONFIG_SPL_BOOTCOUNT_LIMIT
+#include <bootcount.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -411,6 +414,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	spl_board_init();
 #endif
 
+#ifdef CONFIG_SPL_BOOTCOUNT_LIMIT
+	bootcount_inc();
+#endif
+
 	memset(&spl_image, '\0', sizeof(spl_image));
 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
 	spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
-- 
2.11.0



More information about the U-Boot mailing list