summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--common/image.c2
-rw-r--r--include/common.h4
-rw-r--r--include/environment.h11
-rw-r--r--lib_generic/crc32.c19
-rw-r--r--tools/Makefile6
-rw-r--r--tools/envcrc.c9
7 files changed, 32 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 94c21cc1bf..6f1409fc1d 100644
--- a/Makefile
+++ b/Makefile
@@ -2992,7 +2992,7 @@ clobber: clean
$(obj)cscope.* $(obj)*.*~
@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
@rm -f $(obj)tools/{crc32.c,environment.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
- @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c}
+ @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
diff --git a/common/image.c b/common/image.c
index d218f2f88b..8e72db1ef1 100644
--- a/common/image.c
+++ b/common/image.c
@@ -155,7 +155,7 @@ static table_entry_t uimage_comp[] = {
{ -1, "", "", },
};
-unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
+uint32_t crc32 (uint32_t, const unsigned char *, uint);
static void genimg_print_size (uint32_t size);
#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC)
static void genimg_print_time (time_t timestamp);
diff --git a/include/common.h b/include/common.h
index 8630780e92..aea181e2ab 100644
--- a/include/common.h
+++ b/include/common.h
@@ -604,8 +604,8 @@ int sprintf(char * buf, const char *fmt, ...);
int vsprintf(char *buf, const char *fmt, va_list args);
/* lib_generic/crc32.c */
-ulong crc32 (ulong, const unsigned char *, uint);
-ulong crc32_no_comp (ulong, const unsigned char *, uint);
+uint32_t crc32 (uint32_t, const unsigned char *, uint);
+uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint);
/* common/console.c */
int console_init_f(void); /* Before relocation; uses the serial stuff */
diff --git a/include/environment.h b/include/environment.h
index af605ab7a9..c4f7c33be6 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -84,18 +84,23 @@
# endif
#endif /* CFG_ENV_IS_IN_NAND */
+#ifdef USE_HOSTCC
+# include <stdint.h>
+#else
+# include <linux/types.h>
+#endif
#ifdef CFG_REDUNDAND_ENVIRONMENT
-# define ENV_HEADER_SIZE (sizeof(unsigned long) + 1)
+# define ENV_HEADER_SIZE (sizeof(uint32_t) + 1)
#else
-# define ENV_HEADER_SIZE (sizeof(unsigned long))
+# define ENV_HEADER_SIZE (sizeof(uint32_t))
#endif
#define ENV_SIZE (CFG_ENV_SIZE - ENV_HEADER_SIZE)
typedef struct environment_s {
- unsigned long crc; /* CRC32 over data bytes */
+ uint32_t crc; /* CRC32 over data bytes */
#ifdef CFG_REDUNDAND_ENVIRONMENT
unsigned char flags; /* active/obsolete flags */
#endif
diff --git a/lib_generic/crc32.c b/lib_generic/crc32.c
index df0dbca346..b882daa10d 100644
--- a/lib_generic/crc32.c
+++ b/lib_generic/crc32.c
@@ -10,18 +10,19 @@
#ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */
#include <common.h>
+#else
+#include <stdint.h>
#endif
#include "zlib.h"
#define local static
#define ZEXPORT /* empty */
-unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
#ifdef DYNAMIC_CRC_TABLE
local int crc_table_empty = 1;
-local uLongf crc_table[256];
+local uint32_t crc_table[256];
local void make_crc_table OF((void));
/*
@@ -50,7 +51,7 @@ local void make_crc_table OF((void));
*/
local void make_crc_table()
{
- uLong c;
+ uint32_t c;
int n, k;
uLong poly; /* polynomial exclusive-or pattern */
/* terms of polynomial defining this crc (except x^32): */
@@ -74,7 +75,7 @@ local void make_crc_table()
/* ========================================================================
* Table of CRC-32's of all single-byte values (made by make_crc_table)
*/
-local const uLongf crc_table[256] = {
+local const uint32_t crc_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
@@ -134,12 +135,12 @@ local const uLongf crc_table[256] = {
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
-const uLongf * ZEXPORT get_crc_table()
+const uint32_t * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty) make_crc_table();
#endif
- return (const uLongf *)crc_table;
+ return (const uint32_t *)crc_table;
}
#endif
@@ -150,8 +151,8 @@ const uLongf * ZEXPORT get_crc_table()
#define DO8(buf) DO4(buf); DO4(buf);
/* ========================================================================= */
-uLong ZEXPORT crc32(crc, buf, len)
- uLong crc;
+uint32_t ZEXPORT crc32(crc, buf, len)
+ uint32_t crc;
const Bytef *buf;
uInt len;
{
@@ -178,7 +179,7 @@ uLong ZEXPORT crc32(crc, buf, len)
/* No ones complement version. JFFS2 (and other things ?)
* don't use ones compliment in their CRC calculations.
*/
-uLong ZEXPORT crc32_no_comp(uLong crc, const Bytef *buf, uInt len)
+uint32_t ZEXPORT crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
diff --git a/tools/Makefile b/tools/Makefile
index 8784a6d5c2..b89792327d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -236,7 +236,11 @@ $(obj)environment.c:
$(obj)environment.o: $(obj)environment.c
$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
-$(obj)crc32.c:
+$(obj)zlib.h:
+ @rm -f $@
+ ln -s $(src)../include/zlib.h $@
+
+$(obj)crc32.c: $(obj)zlib.h
@rm -f $(obj)crc32.c
ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
diff --git a/tools/envcrc.c b/tools/envcrc.c
index 7b7718324e..550cf82d17 100644
--- a/tools/envcrc.c
+++ b/tools/envcrc.c
@@ -22,6 +22,7 @@
*/
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
@@ -58,15 +59,15 @@
#endif /* CFG_ENV_IS_IN_FLASH */
#ifdef CFG_REDUNDAND_ENVIRONMENT
-# define ENV_HEADER_SIZE (sizeof(unsigned long) + 1)
+# define ENV_HEADER_SIZE (sizeof(uint32_t) + 1)
#else
-# define ENV_HEADER_SIZE (sizeof(unsigned long))
+# define ENV_HEADER_SIZE (sizeof(uint32_t))
#endif
#define ENV_SIZE (CFG_ENV_SIZE - ENV_HEADER_SIZE)
-extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
+extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int);
#ifdef ENV_IS_EMBEDDED
extern unsigned int env_size;
@@ -76,7 +77,7 @@ extern unsigned char environment;
int main (int argc, char **argv)
{
#ifdef ENV_IS_EMBEDDED
- int crc;
+ uint32_t crc;
unsigned char *envptr = &environment,
*dataptr = envptr + ENV_HEADER_SIZE;
unsigned int datasize = ENV_SIZE;