Skip to contentSkip to conversation

Add lzo support to mtd-utils

PATCH New Richard Purdie 1 participant 1 message Mar 1, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add lzo support to mtd-utils

Add LZO support to mtd-utils to generate LZO compressed jffs2 images

Unlike the kernel version, the standard lzo userspace library is used along with lzo1x_999_compress rather than the lzo1x_1_compress version since better compression ratios can be obtained (at no significant cost to decompression time).

---
 Makefile              |    3 -
 compr.c               |    6 ++
 compr.h               |    6 ++
 compr_lzo.c           |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/jffs2.h |    1 
 5 files changed, 135 insertions(+), 1 deletion(-)
Makefile +2 -1
Index: git/Makefile
===================================================================
@@ -58,8 +58,9 @@ $(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc3
 			$(BUILDDIR)/compr_rtime.o \
 			$(BUILDDIR)/mkfs.jffs2.o \
 			$(BUILDDIR)/compr_zlib.o \
+			$(BUILDDIR)/compr_lzo.o \
 			$(BUILDDIR)/compr.o
-	$(CC) $(LDFLAGS) -o $@ $^ -lz
+	$(CC) $(LDFLAGS) -o $@ $^ -lz -llzo
 
 $(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o
 	$(CC) $(LDFLAGS) -o $@ $^
compr.c +6 -0
Index: git/compr.c
===================================================================
@@ -474,6 +474,9 @@ int jffs2_compressors_init(void)
 #ifdef CONFIG_JFFS2_RTIME
 	jffs2_rtime_init();
 #endif
+#ifdef CONFIG_JFFS2_LZO
+        jffs2_lzo_init();
+#endif
 	return 0;
 }
 
@@ -485,5 +488,8 @@ int jffs2_compressors_exit(void)
 #ifdef CONFIG_JFFS2_ZLIB
 	jffs2_zlib_exit();
 #endif
+#ifdef CONFIG_JFFS2_LZO
+        jffs2_lzo_exit();
+#endif
 	return 0;
 }
compr.h +6 -0
Index: git/compr.h
===================================================================
@@ -21,11 +21,13 @@
 
 #define CONFIG_JFFS2_ZLIB
 #define CONFIG_JFFS2_RTIME
+#define CONFIG_JFFS2_LZO
 
 #define JFFS2_RUBINMIPS_PRIORITY 10
 #define JFFS2_DYNRUBIN_PRIORITY  20
 #define JFFS2_RTIME_PRIORITY     50
 #define JFFS2_ZLIB_PRIORITY      60
+#define JFFS2_LZO_PRIORITY       80
 
 #define JFFS2_COMPR_MODE_NONE       0
 #define JFFS2_COMPR_MODE_PRIORITY   1
@@ -111,5 +113,9 @@ void jffs2_zlib_exit(void);
 int jffs2_rtime_init(void);
 void jffs2_rtime_exit(void);
 #endif
+#ifdef CONFIG_JFFS2_LZO
+int jffs2_lzo_init(void);
+void jffs2_lzo_exit(void);
+#endif
 
 #endif /* __JFFS2_COMPR_H__ */
compr_lzo.c new file +120 -0

120 lines not on this page · raw message

include/linux/jffs2.h +1 -0
Index: git/include/linux/jffs2.h
===================================================================
@@ -46,6 +46,7 @@
 #define JFFS2_COMPR_COPY	0x04
 #define JFFS2_COMPR_DYNRUBIN	0x05
 #define JFFS2_COMPR_ZLIB	0x06
+#define JFFS2_COMPR_LZO		0x07
 /* Compatibility flags. */
 #define JFFS2_COMPAT_MASK 0xc000      /* What do to if an unknown nodetype is found */
 #define JFFS2_NODE_ACCURATE 0x2000