[U-Boot] [PATCH v2 1/8] arm/km: introduce and manage bootcount environment variable
Valentin Longchamp
valentin.longchamp at keymile.com
Tue May 3 16:13:09 CEST 2011
This environment variable is used to set the bootcount address
for the kernel.
Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
Acked-by: Heiko Schocher <hs at denx.de>
cc: Prafulla Wadaskar <prafulla at marvell.com>
cc: Wolfgang Denk <wd at denx.de>
cc: Detlev Zundel <dzu at denx.de>
---
Changes for v2:
- split up first large patch series to three independent smaller
patch series
- taken Wolfgang Denk's comments into account
board/keymile/km_arm/km_arm.c | 14 ++++++++++++++
include/configs/km_arm.h | 3 +++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index c772ee2..f147f1f 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -145,6 +145,17 @@ int initialize_unit_leds(void)
return 0;
}
+#if defined(CONFIG_BOOTCOUNT_LIMIT)
+void set_bootcount_addr(void)
+{
+ uchar buf[32];
+ unsigned int bootcountaddr;
+ bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
+ sprintf((char *)buf, "0x%x", bootcountaddr);
+ setenv("bootcountaddr", (char *)buf);
+}
+#endif
+
int misc_init_r(void)
{
char *str;
@@ -215,6 +226,9 @@ int board_init(void)
int last_stage_init(void)
{
set_km_env();
+#if defined(CONFIG_BOOTCOUNT_LIMIT)
+ set_bootcount_addr();
+#endif
return 0;
}
diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h
index 70113d4..89f9d35 100644
--- a/include/configs/km_arm.h
+++ b/include/configs/km_arm.h
@@ -64,6 +64,9 @@
#define CONFIG_KM_KERNEL_ADDR 0x2000000 /* 4096KBytes */
#define CONFIG_KM_DEF_ENV_CPU \
+ "addbootcount=" \
+ "setenv bootargs ${bootargs} " \
+ "bootcountaddr=${bootcountaddr}\0" \
"addmtdparts=setenv bootargs ${bootargs} ${mtdparts}\0" \
"boot=bootm ${actual_kernel_addr} - -\0" \
"cramfsloadfdt=echo \\\\c\0" \
--
1.7.0.5
More information about the U-Boot
mailing list