Hi,

this patch fixes uboot-envtools so that it is no longer broken.

-Raphael
diff -pruN uboot-envtools.orig/Makefile uboot-envtools/Makefile
--- uboot-envtools.orig/Makefile	2010-03-05 16:51:22.000000000 +0100
+++ uboot-envtools/Makefile	2010-03-05 16:59:45.000000000 +0100
@@ -1,5 +1,5 @@
-# 
-# Copyright (C) 2009 OpenWrt.org
+#
+# Copyright (C) 2006-2010 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uboot-envtools
 PKG_VERSION:=20081215
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
 PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/u/uboot-envtools/
@@ -19,8 +19,8 @@ include $(INCLUDE_DIR)/package.mk
 define Package/uboot-envtools
   SECTION:=utils
   CATEGORY:=Utilities
-  DEPENDS:=...@broken
   TITLE:=read/modify the environment for the bootloader U-Boot
+  DEPENDS:=+zlib
 endef
 
 define Package/uboot-envtools/description
@@ -29,7 +29,7 @@ endef
 define Package/uboot-envtools/install
 	$(INSTALL_DIR) $(1)/usr/sbin
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fw_printenv $(1)/usr/sbin/
-	ln -s fw_printenv $(1)/usr/sbin/fw_setenv
+	ln -sf fw_printenv $(1)/usr/sbin/fw_setenv
 endef
 
 $(eval $(call BuildPackage,uboot-envtools))
