[U-Boot] [PATCH 1/2] automatic update from FIT image: add optional address parameter
Andreas Pretzsch
apr at cn-eng.de
Tue Apr 19 23:01:57 CEST 2011
Current update_tftp() flow:
1.) fetch "updatefile" from defined TFTP server
2.) check if FIT format
3.) flash contained images
Add an address parameter to update_tftp(). If this address is non-zero,
skip the TFTP transfer and use the image at this address.
Signed-off-by: Andreas Pretzsch <apr at cn-eng.de>
---
common/main.c | 4 ++--
common/update.c | 8 ++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/common/main.c b/common/main.c
index dcbacc9..9b86934 100644
--- a/common/main.c
+++ b/common/main.c
@@ -51,7 +51,7 @@ void inline __show_boot_progress (int val) {}
void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
#if defined(CONFIG_UPDATE_TFTP)
-void update_tftp (void);
+void update_tftp (ulong addr);
#endif /* CONFIG_UPDATE_TFTP */
#define MAX_DELAY_STOP_STR 32
@@ -356,7 +356,7 @@ void main_loop (void)
#endif /* CONFIG_PREBOOT */
#if defined(CONFIG_UPDATE_TFTP)
- update_tftp ();
+ update_tftp (0UL);
#endif /* CONFIG_UPDATE_TFTP */
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
diff --git a/common/update.c b/common/update.c
index 7528474..531c7d6 100644
--- a/common/update.c
+++ b/common/update.c
@@ -238,14 +238,17 @@ static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
return 0;
}
-void update_tftp(void)
+void update_tftp(ulong addr)
{
char *filename, *env_addr;
int images_noffset, ndepth, noffset;
ulong update_addr, update_fladdr, update_size;
- ulong addr;
void *fit;
+ /* use already present image */
+ if (addr)
+ goto got_update_file;
+
printf("Auto-update from TFTP: ");
/* get the file name of the update file */
@@ -271,6 +274,7 @@ void update_tftp(void)
return;
}
+got_update_file:
fit = (void *)addr;
if (!fit_check_format((void *)fit)) {
--
1.7.4.1
More information about the U-Boot
mailing list