Root/package/boot/uboot-envtools/patches/001-crc32_func_signature.patch

1--- a/crc32.c
2+++ b/crc32.c
3@@ -8,21 +8,16 @@
4  * For conditions of distribution and use, see copyright notice in zlib.h
5  */
6 
7-#ifndef USE_HOSTCC
8-#include <common.h>
9-#endif
10-#include <compiler.h>
11-#include <u-boot/crc.h>
12+#include <stdint.h>
13+#include <asm/byteorder.h>
14+
15+#include "zlib.h"
16 
17-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
18-#include <watchdog.h>
19-#endif
20-#include "u-boot/zlib.h"
21 
22 #define local static
23 #define ZEXPORT /* empty */
24 
25-#define tole(x) cpu_to_le32(x)
26+#define tole(x) __constant_cpu_to_le32(x)
27 
28 #ifdef DYNAMIC_CRC_TABLE
29 
30@@ -151,7 +146,7 @@ tole(0xb40bbe37L), tole(0xc30c8ea1L), to
31 
32 #if 0
33 /* =========================================================================
34- * This function can be used by asm versions of crc32()
35+ * This function can be used by asm versions of uboot_crc32()
36  */
37 const uint32_t * ZEXPORT get_crc_table()
38 {
39@@ -183,7 +178,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t
40     if (crc_table_empty)
41       make_crc_table();
42 #endif
43- crc = cpu_to_le32(crc);
44+ crc = __cpu_to_le32(crc);
45     /* Align it */
46     if (((long)b) & 3 && len) {
47      uint8_t *p = (uint8_t *)b;
48@@ -212,11 +207,11 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t
49      } while (--len);
50     }
51 
52- return le32_to_cpu(crc);
53+ return __le32_to_cpu(crc);
54 }
55 #undef DO_CRC
56 
57-uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *p, uInt len)
58+uint32_t ZEXPORT uboot_crc32 (uint32_t crc, const Bytef *p, uInt len)
59 {
60      return crc32_no_comp(crc ^ 0xffffffffL, p, len) ^ 0xffffffffL;
61 }
62@@ -239,12 +234,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
63         chunk = end - curr;
64         if (chunk > chunk_sz)
65             chunk = chunk_sz;
66- crc = crc32 (crc, curr, chunk);
67+ crc = uboot_crc32 (crc, curr, chunk);
68         curr += chunk;
69         WATCHDOG_RESET ();
70     }
71 #else
72- crc = crc32 (crc, buf, len);
73+ crc = uboot_crc32 (crc, buf, len);
74 #endif
75 
76     return crc;
77--- a/fw_env.c
78+++ b/fw_env.c
79@@ -34,6 +34,7 @@
80 #include <sys/ioctl.h>
81 #include <sys/stat.h>
82 #include <unistd.h>
83+#include <zlib.h>
84 
85 #ifdef MTD_OLD
86 # include <stdint.h>
87@@ -212,13 +213,14 @@ static char default_environment[] = {
88 static int flash_io (int mode);
89 static char *envmatch (char * s1, char * s2);
90 static int parse_config (void);
91+uint32_t uboot_crc32 (uint32_t crc, const Bytef *p, uInt len);
92 
93 #if defined(CONFIG_FILE)
94 static int get_config (char *);
95 #endif
96-static inline ulong getenvsize (void)
97+static inline uint32_t getenvsize (void)
98 {
99- ulong rc = CONFIG_ENV_SIZE - sizeof (long);
100+ uint32_t rc = CONFIG_ENV_SIZE - sizeof (uint32_t);
101 
102     if (HaveRedundEnv)
103         rc -= sizeof (char);
104@@ -348,7 +350,7 @@ int fw_env_close(void)
105     /*
106      * Update CRC
107      */
108- *environment.crc = crc32(0, (uint8_t *) environment.data, ENV_SIZE);
109+ *environment.crc = uboot_crc32(0, (uint8_t *) environment.data, ENV_SIZE);
110 
111     /* write environment back to flash */
112     if (flash_io(O_RDWR)) {
113@@ -1116,7 +1118,7 @@ int fw_env_open(void)
114     if (flash_io (O_RDONLY))
115         return -1;
116 
117- crc0 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
118+ crc0 = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
119     crc0_ok = (crc0 == *environment.crc);
120     if (!HaveRedundEnv) {
121         if (!crc0_ok) {
122@@ -1160,7 +1162,7 @@ int fw_env_open(void)
123             return -1;
124         }
125 
126- crc1 = crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
127+ crc1 = uboot_crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
128         crc1_ok = (crc1 == redundant->crc);
129         flag1 = redundant->flags;
130 
131

Archive Download this file



interactive