summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorRalph Hempel <ralph.hempel@lantiq.com>2010-03-30 16:17:38 +0000
committerRalph Hempel <ralph.hempel@lantiq.com>2010-03-30 16:17:38 +0000
commite7b83bc22a2838bf68596f79775dfefd31805c07 (patch)
treeb54689f3f6ed9474447a014533f602d9c51a87b7 /package
parent046d73d3c2bc3a515024c2cc8339d1177e749b77 (diff)
downloadmtk-20170518-e7b83bc22a2838bf68596f79775dfefd31805c07.zip
mtk-20170518-e7b83bc22a2838bf68596f79775dfefd31805c07.tar.gz
mtk-20170518-e7b83bc22a2838bf68596f79775dfefd31805c07.tar.bz2
httpd failsafe - add image check and flash access
SVN-Revision: 20610
Diffstat (limited to 'package')
-rw-r--r--package/uboot-lantiq/Makefile2
-rw-r--r--package/uboot-lantiq/files/board/infineon/easy50712/danube.c66
-rw-r--r--package/uboot-lantiq/files/board/infineon/easy50812/ar9.c73
-rw-r--r--package/uboot-lantiq/patches/300-httpd.patch5
4 files changed, 27 insertions, 119 deletions
diff --git a/package/uboot-lantiq/Makefile b/package/uboot-lantiq/Makefile
index 48f4683..985f363 100644
--- a/package/uboot-lantiq/Makefile
+++ b/package/uboot-lantiq/Makefile
@@ -84,7 +84,7 @@ define Package/uboot-lantiq/install
of=$(1)/$(UBOOT_CONFIG)/u-boot.bin \
bs=64k conv=sync
ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
- if [ -e $(UBOOT_CONFIG).conf ]; then \
+ if [ -e $(UBOOT_DDR_CONFIG) ]; then \
perl ./gct \
$(UBOOT_DDR_CONFIG) \
$(PKG_BUILD_DIR)/$(UBOOT_CONFIG)_ramboot/u-boot.srec \
diff --git a/package/uboot-lantiq/files/board/infineon/easy50712/danube.c b/package/uboot-lantiq/files/board/infineon/easy50712/danube.c
index f9b2b76..0b33a3a 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");
diff --git a/package/uboot-lantiq/files/board/infineon/easy50812/ar9.c b/package/uboot-lantiq/files/board/infineon/easy50812/ar9.c
index dd6be9b..d4cd049 100644
--- a/package/uboot-lantiq/files/board/infineon/easy50812/ar9.c
+++ b/package/uboot-lantiq/files/board/infineon/easy50812/ar9.c
@@ -48,10 +48,10 @@ extern ulong ifx_get_cpuclk(void);
#define ID_SAMURAI_1 0x0007
#define SAMURAI_ID_REG0 0xA0
#define SAMURAI_ID_REG1 0xA1
-#define ID_TANTOS 0x2599
+#define ID_TANTOS 0x2599
-#define RGMII_MODE 0
-#define MII_MODE 1
+#define RGMII_MODE 0
+#define MII_MODE 1
#define REV_MII_MODE 2
#define RED_MII_MODE_IC 3 /*Input clock */
#define RGMII_MODE_100MB 4
@@ -565,70 +565,22 @@ static int external_switch_init(void)
#endif /* CONFIG_EXTRA_SWITCH */
#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)
@@ -639,6 +591,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");
diff --git a/package/uboot-lantiq/patches/300-httpd.patch b/package/uboot-lantiq/patches/300-httpd.patch
index f9a81e9..25e84cd 100644
--- a/package/uboot-lantiq/patches/300-httpd.patch
+++ b/package/uboot-lantiq/patches/300-httpd.patch
@@ -165,7 +165,7 @@
NetRxPacket = inpkt;
NetRxPacketLen = len;
et = (Ethernet_t *)inpkt;
-@@ -1952,3 +1972,161 @@ ushort getenv_VLAN(char *var)
+@@ -1952,3 +1972,162 @@ ushort getenv_VLAN(char *var)
{
return (string_to_VLAN(getenv(var)));
}
@@ -249,6 +249,8 @@
+ NetArpWaitTxPacketSize = 0;
+ }
+
++restart:
++
+ eth_halt();
+#ifdef CONFIG_NET_MULTI
+ eth_set_current();
@@ -258,7 +260,6 @@
+ return(-1);
+ }
+
-+restart:
+#ifdef CONFIG_NET_MULTI
+ memcpy (NetOurEther, eth_get_dev()->enetaddr, 6);
+#else