1 --- a/mkfs.ubifs/Makefile
2 +++ b/mkfs.ubifs/Makefile
3 @@ -6,7 +6,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
7 -LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
8 +LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
9 LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32
10 LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
12 --- a/mkfs.ubifs/compr.c
13 +++ b/mkfs.ubifs/compr.c
19 #include <lzo/lzo1x.h>
21 #include <linux/types.h>
23 #define crc32 __zlib_crc32
24 @@ -86,6 +88,16 @@ static int zlib_deflate(void *in_buf, si
28 +static int no_compress(void *in_buf, size_t in_len, void *out_buf,
31 + memcpy(out_buf, in_buf, in_len);
38 static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
41 @@ -104,14 +116,16 @@ static int lzo_compress(void *in_buf, si
45 -static int no_compress(void *in_buf, size_t in_len, void *out_buf,
49 +static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
52 - memcpy(out_buf, in_buf, in_len);
60 static char *zlib_buf;
62 static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf,
63 @@ -198,9 +212,11 @@ int compress_data(void *in_buf, size_t i
65 int init_compression(void)
67 +#ifdef CONFIG_UBIFS_LZO
68 lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
73 zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
75 @@ -214,7 +230,9 @@ int init_compression(void)
76 void destroy_compression(void)
79 +#ifdef CONFIG_UBIFS_LZO
83 fprintf(stderr, "%llu compression errors occurred\n", errcnt);