1 diff --git a/mkfs.ubifs/Makefile b/mkfs.ubifs/Makefile
2 index a678b0a..919ce89 100644
3 --- a/mkfs.ubifs/Makefile
4 +++ b/mkfs.ubifs/Makefile
5 @@ -6,7 +6,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
9 -LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
10 +LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
11 LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32
12 LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
14 diff --git a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c
15 index e378c5d..0208f80 100644
16 --- a/mkfs.ubifs/compr.c
17 +++ b/mkfs.ubifs/compr.c
23 #include <lzo/lzo1x.h>
25 #include <linux/types.h>
27 #define crc32 __zlib_crc32
28 @@ -85,6 +87,16 @@ static int zlib_deflate(void *in_buf, si
32 +static int no_compress(void *in_buf, size_t in_len, void *out_buf,
35 + memcpy(out_buf, in_buf, in_len);
42 static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
45 @@ -103,14 +115,16 @@ static int lzo_compress(void *in_buf, si
49 -static int no_compress(void *in_buf, size_t in_len, void *out_buf,
53 +static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
56 - memcpy(out_buf, in_buf, in_len);
64 static char *zlib_buf;
66 static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf,
67 @@ -197,9 +211,11 @@ int compress_data(void *in_buf, size_t i
69 int init_compression(void)
71 +#ifdef CONFIG_UBIFS_LZO
72 lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
77 zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
79 @@ -213,7 +229,9 @@ int init_compression(void)
80 void destroy_compression(void)
83 +#ifdef CONFIG_UBIFS_LZO
87 fprintf(stderr, "%llu compression errors occurred\n", errcnt);