lib: zlib: include deflate into zlib build
authorLei Wen <adrian.wenl@gmail.com>
Fri, 28 Sep 2012 04:26:44 +0000 (04:26 +0000)
committerTom Rini <trini@ti.com>
Sat, 29 Sep 2012 14:26:08 +0000 (07:26 -0700)
Add a new config CONFIG_GZIP_ENABLED, if enabled, the uboot bin would
include zlib's deflate method which could be used for compressing.

Signed-off-by: Lei Wen <leiwen@marvell.com>
include/u-boot/zlib.h
lib/zlib/trees.c
lib/zlib/zlib.c
lib/zlib/zutil.h

index fbb08a32879e68b102cb9d1bdff1ca5aaf488ed3..b611fe7c799302e6c3bd79e4670347ea8eb9ca79 100644 (file)
@@ -513,11 +513,41 @@ typedef gz_header FAR *gz_headerp;
    If the first character differs, the library code actually used is
    not compatible with the zlib.h header file used by the application.
    This check is automatically made by deflateInit and inflateInit.
    If the first character differs, the library code actually used is
    not compatible with the zlib.h header file used by the application.
    This check is automatically made by deflateInit and inflateInit.
- */
-
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version,
-                               int stream_size));
-
+   */
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                       const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                       int windowBits, int memLevel,
+                       int strategy, const char *version,
+                       int stream_size));
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                       const Bytef *dictionary,
+                       uInt  dictLength));
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+                       gz_headerp head));
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                       int bits,
+                       int value));
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                       int level,
+                       int strategy));
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+                       int good_length,
+                       int max_lazy,
+                       int nice_length,
+                       int max_chain));
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                       uLong sourceLen));
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                       z_streamp source));
+
+
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                       const char *version, int stream_size));
 ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
 /*
     inflate decompresses as much data as possible, and stops when the input
 ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
 /*
     inflate decompresses as much data as possible, and stops when the input
index 56e9bb1c115e81082f58a89b003b766760e12a12..a0078d08ee039a14575cb87257b099b925878ee9 100644 (file)
@@ -1168,14 +1168,14 @@ local int detect_data_type(s)
  * method would use a table)
  * IN assertion: 1 <= len <= 15
  */
  * method would use a table)
  * IN assertion: 1 <= len <= 15
  */
-local unsigned bi_reverse(code, len)
-    unsigned code; /* the value to invert */
+local unsigned bi_reverse(value, len)
+    unsigned value; /* the value to invert */
     int len;       /* its bit length */
 {
     register unsigned res = 0;
     do {
     int len;       /* its bit length */
 {
     register unsigned res = 0;
     do {
-        res |= code & 1;
-        code >>= 1, res <<= 1;
+        res |= value & 1;
+        value >>= 1, res <<= 1;
     } while (--len > 0);
     return res >> 1;
 }
     } while (--len > 0);
     return res >> 1;
 }
index 230d0df6822badff9b2481a82a3fe505c359facb..7e1570292c39a761c615109d8c561ec888a21c98 100644 (file)
  * - added inflateIncomp
  */
 
  * - added inflateIncomp
  */
 
+#include <common.h>
+
+#ifdef CONFIG_GZIP_COMPRESSED
+#define NO_DUMMY_DECL
+#include "deflate.c"
+#include "trees.c"
+#endif
+
 #include "zutil.h"
 #include "inftrees.h"
 #include "inflate.h"
 #include "zutil.h"
 #include "inftrees.h"
 #include "inflate.h"
index 114cb744e0cd878ff143eecb6bf0dfd58c8a4d49..7e05c3b5642fbd075cb8b3ebb4efae832b0132e3 100644 (file)
@@ -83,6 +83,10 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 /* The minimum and maximum match lengths */
 
         /* functions */
 /* The minimum and maximum match lengths */
 
         /* functions */
+#ifdef CONFIG_GZIP_COMPRESSED
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+#  define OS_CODE  0x03  /* assume Unix */
+#endif
 
 #include <linux/string.h>
 #define zmemcpy memcpy
 
 #include <linux/string.h>
 #define zmemcpy memcpy