adding httpd - failsafe patch
authorRalph Hempel <ralph.hempel@lantiq.com>
Tue, 30 Mar 2010 13:49:42 +0000 (13:49 +0000)
committerRalph Hempel <ralph.hempel@lantiq.com>
Tue, 30 Mar 2010 13:49:42 +0000 (13:49 +0000)
flash write routine is not functional yet
add configuration (board & dram)

SVN-Revision: 20603

package/uboot-lantiq/Makefile
package/uboot-lantiq/files/board/infineon/easy50712/danube.c
package/uboot-lantiq/files/include/configs/easy50712.h

index 3ffe8846eef11713a043b6d1c3a531504cf1a5c2..48f46831613b7a362d8775b54af26e363028fe97 100644 (file)
@@ -35,12 +35,20 @@ define Build/Prepare
        find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
 endef
 
-UBOOT_CONFIG:=easy50712_DDR166M
+UBOOT_CONFIG:=$(call qstrip,$(CONFIG_UBOOT_CONFIG))
+UBOOT_DDR_CONFIG:=$(call qstrip,$(CONFIG_UBOOT_DDR_CONFIG))
+
 UBOOT_MAKE_OPTS:= \
        CROSS_COMPILE=$(TARGET_CROSS) \
        ENDIANNESS= \
        V=1
 
+define Package/uboot-lantiq/config
+       menu "configuration"
+               source "$(SOURCE)/Config.in"
+       endmenu
+endef
+
 define Build/Configure/Target
        $(MAKE) -s -C $(PKG_BUILD_DIR) \
                $(UBOOT_MAKE_OPTS) \
@@ -50,7 +58,9 @@ endef
 
 define Build/Configure
        $(call Build/Configure/Target,$(UBOOT_CONFIG))
+ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
        $(call Build/Configure/Target,$(UBOOT_CONFIG)_ramboot)
+endif
 endef
 
 define Build/Compile/Target
@@ -62,7 +72,9 @@ endef
 
 define Build/Compile
        $(call Build/Compile/Target,$(UBOOT_CONFIG))
+ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
        $(call Build/Compile/Target,$(UBOOT_CONFIG)_ramboot)
+endif
 endef
 
 define Package/uboot-lantiq/install
@@ -71,12 +83,14 @@ define Package/uboot-lantiq/install
                if=$(PKG_BUILD_DIR)/$(UBOOT_CONFIG)/u-boot.bin \
                of=$(1)/$(UBOOT_CONFIG)/u-boot.bin \
                bs=64k conv=sync
+ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
        if [ -e $(UBOOT_CONFIG).conf ]; then \
                perl ./gct \
-                       $(UBOOT_CONFIG).conf \
+                       $(UBOOT_DDR_CONFIG) \
                        $(PKG_BUILD_DIR)/$(UBOOT_CONFIG)_ramboot/u-boot.srec \
                        $(1)/$(UBOOT_CONFIG)/u-boot.asc; \
        fi
+endif
 endef
 
 $(eval $(call BuildPackage,uboot-lantiq))
index 4734366929366317fef89e09b9fec3b9697214d3..f9b2b7626ccc1fcf02d14c56edba75278876f567 100644 (file)
@@ -32,6 +32,9 @@
 #include <asm/danube.h>
 #include <asm/reboot.h>
 #include <asm/io.h>
+#if defined(CONFIG_CMD_HTTPD)
+#include <httpd.h>
+#endif
 
 extern ulong ifx_get_ddr_hz(void);
 extern ulong ifx_get_cpuclk(void);
@@ -336,3 +339,102 @@ int board_eth_init(bd_t *bis)
        return 0;
 }
 
+#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)
+{
+       /* check the image */
+       if(image_info(data)) {
+               return -1;
+       }
+       /* write the image to the flash */
+       puts("http ugrade ...\n");
+       return 0;
+}
+
+int do_http_progress(const int state)
+{
+       /* toggle LED's here */
+       switch(state) {
+               case HTTP_PROGRESS_START:
+               puts("http start\n");
+               break;
+               case HTTP_PROGRESS_TIMEOUT:
+               break;
+               case HTTP_PROGRESS_UPLOAD_READY:
+               puts("http upload ready\n");
+               break;
+               case HTTP_PROGRESS_UGRADE_READY:
+               puts("http ugrade ready\n");
+               break;
+               case HTTP_PROGRESS_UGRADE_FAILED:
+               puts("http ugrade failed\n");
+               break;
+       }
+       return 0;
+}
+
+unsigned long do_http_tmp_address(void)
+{
+       char *s = getenv ("ram_addr");
+       if (s) {
+               ulong tmp = simple_strtoul (s, NULL, 16);
+               return tmp;
+       }
+       return 0 /*0x80a00000*/;
+}
+
+#endif
index e061b831d5edbaadae311878df4ad06d414f95d4..8eeb6c06a17c4d517d5d55f1d3ec5f37c90eeb32 100644 (file)
 #      define CONFIG_EBU_BUSCON0               0x0001D7FF
 #endif
 
+#define CONFIG_CMD_HTTPD               /* enable upgrade via HTTPD */
+
 #endif /* __CONFIG_H */