mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-27 17:15:00 +02:00
package/u-boot-envtools: update to version 2011.06.
This updates uboot-envtools to the version which comes with U-Boot 2011.06. The important novelity is that fw_setenv now supports batch processing, which greatly improves sysupgrade of the ALL0258N as otherwise we would have to overwrite uboot-env up to 8x in a single firmware upgrade. Unfortunately, no newer version of the sources is available from Debian, so we got to take it from the u-boot source which is kinda ugly... Signed-off-by: Daniel Golle <dgolle@allnet.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28566 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
0475f34e05
commit
8d5c50e5f6
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2006-2010 OpenWrt.org
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
@ -8,14 +8,18 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=uboot-envtools
|
PKG_NAME:=uboot-envtools
|
||||||
PKG_VERSION:=20081215
|
PKG_DISTNAME:=u-boot
|
||||||
PKG_RELEASE:=2
|
PKG_VERSION:=2011.06
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
|
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/u/uboot-envtools/
|
PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
|
||||||
|
PKG_MD5SUM:=
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
TAR_OPTIONS+= --strip-components=3 -C $(PKG_BUILD_DIR) $(PKG_DISTNAME)-$(PKG_VERSION)/tools/env
|
||||||
|
|
||||||
define Package/uboot-envtools
|
define Package/uboot-envtools
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
@ -34,4 +38,10 @@ define Package/uboot-envtools/install
|
|||||||
ln -sf fw_printenv $(1)/usr/sbin/fw_setenv
|
ln -sf fw_printenv $(1)/usr/sbin/fw_setenv
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
mkdir -p $(PKG_BUILD_DIR)
|
||||||
|
tar xvjf $(DL_DIR)/$(PKG_SOURCE) --strip-components=2 -C $(PKG_BUILD_DIR) $(PKG_DISTNAME)-$(PKG_VERSION)/lib/crc32.c
|
||||||
|
$(call Build/Prepare/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,uboot-envtools))
|
$(eval $(call BuildPackage,uboot-envtools))
|
||||||
|
@ -1,18 +1,33 @@
|
|||||||
--- a/crc32.c
|
--- a/crc32.c
|
||||||
+++ b/crc32.c
|
+++ b/crc32.c
|
||||||
@@ -8,11 +8,7 @@
|
@@ -8,21 +8,16 @@
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
-#ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */
|
-#ifndef USE_HOSTCC
|
||||||
-#include <common.h>
|
-#include <common.h>
|
||||||
-#else
|
|
||||||
#include <stdint.h>
|
|
||||||
-#endif
|
-#endif
|
||||||
|
-#include <compiler.h>
|
||||||
|
-#include <u-boot/crc.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
+#include <asm/byteorder.h>
|
||||||
|
+
|
||||||
|
+#include "zlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||||
#include <watchdog.h>
|
-#include <watchdog.h>
|
||||||
@@ -136,7 +132,7 @@ local const uint32_t crc_table[256] = {
|
-#endif
|
||||||
|
-#include "u-boot/zlib.h"
|
||||||
|
|
||||||
|
#define local static
|
||||||
|
#define ZEXPORT /* empty */
|
||||||
|
|
||||||
|
-#define tole(x) cpu_to_le32(x)
|
||||||
|
+#define tole(x) __constant_cpu_to_le32(x)
|
||||||
|
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
|
||||||
|
@@ -151,7 +146,7 @@ tole(0xb40bbe37L), tole(0xc30c8ea1L), to
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
@ -21,16 +36,30 @@
|
|||||||
*/
|
*/
|
||||||
const uint32_t * ZEXPORT get_crc_table()
|
const uint32_t * ZEXPORT get_crc_table()
|
||||||
{
|
{
|
||||||
@@ -154,7 +150,7 @@ const uint32_t * ZEXPORT get_crc_table()
|
@@ -183,7 +178,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t
|
||||||
#define DO8(buf) DO4(buf); DO4(buf);
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
-uint32_t ZEXPORT crc32 (uint32_t 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)
|
if (crc_table_empty)
|
||||||
@@ -217,12 +213,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
|
make_crc_table();
|
||||||
|
#endif
|
||||||
|
- crc = cpu_to_le32(crc);
|
||||||
|
+ crc = __cpu_to_le32(crc);
|
||||||
|
/* Align it */
|
||||||
|
if (((long)b) & 3 && len) {
|
||||||
|
uint8_t *p = (uint8_t *)b;
|
||||||
|
@@ -212,11 +207,11 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t
|
||||||
|
} while (--len);
|
||||||
|
}
|
||||||
|
|
||||||
|
- return le32_to_cpu(crc);
|
||||||
|
+ return __le32_to_cpu(crc);
|
||||||
|
}
|
||||||
|
#undef DO_CRC
|
||||||
|
|
||||||
|
-uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *p, uInt len)
|
||||||
|
+uint32_t ZEXPORT uboot_crc32 (uint32_t crc, const Bytef *p, uInt len)
|
||||||
|
{
|
||||||
|
return crc32_no_comp(crc ^ 0xffffffffL, p, len) ^ 0xffffffffL;
|
||||||
|
}
|
||||||
|
@@ -239,12 +234,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
|
||||||
chunk = end - curr;
|
chunk = end - curr;
|
||||||
if (chunk > chunk_sz)
|
if (chunk > chunk_sz)
|
||||||
chunk = chunk_sz;
|
chunk = chunk_sz;
|
||||||
@ -47,7 +76,20 @@
|
|||||||
return crc;
|
return crc;
|
||||||
--- a/fw_env.c
|
--- a/fw_env.c
|
||||||
+++ b/fw_env.c
|
+++ b/fw_env.c
|
||||||
@@ -216,9 +216,9 @@ static int parse_config (void);
|
@@ -34,6 +34,7 @@
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
+#include <zlib.h>
|
||||||
|
|
||||||
|
#ifdef MTD_OLD
|
||||||
|
# include <stdint.h>
|
||||||
|
@@ -210,13 +211,14 @@ static char default_environment[] = {
|
||||||
|
static int flash_io (int mode);
|
||||||
|
static char *envmatch (char * s1, char * s2);
|
||||||
|
static int parse_config (void);
|
||||||
|
+uint32_t uboot_crc32 (uint32_t crc, const Bytef *p, uInt len);
|
||||||
|
|
||||||
#if defined(CONFIG_FILE)
|
#if defined(CONFIG_FILE)
|
||||||
static int get_config (char *);
|
static int get_config (char *);
|
||||||
#endif
|
#endif
|
||||||
@ -59,16 +101,16 @@
|
|||||||
|
|
||||||
if (HaveRedundEnv)
|
if (HaveRedundEnv)
|
||||||
rc -= sizeof (char);
|
rc -= sizeof (char);
|
||||||
@@ -437,7 +437,7 @@ int fw_setenv (int argc, char *argv[])
|
@@ -346,7 +348,7 @@ int fw_env_close(void)
|
||||||
/*
|
/*
|
||||||
* Update CRC
|
* Update CRC
|
||||||
*/
|
*/
|
||||||
- *environment.crc = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
|
- *environment.crc = crc32(0, (uint8_t *) environment.data, ENV_SIZE);
|
||||||
+ *environment.crc = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
|
+ *environment.crc = uboot_crc32(0, (uint8_t *) environment.data, ENV_SIZE);
|
||||||
|
|
||||||
/* write environment back to flash */
|
/* write environment back to flash */
|
||||||
if (flash_io (O_RDWR)) {
|
if (flash_io(O_RDWR)) {
|
||||||
@@ -627,7 +627,7 @@ static int flash_write_buf (int dev, int
|
@@ -802,7 +804,7 @@ static int flash_write_buf (int dev, int
|
||||||
data = malloc (erase_len);
|
data = malloc (erase_len);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
@ -77,21 +119,7 @@
|
|||||||
erase_len, strerror (errno));
|
erase_len, strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -883,11 +883,11 @@ static char *envmatch (char * s1, char *
|
@@ -1107,7 +1109,7 @@ int fw_env_open(void)
|
||||||
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))
|
if (flash_io (O_RDONLY))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -100,7 +128,7 @@
|
|||||||
crc0_ok = (crc0 == *environment.crc);
|
crc0_ok = (crc0 == *environment.crc);
|
||||||
if (!HaveRedundEnv) {
|
if (!HaveRedundEnv) {
|
||||||
if (!crc0_ok) {
|
if (!crc0_ok) {
|
||||||
@@ -964,7 +964,7 @@ static int env_init (void)
|
@@ -1151,7 +1153,7 @@ int fw_env_open(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,17 +137,3 @@
|
|||||||
crc1_ok = (crc1 == redundant->crc);
|
crc1_ok = (crc1 == redundant->crc);
|
||||||
flag1 = redundant->flags;
|
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);
|
|
||||||
|
@ -1,31 +1,39 @@
|
|||||||
--- a/Makefile
|
--- a/Makefile
|
||||||
+++ b/Makefile
|
+++ b/Makefile
|
||||||
@@ -21,12 +21,10 @@
|
@@ -21,37 +21,16 @@
|
||||||
# MA 02111-1307 USA
|
# MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
-include $(TOPDIR)/config.mk
|
-include $(TOPDIR)/config.mk
|
||||||
-
|
-
|
||||||
SRCS := $(obj)crc32.c fw_env.c fw_env_main.c
|
-HOSTSRCS := $(obj)crc32.c fw_env.c fw_env_main.c
|
||||||
|
+SRCS := crc32.c fw_env.c fw_env_main.c
|
||||||
HEADERS := fw_env.h
|
HEADERS := fw_env.h
|
||||||
|
|
||||||
-CPPFLAGS := -Wall -DUSE_HOSTCC -I$(SRCTREE)/include
|
-# Compile for a hosted environment on the target
|
||||||
|
-HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
|
||||||
|
- -idirafter $(OBJTREE)/include2 \
|
||||||
|
- -idirafter $(OBJTREE)/include \
|
||||||
|
- -DUSE_HOSTCC
|
||||||
|
-
|
||||||
|
-ifeq ($(MTD_VERSION),old)
|
||||||
|
-HOSTCPPFLAGS += -DMTD_OLD
|
||||||
|
-endif
|
||||||
+CPPFLAGS := -Wall $(CFLAGS)
|
+CPPFLAGS := -Wall $(CFLAGS)
|
||||||
|
|
||||||
ifeq ($(MTD_VERSION),old)
|
|
||||||
CPPFLAGS += -DMTD_OLD
|
|
||||||
@@ -35,18 +33,7 @@ endif
|
|
||||||
all: $(obj)fw_printenv
|
all: $(obj)fw_printenv
|
||||||
|
|
||||||
$(obj)fw_printenv: $(SRCS) $(HEADERS)
|
# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
|
||||||
- $(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv
|
-$(obj)fw_printenv: $(HOSTSRCS) $(HEADERS)
|
||||||
|
- $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS)
|
||||||
|
+$(obj)fw_printenv: $(SRCS) $(HEADERS)
|
||||||
+ $(CC) $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv
|
+ $(CC) $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(obj)fw_printenv $(obj)crc32.c
|
- rm -f $(obj)fw_printenv $(obj)crc32.c
|
||||||
-
|
-
|
||||||
-$(obj)crc32.c:
|
-$(obj)crc32.c:
|
||||||
- ln -s $(src)../../lib_generic/crc32.c $(obj)crc32.c
|
- ln -s $(src)../../lib/crc32.c $(obj)crc32.c
|
||||||
-
|
-
|
||||||
-#########################################################################
|
-#########################################################################
|
||||||
-
|
-
|
||||||
@ -34,3 +42,4 @@
|
|||||||
-sinclude $(obj).depend
|
-sinclude $(obj).depend
|
||||||
-
|
-
|
||||||
-#########################################################################
|
-#########################################################################
|
||||||
|
+ rm -f $(obj)fw_printenv
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
--- a/fw_env.c
|
--- a/fw_env.c
|
||||||
+++ b/fw_env.c
|
+++ b/fw_env.c
|
||||||
@@ -605,7 +605,10 @@ static int flash_write_buf (int dev, int
|
@@ -779,7 +779,10 @@ static int flash_write_buf (int dev, int
|
||||||
erase_offset = offset & ~(blocklen - 1);
|
erase_offset = (offset / blocklen) * blocklen;
|
||||||
|
|
||||||
/* Maximum area we may use */
|
/* Maximum area we may use */
|
||||||
- erase_len = top_of_range - erase_offset;
|
- erase_len = top_of_range - erase_offset;
|
||||||
|
Loading…
Reference in New Issue
Block a user