openwrt/package/uboot-lantiq/patches/310-fix-httpd.patch

531 lines
20 KiB
Diff

--- a/board/infineon/easy50712/danube.c
+++ b/board/infineon/easy50712/danube.c
@@ -354,7 +354,7 @@ int do_http_upgrade(const unsigned char
}
/* write the image to the flash */
puts("http ugrade ...\n");
- sprintf(buf, "era ${kernel_addr} +0x%x; cp.b ${ram_addr} ${kernel_addr} 0x%x", size, size);
+ sprintf(buf, "era ${kernel_addr} +0x%lx; cp.b ${ram_addr} ${kernel_addr} 0x%lx", size, size);
return run_command(buf, 0);
}
--- a/common/main.c
+++ b/common/main.c
@@ -273,6 +273,10 @@ static __inline__ int abortboot(int boot
void main_loop (void)
{
+#ifdef CONFIG_CMD_HTTPD
+ int ret;
+#endif
+
#ifndef CONFIG_SYS_HUSH_PARSER
static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
int len;
@@ -403,12 +407,22 @@ void main_loop (void)
# endif
# ifndef CONFIG_SYS_HUSH_PARSER
- run_command (s, 0);
+ ret = run_command (s, 0);
# else
- parse_string_outer(s, FLAG_PARSE_SEMICOLON |
+ ret = parse_string_outer(s, FLAG_PARSE_SEMICOLON |
FLAG_EXIT_FROM_LOOP);
# endif
+# ifdef CONFIG_CMD_HTTPD
+ if (ret != 0) {
+ printf("Failed to execute bootcmd "
+ "(maybe invalid u-boot environment?), "
+ "starting httpd to update firmware...\n");
+ NetLoopHttpd();
+ }
+# endif
+
+
# ifdef CONFIG_AUTOBOOT_KEYED
disable_ctrlc(prev); /* restore Control C checking */
# endif
--- a/include/configs/easy50712.h
+++ b/include/configs/easy50712.h
@@ -114,4 +114,7 @@
#define CONFIG_CMD_HTTPD /* enable upgrade via HTTPD */
+#define CONFIG_IPADDR 192.168.0.119
+#define CONFIG_ETHADDR 00:01:02:03:04:05
+
#endif /* __CONFIG_H */
--- a/lib_mips/time.c
+++ b/lib_mips/time.c
@@ -29,6 +29,8 @@ static unsigned long timestamp;
/* how many counter cycles in a jiffy */
#define CYCLES_PER_JIFFY (CONFIG_SYS_MIPS_TIMER_FREQ + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ
+unsigned long ifx_get_cpuclk(void);
+
/*
* timer without interrupts
*/
--- a/net/httpd.c
+++ b/net/httpd.c
@@ -35,12 +35,14 @@ HttpdHandler (void)
}
}
+#if 0
static void
HttpdTimeout (void)
{
puts ("T ");
NetSetTimeout (TIMEOUT * 1000, HttpdTimeout);
}
+#endif
void
HttpdStart (void)
--- a/net/net.c
+++ b/net/net.c
@@ -1966,7 +1966,7 @@ NetSendHttpd(void)
void
NetReceiveHttpd(volatile uchar * inpkt, int len)
{
- memcpy(uip_buf, inpkt, len);
+ memcpy(uip_buf, (const void *)inpkt, len);
uip_len = len;
if(BUF->type == htons(UIP_ETHTYPE_IP)) {
uip_arp_ipin();
@@ -1989,6 +1989,7 @@ NetLoopHttpd(void)
unsigned long long tout = 0;
bd_t *bd = gd->bd;
unsigned short int ip[2];
+ struct uip_eth_addr eaddr;
#ifdef CONFIG_NET_MULTI
NetRestarted = 0;
@@ -2039,6 +2040,15 @@ restart:
eth_getenv_enetaddr("ethaddr", NetOurEther);
#endif
+ eaddr.addr[0] = NetOurEther[0];
+ eaddr.addr[1] = NetOurEther[1];
+ eaddr.addr[2] = NetOurEther[2];
+ eaddr.addr[3] = NetOurEther[3];
+ eaddr.addr[4] = NetOurEther[4];
+ eaddr.addr[5] = NetOurEther[5];
+
+ uip_setethaddr(eaddr);
+
NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
NetOurGatewayIP = getenv_IPaddr ("gatewayip");
NetOurSubnetMask= getenv_IPaddr ("netmask");
@@ -2072,6 +2082,14 @@ restart:
tout = t1;
}
}
+
+ if (ctrlc()) {
+ eth_halt();
+ puts ("\nAbort\n");
+ return (-1);
+ }
+
+
if(!httpd_upload_complete)
continue;
printf("Bytes transferred = %ld (%lx hex)\n",
--- a/net/uip-0.9/fsdata.c
+++ b/net/uip-0.9/fsdata.c
@@ -1,199 +1,108 @@
-static const char data_flashing_html[] = {
- /* /flashing.html */
- 0x2f, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
- 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
- 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
- 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
- 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
- 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
- 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
- 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
- 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
- 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x3c, 0x62,
- 0x6f, 0x64, 0x79, 0x20, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3d,
- 0x22, 0x6d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x30,
- 0x70, 0x74, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x3b, 0x20, 0x68,
- 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x31, 0x30, 0x30, 0x25,
- 0x3b, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23,
- 0x66, 0x66, 0x66, 0x3b, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x67,
- 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, 0x6c, 0x6f,
- 0x72, 0x3a, 0x20, 0x23, 0x66, 0x62, 0x62, 0x30, 0x33, 0x34,
- 0x3b, 0x22, 0x3e, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72,
- 0x3e, 0x3c, 0x68, 0x31, 0x3e, 0x55, 0x70, 0x67, 0x72, 0x61,
- 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65,
- 0x6d, 0x20, 0x2e, 0x2e, 0x2e, 0x2e, 0x3c, 0x2f, 0x68, 0x31,
- 0x3e, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
- 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x2f, 0x68,
- 0x74, 0x6d, 0x6c, 0x3e, 0xa, };
-
-static const char data_fail_html[] = {
- /* /fail.html */
- 0x2f, 0x66, 0x61, 0x69, 0x6c, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
- 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
- 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
- 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
- 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
- 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
- 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
- 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
- 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
- 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x9,
- 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x9, 0x9, 0x3c,
- 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x9, 0x9, 0x9,
- 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65, 0x72, 0x61, 0x20, 0x46,
- 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66, 0x65, 0x20, 0x55, 0x49,
- 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65,
- 0x3e, 0xa, 0x9, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa,
- 0x9, 0x9, 0x3c, 0x68, 0x31, 0x3e, 0x46, 0x6c, 0x61, 0x73,
- 0x68, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65,
- 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x9, 0x9, 0x45,
- 0x52, 0x52, 0x4f, 0x52, 0x20, 0x2d, 0x20, 0x74, 0x68, 0x65,
- 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x20, 0x79, 0x6f, 0x75,
- 0x20, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x20,
- 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20,
- 0x70, 0x61, 0x73, 0x73, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66,
- 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x50,
- 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x6d, 0x61, 0x6b, 0x65,
- 0x20, 0x73, 0x75, 0x72, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x75,
- 0x73, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x66, 0x66, 0x69,
- 0x63, 0x69, 0x61, 0x6c, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74,
- 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64,
- 0x20, 0x62, 0x79, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
- 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x2e,
- 0x66, 0x6f, 0x6e, 0x6f, 0x73, 0x66, 0x65, 0x72, 0x61, 0x2e,
- 0x6f, 0x72, 0x67, 0x2f, 0xa, 0x9, 0x3c, 0x2f, 0x62, 0x6f,
- 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c,
- 0x3e, 0xa, };
-
-static const char data_404_html[] = {
- /* /404.html */
- 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
- 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34,
- 0x30, 0x34, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f,
- 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53,
- 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50,
- 0x2f, 0x30, 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70,
- 0x3a, 0x2f, 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f,
- 0x75, 0x69, 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e,
- 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a,
- 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c,
- 0xd, 0xa, 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e,
- 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f,
- 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65,
- 0x22, 0x3e, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
- 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, 0x20,
- 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66,
- 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c,
- 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, 0x3c, 0x2f,
- 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x2f, 0x68, 0x74, 0x6d,
- 0x6c, 0x3e, };
-
-static const char data_index_html[] = {
- /* /index.html */
- 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
- 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
- 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
- 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
- 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
- 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
- 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
- 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
- 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
- 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x9,
- 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x9, 0x9, 0x3c,
- 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x9, 0x9, 0x9,
- 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65, 0x72, 0x61, 0x20, 0x46,
- 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66, 0x65, 0x20, 0x55, 0x49,
- 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65,
- 0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e,
- 0xa, 0x9, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x73, 0x74,
- 0x79, 0x6c, 0x65, 0x3d, 0x22, 0x6d, 0x61, 0x72, 0x67, 0x69,
- 0x6e, 0x3a, 0x20, 0x30, 0x70, 0x74, 0x20, 0x61, 0x75, 0x74,
- 0x6f, 0x3b, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a,
- 0x31, 0x30, 0x30, 0x25, 0x3b, 0x20, 0x63, 0x6f, 0x6c, 0x6f,
- 0x72, 0x3a, 0x20, 0x23, 0x30, 0x30, 0x30, 0x3b, 0x20, 0x62,
- 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d,
- 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x62,
- 0x62, 0x30, 0x33, 0x34, 0x3b, 0x22, 0x3e, 0xa, 0x9, 0x9,
- 0x3c, 0x68, 0x31, 0x3e, 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65,
- 0x72, 0x61, 0x20, 0x46, 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66,
- 0x65, 0x20, 0x55, 0x49, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa,
- 0x9, 0x9, 0x3c, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x65,
- 0x74, 0x68, 0x6f, 0x64, 0x3d, 0x22, 0x70, 0x6f, 0x73, 0x74,
- 0x22, 0x20, 0x65, 0x6e, 0x63, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74,
- 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x2d, 0x64, 0x61, 0x74, 0x61,
- 0x22, 0x3e, 0xa, 0x9, 0x9, 0x9, 0x3c, 0x69, 0x6e, 0x70,
- 0x75, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x66, 0x69,
- 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x69,
- 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x3e, 0xa, 0x9, 0x9,
- 0x9, 0x3c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x3e,
- 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x3e,
- 0xa, 0x9, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa,
- 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, };
-
-static const char data_flash_html[] = {
- /* /flash.html */
- 0x2f, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
- 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
- 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
- 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
- 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
- 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
- 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
- 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
- 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
- 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x9,
- 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x9, 0x9, 0x3c,
- 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x9, 0x9, 0x9,
- 0x4c, 0x61, 0x46, 0x6f, 0x6e, 0x65, 0x72, 0x61, 0x20, 0x46,
- 0x61, 0x69, 0x6c, 0x73, 0x61, 0x66, 0x65, 0x20, 0x55, 0x49,
- 0xa, 0x9, 0x9, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65,
- 0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e,
- 0xa, 0x9, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x73, 0x74,
- 0x79, 0x6c, 0x65, 0x3d, 0x22, 0x6d, 0x61, 0x72, 0x67, 0x69,
- 0x6e, 0x3a, 0x20, 0x30, 0x70, 0x74, 0x20, 0x61, 0x75, 0x74,
- 0x6f, 0x3b, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a,
- 0x31, 0x30, 0x30, 0x25, 0x3b, 0x20, 0x63, 0x6f, 0x6c, 0x6f,
- 0x72, 0x3a, 0x20, 0x23, 0x30, 0x30, 0x30, 0x3b, 0x20, 0x62,
- 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d,
- 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x62,
- 0x62, 0x30, 0x33, 0x34, 0x3b, 0x22, 0x3e, 0xa, 0x9, 0x9,
- 0x3c, 0x68, 0x31, 0x3e, 0x46, 0x6c, 0x61, 0x73, 0x68, 0x69,
- 0x6e, 0x67, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x9, 0x9,
- 0x54, 0x68, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d,
- 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x77, 0x20, 0x74, 0x72,
- 0x79, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x6c,
- 0x61, 0x73, 0x68, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68,
- 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x70,
- 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x2c, 0x20, 0x74, 0x68,
- 0x65, 0x20, 0x6c, 0x65, 0x64, 0x73, 0x20, 0x77, 0x69, 0x6c,
- 0x6c, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x74, 0x6f,
- 0x20, 0x62, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0xa, 0xa, 0x9,
- 0x9, 0x41, 0x66, 0x74, 0x65, 0x72, 0x20, 0x61, 0x20, 0x73,
- 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x6c,
- 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68,
- 0x65, 0x20, 0x62, 0x6f, 0x78, 0x20, 0x77, 0x69, 0x6c, 0x6c,
- 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0xa, 0x9, 0x3c,
- 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68,
- 0x74, 0x6d, 0x6c, 0x3e, 0xa, };
-
-const struct fsdata_file file_flashing_html[] = {{NULL, data_flashing_html, data_flashing_html + 15, sizeof(data_flashing_html) - 15}};
+static const char data_flashing_html[] =
+"HTTP/1.0 200 OK\n"
+"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
+"Content-type: text/html\n"
+"\n"
+"<html>\n"
+"\t<head>\n"
+"\t\t<title>\n"
+"\t\t\tFailsafe UI\n"
+"\t\t</title>\n"
+"\t</head>\n"
+"\t<body>\n"
+"\t\t<center><h1>Upgrading system...</h1></center>\n"
+"\t</body>\n"
+"</html>\n";
+
+static const char data_fail_html[] =
+"HTTP/1.0 200 OK\n"
+"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
+"Content-type: text/html\n"
+"\n"
+"<html>\n"
+"\t<head>\n"
+"\t\t<title>\n"
+"\t\t\tFailsafe UI\n"
+"\t\t</title>\n"
+"\t</head>\n"
+"\t<body>\n"
+"\t\t<h1>Flashing failed</h1>\n"
+"\t\tERROR - the image you uploaded failed to pass verification.<br>\n"
+"\t\tPlease make sure to use an official update provided by http://lantiq.com/\n"
+"\t</body>\n"
+"</html>\n";
+
+static const char data_404_html[] =
+"HTTP/1.0 404 File not found\n"
+"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
+"Content-type: text/html\n"
+"\n"
+"<html>\n"
+"\t<head>\n"
+"\t\t<title>\n"
+"\t\t\tFailsafe UI\n"
+"\t\t</title>\n"
+"\t</head>\n"
+"\t<body>\n"
+"\t\t<center><h1>404 - file not found</h1></center>\n"
+"\t</body>\n"
+"</html>\n";
+
+static const char data_index_html[] =
+"HTTP/1.0 200 OK\n"
+"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
+"Content-type: text/html\n"
+"\n"
+"<html>\n"
+"\t<head>\n"
+"\t\t<title>\n"
+"\t\t\tFailsafe UI\n"
+"\t\t</title>\n"
+"\t</head>\n"
+"\t<body>\n"
+"\t\t<h1>Failsafe UI</h1>\n"
+"\t\t<form method=\"post\" enctype=\"multipart/form-data\">\n"
+"\t\t\t<input type=file name=firmware>\n"
+"\t\t\t<input type=submit>\n"
+"\t\t</form>\n"
+"\t</body>\n"
+"</html>\n";
+
+static const char data_flash_html[] =
+"HTTP/1.0 200 OK\n"
+"Server: uIP/0.9 (http://dunkels.com/adam/uip/)\n"
+"Content-type: text/html\n"
+"\n"
+"<html>\n"
+"\t<head>\n"
+"\t\t<title>\n"
+"\t\t\tFailsafe UI\n"
+"\t\t</title>\n"
+"\t</head>\n"
+"\t<body>\n"
+"\t\t<h1>Flashing...</h1>\n"
+"\t\tThe system is now trying to flash. If there is a problem, the LEDs will "
+"start to blink.<br>\n"
+"\n"
+"\t\tAfter a successful update the box will reboot\n"
+"\t</body>\n"
+"</html>\n";
+
+const struct fsdata_file file_flashing_html[] =
+{{NULL, "/flashing.html", data_flashing_html, sizeof(data_flashing_html)}};
+
+const struct fsdata_file file_fail_html[] =
+{{file_flashing_html, "/fail.html", data_fail_html, sizeof(data_fail_html)}};
-const struct fsdata_file file_fail_html[] = {{file_flashing_html, data_fail_html, data_fail_html + 11, sizeof(data_fail_html) - 11}};
+const struct fsdata_file file_404_html[] =
+{{file_fail_html, "/404.html", data_404_html, sizeof(data_404_html)}};
-const struct fsdata_file file_404_html[] = {{file_fail_html, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};
+const struct fsdata_file file_index_html[] =
+{{file_404_html, "/index.html", data_index_html, sizeof(data_index_html)}};
-const struct fsdata_file file_index_html[] = {{file_404_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};
-
-const struct fsdata_file file_flash_html[] = {{file_index_html, data_flash_html, data_flash_html + 12, sizeof(data_flash_html) - 12}};
+const struct fsdata_file file_flash_html[] =
+{{file_index_html, "/flash.html", data_flash_html, sizeof(data_flash_html)}};
#define FS_ROOT file_flash_html
-#define FS_NUMFILES 5
\ No newline at end of file
+#define FS_NUMFILES 5
--- a/net/uip-0.9/httpd.c
+++ b/net/uip-0.9/httpd.c
@@ -130,7 +130,7 @@ httpd_appcall(void)
if(!fs_open((const char *)&uip_appdata[4], &fsfile))
{
PRINTLN("couldn't open file");
- fs_open(file_index_html.name, &fsfile);
+ fs_open(file_404_html.name, &fsfile);
}
}
hs->script = 0;
@@ -141,7 +141,7 @@ httpd_appcall(void)
if(hs->state == HTTP_FIRMWARE)
{
unsigned char *start = (unsigned char*)uip_appdata;
- char *clen = strstr(start, "Content-Length:");
+ char *clen = strstr((char *)start, "Content-Length:");
int len = 0;
unsigned char *next, *end;
unsigned char *boundary_start;
@@ -150,14 +150,14 @@ httpd_appcall(void)
if(clen)
{
clen += sizeof("Content-Length:");
- next = strstr(clen, eol);
+ next = (unsigned char *)strstr(clen, eol);
if(next)
{
len = atoi(clen);
next++;
printf("expecting %d bytes\n", len);
upload_data = httpd_upload_data = (unsigned char *)do_http_tmp_address();
- printf("received data will be stored at 0x%08X\n", upload_data);
+ printf("received data will be stored at %p\n", upload_data);
if(!upload_data)
{
printf("failed to allocate memory\n");
@@ -174,14 +174,14 @@ httpd_appcall(void)
uip_close();
return;
}
- boundary_start = strstr(next, "---");
+ boundary_start = (unsigned char *)strstr((char *)next, "---");
if(!boundary_start)
{
uip_close();
return;
}
- end = strstr(boundary_start, eol);
- if(!eol)
+ end = (unsigned char *)strstr((char *)boundary_start, eol);
+ if(!end)
{
uip_close();
return;
@@ -189,13 +189,13 @@ httpd_appcall(void)
boundary_len = end - boundary_start;
memcpy(boundary, boundary_start, boundary_len);
boundary[boundary_len] = 0;
- next = strstr(boundary_start, "name=\"firmware\";");
+ next = (unsigned char *)strstr((char *)boundary_start, "name=\"firmware\";");
if(!next)
{
uip_close();
return;
}
- next = strstr(next, eol2);
+ next = (unsigned char *)strstr((char *)next, eol2);
if(!next)
{
printf("could not find start of data\n");
@@ -259,7 +259,6 @@ httpd_appcall(void)
{
if(upload_running)
{
- int i;
httpd_upload_complete = 1;
// for(i = 0; i < hs->upload_total; i++)
// printf("%c", httpd_upload_data[i]);
@@ -267,7 +266,7 @@ httpd_appcall(void)
uip_close();
}
}
- uip_send(hs->dataptr, hs->count);
+ uip_send((unsigned char *)hs->dataptr, hs->count);
}
break;