projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
microblaze: usable uart16550 for big endian systems
[oweals/u-boot.git]
/
common
/
update.c
diff --git
a/common/update.c
b/common/update.c
index 75284748734e11961cea3fb6258d4149e389112d..5b1a064c29cba71d2337504eb30fd0a6811d8ecd 100644
(file)
--- a/
common/update.c
+++ b/
common/update.c
@@
-86,7
+86,7
@@
static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
/* download the update file */
load_addr = addr;
copy_filename(BootFile, filename, sizeof(BootFile));
/* download the update file */
load_addr = addr;
copy_filename(BootFile, filename, sizeof(BootFile));
- size = NetLoop(TFTP);
+ size = NetLoop(TFTP
GET
);
if (size < 0)
rv = 1;
if (size < 0)
rv = 1;
@@
-238,13
+238,17
@@
static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
return 0;
}
return 0;
}
-
void update_tftp(void
)
+
int update_tftp(ulong addr
)
{
char *filename, *env_addr;
int images_noffset, ndepth, noffset;
ulong update_addr, update_fladdr, update_size;
{
char *filename, *env_addr;
int images_noffset, ndepth, noffset;
ulong update_addr, update_fladdr, update_size;
- ulong addr;
void *fit;
void *fit;
+ int ret = 0;
+
+ /* use already present image */
+ if (addr)
+ goto got_update_file;
printf("Auto-update from TFTP: ");
printf("Auto-update from TFTP: ");
@@
-253,7
+257,7
@@
void update_tftp(void)
if (filename == NULL) {
printf("failed, env. variable '%s' not found\n",
UPDATE_FILE_ENV);
if (filename == NULL) {
printf("failed, env. variable '%s' not found\n",
UPDATE_FILE_ENV);
- return;
+ return
1
;
}
printf("trying update file '%s'\n", filename);
}
printf("trying update file '%s'\n", filename);
@@
-268,15
+272,16
@@
void update_tftp(void)
if (update_load(filename, CONFIG_UPDATE_TFTP_MSEC_MAX,
CONFIG_UPDATE_TFTP_CNT_MAX, addr)) {
printf("Can't load update file, aborting auto-update\n");
if (update_load(filename, CONFIG_UPDATE_TFTP_MSEC_MAX,
CONFIG_UPDATE_TFTP_CNT_MAX, addr)) {
printf("Can't load update file, aborting auto-update\n");
- return;
+ return
1
;
}
}
+got_update_file:
fit = (void *)addr;
if (!fit_check_format((void *)fit)) {
printf("Bad FIT format of the update file, aborting "
"auto-update\n");
fit = (void *)addr;
if (!fit_check_format((void *)fit)) {
printf("Bad FIT format of the update file, aborting "
"auto-update\n");
- return;
+ return
1
;
}
/* process updates */
}
/* process updates */
@@
-293,6
+298,7
@@
void update_tftp(void)
if (!fit_image_check_hashes(fit, noffset)) {
printf("Error: invalid update hash, aborting\n");
if (!fit_image_check_hashes(fit, noffset)) {
printf("Error: invalid update hash, aborting\n");
+ ret = 1;
goto next_node;
}
goto next_node;
}
@@
-301,15
+307,17
@@
void update_tftp(void)
&update_fladdr, &update_size)) {
printf("Error: can't get update parameteres, "
"aborting\n");
&update_fladdr, &update_size)) {
printf("Error: can't get update parameteres, "
"aborting\n");
+ ret = 1;
goto next_node;
}
if (update_flash(update_addr, update_fladdr, update_size)) {
printf("Error: can't flash update, aborting\n");
goto next_node;
}
if (update_flash(update_addr, update_fladdr, update_size)) {
printf("Error: can't flash update, aborting\n");
+ ret = 1;
goto next_node;
}
next_node:
noffset = fdt_next_node(fit, noffset, &ndepth);
}
goto next_node;
}
next_node:
noffset = fdt_next_node(fit, noffset, &ndepth);
}
- return;
+ return
ret
;
}
}