[U-Boot] [PATCH 2/2] Implementation of a bootloader area protection during auto-update (new CONFIG_SYSTEM_START_ADDR necessary)

Christoph Koenig christoph.koenig at ikt.uni-hannover.de
Fri Apr 1 17:22:00 CEST 2011


---
 common/update.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/common/update.c b/common/update.c
index fe2139a..8b858bd 100644
--- a/common/update.c
+++ b/common/update.c
@@ -195,6 +195,13 @@ static int update_flash(ulong addr_source, ulong addr_first, ulong size)
 		return 1;
 	}
 
+#ifdef CONFIG_SYSTEM_START_ADDR
+	if (addr_first < CONFIG_SYSTEM_START_ADDR) {
+		printf("Error: auto-update does not allow to write a new bootloader\n");
+		return 1;
+	}
+#endif
+
 	/* remove protection on processed sectors */
 	if (update_flash_protect(0, addr_first, addr_last) > 0) {
 		printf("Error: could not unprotect flash sectors\n");
-- 
1.7.1



More information about the U-Boot mailing list