1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
From: Bernhard Walle <bernhard@bwalle.de>
Date: Sun, 11 Mar 2012 20:11:14 +0100
Subject: [PATCH] Make liblzo optional for ubifs tools
Based on patch from Marc Kleine-Budde <mkl@pengutronix.de>.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
Makefile | 2 +-
mkfs.ubifs/compr.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 5cc0125c5243..9cfd9700a570 100644
--- a/Makefile
+++ b/Makefile
@@ -107,7 +107,7 @@ $(call _mkdep,lib/,libmtd.a)
obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \
hashtable/hashtable.o hashtable/hashtable_itr.o
LDFLAGS_mkfs.ubifs = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDFLAGS)
-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid
+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
$(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
#
diff --git a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c
index 34b2f6001b6b..549b4de13932 100644
--- a/mkfs.ubifs/compr.c
+++ b/mkfs.ubifs/compr.c
@@ -24,7 +24,11 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
+#ifndef WITHOUT_LZO
#include <lzo/lzo1x.h>
+#else
+#define LZO1X_999_MEM_COMPRESS 0
+#endif
#include <linux/types.h>
#define crc32 __zlib_crc32
@@ -85,6 +89,8 @@ static int zlib_deflate(void *in_buf, size_t in_len, void *out_buf,
return 0;
}
+
+#ifndef WITHOUT_LZO
static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
{
@@ -102,6 +108,17 @@ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
return 0;
}
+#else
+static inline int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
+ size_t *out_len)
+{
+ (void)in_buf;
+ (void)in_len;
+ (void)out_buf;
+ (void)out_len;
+ return -1;
+}
+#endif
static int no_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
|