diff options
author | John Crispin <john@openwrt.org> | 2012-10-16 13:44:25 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2012-10-16 13:44:25 +0000 |
commit | e75106aa0d82a64122954b5990b50ec80d8e4040 (patch) | |
tree | bcc8ab60e849b3a0debb601b13c7f5356d9683e8 /package/boot/uboot-envtools/patches/001-crc32_func_signature.patch | |
parent | 254d851d8a9434e9c8a12a6ec96538ba13101600 (diff) | |
download | mtk-20170518-e75106aa0d82a64122954b5990b50ec80d8e4040.zip mtk-20170518-e75106aa0d82a64122954b5990b50ec80d8e4040.tar.gz mtk-20170518-e75106aa0d82a64122954b5990b50ec80d8e4040.tar.bz2 |
move boot related packages to their own folder
SVN-Revision: 33781
Diffstat (limited to 'package/boot/uboot-envtools/patches/001-crc32_func_signature.patch')
-rw-r--r-- | package/boot/uboot-envtools/patches/001-crc32_func_signature.patch | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/package/boot/uboot-envtools/patches/001-crc32_func_signature.patch b/package/boot/uboot-envtools/patches/001-crc32_func_signature.patch new file mode 100644 index 0000000..f68f29e --- /dev/null +++ b/package/boot/uboot-envtools/patches/001-crc32_func_signature.patch @@ -0,0 +1,130 @@ +--- a/crc32.c ++++ b/crc32.c +@@ -8,21 +8,16 @@ + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +-#ifndef USE_HOSTCC +-#include <common.h> +-#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) +-#include <watchdog.h> +-#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 + /* ========================================================================= +- * 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() + { +@@ -183,7 +178,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t + if (crc_table_empty) + 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; + 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 +@@ -34,6 +34,7 @@ + #include <sys/ioctl.h> + #include <sys/stat.h> + #include <unistd.h> ++#include <zlib.h> + + #ifdef MTD_OLD + # include <stdint.h> +@@ -212,13 +213,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) + 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); +@@ -348,7 +350,7 @@ int fw_env_close(void) + /* + * 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)) { +@@ -1116,7 +1118,7 @@ int fw_env_open(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) { +@@ -1160,7 +1162,7 @@ int fw_env_open(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; + |