mtd/util Makefile,1.24,1.25 mkfs.jffs2.c,1.30,1.31

David Woodhouse dwmw2 at infradead.org
Sun Jan 12 09:39:33 EST 2003


Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv7723

Modified Files:
	Makefile mkfs.jffs2.c 
Log Message:
Clean up mkfs.jffs2, fix cross-compilation

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/util/Makefile,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Makefile	26 Nov 2002 10:12:21 -0000	1.24
+++ Makefile	12 Jan 2003 14:39:31 -0000	1.25
@@ -3,13 +3,15 @@
 
 # $Id$
 
+# CROSS=arm-linux-
+CC := $(CROSS)gcc
 CFLAGS += -I../include -O2 -Wall -Wstrict-prototypes -Wshadow
 
 TARGETS = ftl_format erase eraseall nftldump nanddump doc_loadbios \
 nftl_format mkfs.jffs ftl_check nandtest nandwrite mkfs.jffs2 lock unlock \
 einfo mtd_debug fcp #jffs2reader
 
-SYMLINKS = crc32.h crc32.c compr_rtime.c compr_rubin.c compr.c pushpull.h histo_mips.h compr_rubin.h
+SYMLINKS = crc32.h crc32.c compr_rtime.c
 
 all: $(TARGETS)
 
@@ -17,18 +19,14 @@
 	rm -f *.o $(TARGETS) $(SYMLINKS)
 
 mkfs.jffs2.o crc32.o: crc32.h
-compr_rubin.o: pushpull.h histo_mips.h compr_rubin.h
 
 $(SYMLINKS):
 	ln -sf ../fs/jffs2/$@ $@
 
-mkfs.jffs2: crc32.o compr_rtime.o compr_rubin.o compr.o mkfs.jffs2.o compr_zlib.o
-	$(CC) -o $@ $^ -lz
+mkfs.jffs2: crc32.o compr_rtime.o mkfs.jffs2.o compr_zlib.o
+	$(CC) $(CFLAGS) -o $@ $^ -lz
 
-compr.o: compr.c
-	$(CC) $(CFLAGS) -Dprintk=printf -DKERN_NOTICE= -c -o $@ $<
-
-jffs2reader: jffs2reader.c
-	$(CC) $(CFLAGS) jffs2reader.c -o jffs2reader -lz 
+jffs2reader: jffs2reader.o
+	$(CC) $(CFLAGS) -o $@ $^ -lz 
 
 

Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- mkfs.jffs2.c	6 Dec 2002 20:59:48 -0000	1.30
+++ mkfs.jffs2.c	12 Jan 2003 14:39:31 -0000	1.31
@@ -35,7 +35,7 @@
  *
  * Cleanmarkers support added by Axis Communications AB
  *
- * Rewritten again.  Cleanly seperated host and target filsystem
+ * Rewritten again.  Cleanly separated host and target filsystem
  * activities (mainly so I can reuse all the host handling stuff as I
  * rewrite other mkfs utils).  Added a verbose option to list types
  * and attributes as files are added to the filesystem.  Major cleanup
@@ -664,8 +664,25 @@
  * 64-bit arches and whatnot, use the --pagesize=SIZE option */
 static int page_size = 4096;
 
-extern unsigned char jffs2_compress(unsigned char *data_in, 
-		unsigned char *cpage_out, uint32_t * datalen, uint32_t * cdatalen);
+extern int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen);
+extern int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen);
+
+unsigned char jffs2_compress(unsigned char *data_in, unsigned char *cpage_out, 
+		    uint32_t *datalen, uint32_t *cdatalen)
+{
+	int ret;
+
+	ret = jffs2_zlib_compress(data_in, cpage_out, datalen, cdatalen);
+	if (!ret) {
+		return JFFS2_COMPR_ZLIB;
+	}
+	/* rtime does manage to recompress already-compressed data */
+	ret = jffs2_rtime_compress(data_in, cpage_out, datalen, cdatalen);
+	if (!ret) {
+		return JFFS2_COMPR_RTIME;
+	}
+	return JFFS2_COMPR_NONE; /* We failed to compress */
+}
 
 static void full_write(int fd, const void *buf, int len)
 {





More information about the linux-mtd-cvs mailing list