mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
tools/mtd-utils: update to 1.4.5
This updates mtd-utils in tools: 100-optional_lzo.patch and 101-ubifs-optional_lzo.patch are now uneeded as a WITHOUT_LZO flag is provided by the upstream sources. All remaining patches are refreshed for the new version. 135-mkubifs_optional_lzo.patch was created to respect WITHOUT_LZO also in mkubifs. Signed-off-by: Daniel Golle <dgolle@allnet.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30769 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
--- a/mkfs.ubifs/Makefile
|
||||
+++ b/mkfs.ubifs/Makefile
|
||||
@@ -6,7 +6,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
|
||||
|
||||
TARGETS = mkfs.ubifs
|
||||
|
||||
-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
|
||||
+LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
|
||||
LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32
|
||||
LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
|
||||
|
||||
--- a/mkfs.ubifs/compr.c
|
||||
+++ b/mkfs.ubifs/compr.c
|
||||
@@ -24,7 +24,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
+#if CONFIG_UBIFS_LZO
|
||||
#include <lzo/lzo1x.h>
|
||||
+#endif
|
||||
#include <linux/types.h>
|
||||
|
||||
#define crc32 __zlib_crc32
|
||||
@@ -86,6 +88,16 @@ static int zlib_deflate(void *in_buf, si
|
||||
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)
|
||||
{
|
||||
@@ -104,14 +116,16 @@ static int lzo_compress(void *in_buf, si
|
||||
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,
|
||||
@@ -198,9 +212,11 @@ int compress_data(void *in_buf, size_t i
|
||||
|
||||
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) {
|
||||
@@ -214,7 +230,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user