diff options
author | Ralph Hempel <ralph.hempel@lantiq.com> | 2010-03-30 16:17:38 +0000 |
---|---|---|
committer | Ralph Hempel <ralph.hempel@lantiq.com> | 2010-03-30 16:17:38 +0000 |
commit | 52c5d88da9e06edcb5d1b2cc3bef42b09e6988dd (patch) | |
tree | bd9bed215c59b37d727760d81cf248da1c226f48 /package/uboot-lantiq/files/board/infineon/easy50712/danube.c | |
parent | 0f3c8610c4b1d4c55efb2f0c2bba4c7eb639a1bf (diff) | |
download | upstream-52c5d88da9e06edcb5d1b2cc3bef42b09e6988dd.tar.gz upstream-52c5d88da9e06edcb5d1b2cc3bef42b09e6988dd.tar.bz2 upstream-52c5d88da9e06edcb5d1b2cc3bef42b09e6988dd.zip |
[uboot-lantiq] httpd failsafe - add image check and flash access
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20610 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uboot-lantiq/files/board/infineon/easy50712/danube.c')
-rw-r--r-- | package/uboot-lantiq/files/board/infineon/easy50712/danube.c | 66 |
1 files changed, 10 insertions, 56 deletions
diff --git a/package/uboot-lantiq/files/board/infineon/easy50712/danube.c b/package/uboot-lantiq/files/board/infineon/easy50712/danube.c index f9b2b7626c..0b33a3ad4c 100644 --- a/package/uboot-lantiq/files/board/infineon/easy50712/danube.c +++ b/package/uboot-lantiq/files/board/infineon/easy50712/danube.c @@ -340,69 +340,22 @@ int board_eth_init(bd_t *bis) } #if defined(CONFIG_CMD_HTTPD) -static int image_info (ulong addr) -{ - void *hdr = (void *)addr; - - printf ("\n## Checking Image at %08lx ...\n", addr); - - switch (genimg_get_format (hdr)) { - case IMAGE_FORMAT_LEGACY: - puts (" Legacy image found\n"); - if (!image_check_magic (hdr)) { - puts (" Bad Magic Number\n"); - return 1; - } - - if (!image_check_hcrc (hdr)) { - puts (" Bad Header Checksum\n"); - return 1; - } - - image_print_contents (hdr); - - puts (" Verifying Checksum ... "); - if (!image_check_dcrc (hdr)) { - puts (" Bad Data CRC\n"); - return 1; - } - puts ("OK\n"); - return 0; -#if defined(CONFIG_FIT) - case IMAGE_FORMAT_FIT: - puts (" FIT image found\n"); - - if (!fit_check_format (hdr)) { - puts ("Bad FIT image format!\n"); - return 1; - } - - fit_print_contents (hdr); - - if (!fit_all_image_check_hashes (hdr)) { - puts ("Bad hash in FIT image!\n"); - return 1; - } - - return 0; -#endif - default: - puts ("Unknown image format!\n"); - break; - } - - return 1; -} - int do_http_upgrade(const unsigned char *data, const ulong size) { + char buf[128]; + + if(getenv ("ram_addr") == NULL) + return -1; + if(getenv ("kernel_addr") == NULL) + return -1; /* check the image */ - if(image_info(data)) { + if(run_command("imi ${ram_addr}", 0) < 0) { return -1; } /* write the image to the flash */ puts("http ugrade ...\n"); - return 0; + sprintf(buf, "era ${kernel_addr} +0x%x; cp.b ${ram_addr} ${kernel_addr} 0x%x", size, size); + return run_command(buf, 0); } int do_http_progress(const int state) @@ -413,6 +366,7 @@ int do_http_progress(const int state) puts("http start\n"); break; case HTTP_PROGRESS_TIMEOUT: + puts("."); break; case HTTP_PROGRESS_UPLOAD_READY: puts("http upload ready\n"); |