aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2010-01-11 11:04:30 +0000
committerLars-Peter Clausen <lars@metafoo.de>2010-01-11 11:04:30 +0000
commit01b610be12cbd67281ffd96690a87dc97bbc2ef0 (patch)
treefa60b6427a29648fa9016b68b19e04250f2a47a9 /tools
parentfbc1a0f4c12b44703de3171b26c9b954360b68f9 (diff)
downloadmaster-187ad058-01b610be12cbd67281ffd96690a87dc97bbc2ef0.tar.gz
master-187ad058-01b610be12cbd67281ffd96690a87dc97bbc2ef0.tar.bz2
master-187ad058-01b610be12cbd67281ffd96690a87dc97bbc2ef0.zip
mtd-utils: Disable lzo for mkfs.ubifs
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19104 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools')
-rw-r--r--tools/mtd-utils/patches/101-ubifs-optional_lzo.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch b/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch
new file mode 100644
index 0000000000..35a7cd86f5
--- /dev/null
+++ b/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch
@@ -0,0 +1,79 @@
+diff --git a/mkfs.ubifs/Makefile b/mkfs.ubifs/Makefile
+index a678b0a..919ce89 100644
+--- a/mkfs.ubifs/Makefile
++++ b/mkfs.ubifs/Makefile
+@@ -5,7 +5,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
+
+ TARGETS = mkfs.ubifs
+
+-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L../ubi-utils/ -lubi
++LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L../ubi-utils/ -lubi
+
+ include ../common.mk
+
+diff --git a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c
+index e378c5d..0208f80 100644
+--- a/mkfs.ubifs/compr.c
++++ b/mkfs.ubifs/compr.c
+@@ -83,6 +83,17 @@ static int zlib_deflate(void *in_buf, size_t in_len, void *out_buf,
+ return 0;
+ }
+
++static int no_compress(void *in_buf, size_t in_len, void *out_buf,
++ size_t *out_len)
++{
++ memcpy(out_buf, in_buf, in_len);
++ *out_len = in_len;
++ return 0;
++}
++
++
++#if CONFIG_UBIFS_LZO
++
+ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
+ size_t *out_len)
+ {
+@@ -101,14 +112,16 @@ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
+ return 0;
+ }
+
+-static int no_compress(void *in_buf, size_t in_len, void *out_buf,
+- size_t *out_len)
++#else
++
++static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
++ size_t *out_len)
+ {
+- memcpy(out_buf, in_buf, in_len);
+- *out_len = in_len;
+- return 0;
++ return -1;
+ }
+
++#endif
++
+ static char *zlib_buf;
+
+ static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf,
+@@ -195,9 +208,11 @@ int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
+
+ int init_compression(void)
+ {
++#ifdef CONFIG_UBIFS_LZO
+ lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
+ if (!lzo_mem)
+ return -1;
++#endif
+
+ zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
+ if (!zlib_buf) {
+@@ -211,7 +226,9 @@ int init_compression(void)
+ void destroy_compression(void)
+ {
+ free(zlib_buf);
++#ifdef CONFIG_UBIFS_LZO
+ free(lzo_mem);
++#endif
+ if (errcnt)
+ fprintf(stderr, "%llu compression errors occurred\n", errcnt);
+ }