summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-05-18 18:29:41 +0300
committerRoman Yeryomin <roman@advem.lv>2013-05-26 00:48:35 +0300
commit42c78b9ac70f512e4f5553fabe1383e23e52c26b (patch)
tree602e0c12be6eec9ad60ffd8c584e830978626a79
parentdc607fc63c0cccd6d36ff528ff355339666143bf (diff)
add realtek lzma hacks
Signed-off-by: Roman Yeryomin <roman@advem.lv>
-rw-r--r--target/linux/realtek/patches-2.6.30/0007-rsdk-3.2.4-kernel-lib.patch218
-rw-r--r--target/linux/realtek/patches-2.6.30/9994-unlzma-header-path-fix.patch11
2 files changed, 218 insertions, 11 deletions
diff --git a/target/linux/realtek/patches-2.6.30/0007-rsdk-3.2.4-kernel-lib.patch b/target/linux/realtek/patches-2.6.30/0007-rsdk-3.2.4-kernel-lib.patch
new file mode 100644
index 000000000..d8e49a14d
--- /dev/null
+++ b/target/linux/realtek/patches-2.6.30/0007-rsdk-3.2.4-kernel-lib.patch
@@ -0,0 +1,218 @@
+--- linux-2.6.30.9/lib/decompress_bunzip2.c 2009-10-05 18:38:08.000000000 +0300
++++ linux-2.6.30.9-rsdk/lib/decompress_bunzip2.c 2013-05-02 01:47:59.131226621 +0300
+@@ -45,12 +45,15 @@
+ */
+
+
+-#ifndef STATIC
++#ifdef STATIC
++#define PREBOOT
++#else
+ #include <linux/decompress/bunzip2.h>
+-#endif /* !STATIC */
++#include <linux/slab.h>
++#endif /* STATIC */
+
++#include <linux/decompress/bunzip2_mm.h>
+ #include <linux/decompress/mm.h>
+-#include <linux/slab.h>
+
+ #ifndef INT_MAX
+ #define INT_MAX 0x7fffffff
+@@ -681,9 +684,7 @@ STATIC int INIT bunzip2(unsigned char *b
+ set_error_fn(error_fn);
+ if (flush)
+ outbuf = malloc(BZIP2_IOBUF_SIZE);
+- else
+- len -= 4; /* Uncompressed size hack active in pre-boot
+- environment */
++
+ if (!outbuf) {
+ error("Could not allocate output bufer");
+ return -1;
+@@ -733,4 +734,14 @@ exit_0:
+ return i;
+ }
+
+-#define decompress bunzip2
++#ifdef PREBOOT
++STATIC int INIT decompress(unsigned char *buf, int len,
++ int(*fill)(void*, unsigned int),
++ int(*flush)(void*, unsigned int),
++ unsigned char *outbuf,
++ int *pos,
++ void(*error_fn)(char *x))
++{
++ return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn);
++}
++#endif
+--- linux-2.6.30.9/lib/decompress_inflate.c 2009-10-05 18:38:08.000000000 +0300
++++ linux-2.6.30.9-rsdk/lib/decompress_inflate.c 2013-05-02 01:47:59.131226621 +0300
+@@ -19,13 +19,19 @@
+ #include "zlib_inflate/inflate.h"
+
+ #include "zlib_inflate/infutil.h"
++#include <linux/slab.h>
+
+ #endif /* STATIC */
+
++#include <linux/decompress/inflate_mm.h>
+ #include <linux/decompress/mm.h>
+-#include <linux/slab.h>
+
+-#define INBUF_LEN (16*1024)
++#define GZIP_IOBUF_SIZE (16*1024)
++
++static int nofill(void *buffer, unsigned int len)
++{
++ return -1;
++}
+
+ /* Included from initramfs et al code */
+ STATIC int INIT gunzip(unsigned char *buf, int len,
+@@ -55,7 +61,7 @@ STATIC int INIT gunzip(unsigned char *bu
+ if (buf)
+ zbuf = buf;
+ else {
+- zbuf = malloc(INBUF_LEN);
++ zbuf = malloc(GZIP_IOBUF_SIZE);
+ len = 0;
+ }
+ if (!zbuf) {
+@@ -76,8 +82,11 @@ STATIC int INIT gunzip(unsigned char *bu
+ goto gunzip_nomem4;
+ }
+
++ if (!fill)
++ fill = nofill;
++
+ if (len == 0)
+- len = fill(zbuf, INBUF_LEN);
++ len = fill(zbuf, GZIP_IOBUF_SIZE);
+
+ /* verify the gzip header */
+ if (len < 10 ||
+@@ -113,7 +122,7 @@ STATIC int INIT gunzip(unsigned char *bu
+ while (rc == Z_OK) {
+ if (strm->avail_in == 0) {
+ /* TODO: handle case where both pos and fill are set */
+- len = fill(zbuf, INBUF_LEN);
++ len = fill(zbuf, GZIP_IOBUF_SIZE);
+ if (len < 0) {
+ rc = -1;
+ error("read error");
+--- linux-2.6.30.9/lib/decompress_unlzma.c 2009-10-05 18:38:08.000000000 +0300
++++ linux-2.6.30.9-rsdk/lib/decompress_unlzma.c 2013-05-02 01:47:59.132226621 +0300
+@@ -29,12 +29,15 @@
+ *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+-#ifndef STATIC
++#ifdef STATIC
++#define PREBOOT
++#else
+ #include <linux/decompress/unlzma.h>
++#include <linux/slab.h>
+ #endif /* STATIC */
+
++#include <linux/decompress/unlzma_mm.h>
+ #include <linux/decompress/mm.h>
+-#include <linux/slab.h>
+
+ #define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+@@ -80,6 +83,11 @@ struct rc {
+ #define RC_MODEL_TOTAL_BITS 11
+
+
++static int nofill(void *buffer, unsigned int len)
++{
++ return -1;
++}
++
+ /* Called twice: once at startup and once in rc_normalize() */
+ static void INIT rc_read(struct rc *rc)
+ {
+@@ -95,7 +103,10 @@ static inline void INIT rc_init(struct r
+ int (*fill)(void*, unsigned int),
+ char *buffer, int buffer_size)
+ {
++ if (fill)
+ rc->fill = fill;
++ else
++ rc->fill = nofill;
+ rc->buffer = (uint8_t *)buffer;
+ rc->buffer_size = buffer_size;
+ rc->buffer_end = rc->buffer + rc->buffer_size;
+@@ -521,7 +532,7 @@ static inline void INIT process_bit1(str
+
+
+
+-STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
++STATIC int INIT unlzma(unsigned char *buf, int in_len,
+ int(*fill)(void*, unsigned int),
+ int(*flush)(void*, unsigned int),
+ unsigned char *output,
+@@ -543,9 +554,7 @@ STATIC inline int INIT unlzma(unsigned c
+ int ret = -1;
+
+ set_error_fn(error_fn);
+- if (!flush)
+- in_len -= 4; /* Uncompressed size hack active in pre-boot
+- environment */
++
+ if (buf)
+ inbuf = buf;
+ else
+@@ -645,4 +654,17 @@ exit_0:
+ return ret;
+ }
+
+-#define decompress unlzma
++#ifdef PREBOOT
++STATIC int INIT decompress(unsigned char *buf, int in_len,
++ int(*fill)(void*, unsigned int),
++ int(*flush)(void*, unsigned int),
++ unsigned char *output,
++ int *posp,
++ void(*error_fn)(char *x)
++ )
++{
++ return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn);
++}
++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED)
++EXPORT_SYMBOL(unlzma);
++#endif
+--- linux-2.6.30.9/lib/Kconfig 2009-10-05 18:38:08.000000000 +0300
++++ linux-2.6.30.9-rsdk/lib/Kconfig 2013-05-02 01:47:59.126226621 +0300
+@@ -10,6 +10,9 @@ menu "Library routines"
+ config BITREVERSE
+ tristate
+
++config RATIONAL
++ boolean
++
+ config GENERIC_FIND_FIRST_BIT
+ bool
+
+@@ -114,6 +117,9 @@ config DECOMPRESS_BZIP2
+ config DECOMPRESS_LZMA
+ tristate
+
++config DECOMPRESS_LZMA_NEEDED
++ boolean
++
+ #
+ # Generic allocator support is selected if needed
+ #
+@@ -191,4 +197,10 @@ config DISABLE_OBSOLETE_CPUMASK_FUNCTION
+ config NLATTR
+ bool
+
++#
++# Generic 64-bit atomic support is selected if needed
++#
++config GENERIC_ATOMIC64
++ bool
++
+ endmenu
diff --git a/target/linux/realtek/patches-2.6.30/9994-unlzma-header-path-fix.patch b/target/linux/realtek/patches-2.6.30/9994-unlzma-header-path-fix.patch
deleted file mode 100644
index 4032c4fd8..000000000
--- a/target/linux/realtek/patches-2.6.30/9994-unlzma-header-path-fix.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/lib/decompress_unlzma.c 2013-05-16 19:41:49.499019157 +0300
-+++ b/lib/decompress_unlzma.c 2013-05-16 18:10:42.178461709 +0300
-@@ -30,7 +30,7 @@
- */
-
- #ifndef STATIC
--#include <linux/decompress/unlzma.h>
-+#include <linux/decompress/unlzma_mm.h>
- #endif /* STATIC */
-
- #include <linux/decompress/mm.h>