Implementation of a auto-update hash-check- if image has new hash, update flash, otherwise boot device immediately
PATCH 1/2 Implementation of a auto-update hash-check- if image has new hash, update flash, otherwise boot device immediately
--- common/image.c | 2 +- common/update.c | 42 +++++++++++++++++++++++++++++++++++------- include/image.h | 3 +++ 3 files changed, 39 insertions(+), 8 deletions(-)
common/image.c +1 -1
@@ -2398,7 +2398,7 @@ int fit_set_timestamp (void *fit, int noffset, time_t timestamp)* 0, on success * -1, when algo is unsupported */ -static int calculate_hash (const void *data,int data_len,const char *algo, +int calculate_hash (const void *data,int data_len,const char *algo,uint8_t *value,int *value_len) {if (strcmp (algo,"crc32" ) ==0 ) {
common/update.c +35 -7
75 lines not on this page · raw message
include/image.h +3 -0
@@ -567,6 +567,9 @@ static inline ulong fit_get_size (const void *fit)return fdt_totalsize (fit); } +int calculate_hash (const void *data,int data_len,const char *algo, +uint8_t *value,int *value_len); +/** * fit_get_end - get FIT image end * @fit: pointer to the FIT format image header
Signature · 1 line
1.7.1
PATCH 2/2 Implementation of a bootloader area protection during auto-update (new CONFIG_SYSTEM_START_ADDR necessary)
--- common/update.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
common/update.c +7 -0
@@ -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" );
Signature · 1 line
1.7.1
PATCH 2/2 Implementation of a bootloader area protection during auto-update (new CONFIG_SYSTEM_START_ADDR necessary)
Dear Christoph Koenig,
Quoted 1 line · In message <1301671320-16131-2-git-send-email-christoph.koenig@ikt.uni-hannover…
---
Subjecxt too long.
Commit message missing.
No explanation given what the code is supposed to do.
SoB line missing.
common/update.c static int update_flash(ulong addr_source, ulong addr_first, ulong size) · line 203
Quoted 6 lines
common/update.c +6
-0+#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
Explanation and documentation for new CONFIG_ option (in README) missing.
I think this approach is too simplistic. Some boards have the boot loader at the beginning of the OR flash, some at the end, others right in the middle. Still others boot from NAND flash or SDCard.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Gods don't like people not doing much work. People who aren't busy all the time might start to _think_. - Terry Pratchett, _Small Gods_
PATCH 1/2 Implementation of a auto-update hash-check- if image has new hash, update flash, otherwise boot device immediately
In reply to Christoph KoenigDear Christoph Koenig,
Quoted 5 lines · In message <1301671320-16131-1-git-send-email-christoph.koenig@ikt.uni-hannover…
--- common/image.c | 2 +- common/update.c | 42 +++++++++++++++++++++++++++++++++++------- include/image.h | 3 +++ 3 files changed, 39 insertions(+), 8 deletions(-)
Please use a short subject line, and provide a proper commit message.
Your SoB line is missing.
common/update.c extern ulong load_addr; · line 65
Quoted 2 lines
common/update.c +1
-1-static int update_load (char *filename,ulong msec_max,int cnt_max,ulong addr) +static int update_load (char *filename,ulong msec_max,int cnt_max,ulong addr,int *size)
Line too long. Please fix globally.
common/update.c void update_tftp(void) · line 294
Quoted 3 lines
common/update.c +3
-0+if (calculate_hash ((void *)addr, size, algo, &value, &value_len)) { +printf (" Error: Error during hash calculation\n" ); +return 1 ;
No spaces at the beginning of the line. "Error" is redundant here.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de No one wants war. -- Kirk, "Errand of Mercy", stardate 3201.7