diff -pruN uboot-envtools.orig/patches/001-crc32_func_signature.patch uboot-envtools/patches/001-crc32_func_signature.patch
--- uboot-envtools.orig/patches/001-crc32_func_signature.patch	2010-03-05 16:51:22.000000000 +0100
+++ uboot-envtools/patches/001-crc32_func_signature.patch	2010-02-19 16:18:05.000000000 +0100
@@ -1,13 +1,125 @@
-Index: uboot-envtools-20080520/crc32.c
-===================================================================
---- uboot-envtools-20080520.orig/crc32.c	2008-08-03 16:02:43.000000000 +0200
-+++ uboot-envtools-20080520/crc32.c	2008-08-03 16:03:25.000000000 +0200
-@@ -154,7 +154,7 @@
+--- a/crc32.c
++++ b/crc32.c
+@@ -8,11 +8,7 @@
+  * For conditions of distribution and use, see copyright notice in zlib.h
+  */
+ 
+-#ifndef USE_HOSTCC	/* Shut down "ANSI does not permit..." warnings */
+-#include <common.h>
+-#else
+ #include <stdint.h>
+-#endif
+ 
+ #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ #include <watchdog.h>
+@@ -136,7 +132,7 @@ local const uint32_t crc_table[256] = {
+ 
+ #if 0
+ /* =========================================================================
+- * This function can be used by asm versions of crc32()
++ * This function can be used by asm versions of uboot_crc32()
+  */
+ const uint32_t * ZEXPORT get_crc_table()
+ {
+@@ -154,7 +150,7 @@ const uint32_t * ZEXPORT get_crc_table()
  #define DO8(buf)  DO4(buf); DO4(buf);
  
  /* ========================================================================= */
 -uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *buf, uInt len)
-+uLong ZEXPORT crc32 (uLong crc, const Bytef *buf, uInt len)
++uint32_t ZEXPORT uboot_crc32 (uint32_t crc, const Bytef *buf, uInt len)
  {
  #ifdef DYNAMIC_CRC_TABLE
      if (crc_table_empty)
+@@ -217,12 +213,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
+ 		chunk = end - curr;
+ 		if (chunk > chunk_sz)
+ 			chunk = chunk_sz;
+-		crc = crc32 (crc, curr, chunk);
++		crc = uboot_crc32 (crc, curr, chunk);
+ 		curr += chunk;
+ 		WATCHDOG_RESET ();
+ 	}
+ #else
+-	crc = crc32 (crc, buf, len);
++	crc = uboot_crc32 (crc, buf, len);
+ #endif
+ 
+ 	return crc;
+--- a/fw_env.c
++++ b/fw_env.c
+@@ -216,9 +216,9 @@ static int parse_config (void);
+ #if defined(CONFIG_FILE)
+ static int get_config (char *);
+ #endif
+-static inline ulong getenvsize (void)
++static inline uint32_t getenvsize (void)
+ {
+-	ulong rc = CONFIG_ENV_SIZE - sizeof (long);
++	uint32_t rc = CONFIG_ENV_SIZE - sizeof (uint32_t);
+ 
+ 	if (HaveRedundEnv)
+ 		rc -= sizeof (char);
+@@ -437,7 +437,7 @@ int fw_setenv (int argc, char *argv[])
+ 	/*
+ 	 * Update CRC
+ 	 */
+-	*environment.crc = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
++	*environment.crc = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
+ 
+ 	/* write environment back to flash */
+ 	if (flash_io (O_RDWR)) {
+@@ -627,7 +627,7 @@ static int flash_write_buf (int dev, int
+ 		data = malloc (erase_len);
+ 		if (!data) {
+ 			fprintf (stderr,
+-				 "Cannot malloc %u bytes: %s\n",
++				 "Cannot malloc %zu bytes: %s\n",
+ 				 erase_len, strerror (errno));
+ 			return -1;
+ 		}
+@@ -883,11 +883,11 @@ static char *envmatch (char * s1, char *
+ static int env_init (void)
+ {
+ 	int crc0, crc0_ok;
+-	char flag0;
++	unsigned char flag0;
+ 	void *addr0;
+ 
+ 	int crc1, crc1_ok;
+-	char flag1;
++	unsigned char flag1;
+ 	void *addr1;
+ 
+ 	struct env_image_single *single;
+@@ -923,7 +923,7 @@ static int env_init (void)
+ 	if (flash_io (O_RDONLY))
+ 		return -1;
+ 
+-	crc0 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
++	crc0 = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
+ 	crc0_ok = (crc0 == *environment.crc);
+ 	if (!HaveRedundEnv) {
+ 		if (!crc0_ok) {
+@@ -964,7 +964,7 @@ static int env_init (void)
+ 			return -1;
+ 		}
+ 
+-		crc1 = crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
++		crc1 = uboot_crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
+ 		crc1_ok = (crc1 == redundant->crc);
+ 		flag1 = redundant->flags;
+ 
+--- a/fw_env.h
++++ b/fw_env.h
+@@ -47,8 +47,10 @@
+ 	"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; "	\
+ 	"bootm"
+ 
++# include <stdint.h>
++
+ extern int   fw_printenv(int argc, char *argv[]);
+ extern char *fw_getenv  (char *name);
+ extern int fw_setenv  (int argc, char *argv[]);
+ 
+-extern unsigned	long  crc32	 (unsigned long, const unsigned char *, unsigned);
++extern uint32_t  uboot_crc32 (uint32_t, const unsigned char *, unsigned);
diff -pruN uboot-envtools.orig/patches/002-makefile.patch uboot-envtools/patches/002-makefile.patch
--- uboot-envtools.orig/patches/002-makefile.patch	2010-03-05 16:51:22.000000000 +0100
+++ uboot-envtools/patches/002-makefile.patch	2010-02-19 16:18:05.000000000 +0100
@@ -1,7 +1,5 @@
-Index: uboot-envtools-20080520/Makefile
-===================================================================
---- uboot-envtools-20080520.orig/Makefile	2008-08-03 15:50:27.000000000 +0200
-+++ uboot-envtools-20080520/Makefile	2008-08-03 15:51:59.000000000 +0200
+--- a/Makefile
++++ b/Makefile
 @@ -21,12 +21,10 @@
  # MA 02111-1307 USA
  #
@@ -12,11 +10,16 @@ Index: uboot-envtools-20080520/Makefile
  HEADERS	:= fw_env.h
  
 -CPPFLAGS := -Wall -DUSE_HOSTCC -I$(SRCTREE)/include
-+CPPFLAGS := -Wall -DUSE_HOSTCC -I/usr/include
++CPPFLAGS := -Wall $(CFLAGS)
  
  ifeq ($(MTD_VERSION),old)
  CPPFLAGS += -DMTD_OLD
-@@ -39,14 +37,3 @@
+@@ -35,18 +33,7 @@ endif
+ all:	$(obj)fw_printenv
+ 
+ $(obj)fw_printenv:	$(SRCS) $(HEADERS)
+-	$(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv
++	$(CC) $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv
  
  clean:
  	rm -f $(obj)fw_printenv $(obj)crc32.c
diff -pruN uboot-envtools.orig/patches/003-nor-eraselen.patch uboot-envtools/patches/003-nor-eraselen.patch
--- uboot-envtools.orig/patches/003-nor-eraselen.patch	1970-01-01 01:00:00.000000000 +0100
+++ uboot-envtools/patches/003-nor-eraselen.patch	2010-02-19 16:18:05.000000000 +0100
@@ -0,0 +1,14 @@
+--- a/fw_env.c
++++ b/fw_env.c
+@@ -605,7 +605,10 @@ static int flash_write_buf (int dev, int
+ 	erase_offset = offset & ~(blocklen - 1);
+ 
+ 	/* Maximum area we may use */
+-	erase_len = top_of_range - erase_offset;
++	if (mtd_type == MTD_NANDFLASH)
++		erase_len = top_of_range - erase_offset;
++	else
++		erase_len = blocklen;
+ 
+ 	blockstart = erase_offset;
+ 	/* Offset inside a block */
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to