include $(TOPDIR)/rules.mk
PKG_NAME:=mtd
-PKG_VERSION:=20090505
+PKG_VERSION:=20100912
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=d021e049efaff50de33819b8cd2835d4b79bcfa8
+PKG_SOURCE_VERSION:=e5a8bd7061921a9a787ffbb2c47a5af8f439d342
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_MD5SUM:=1f42c2cae08eb9e7b52d0c188f8d6338
+PKG_MD5SUM:=1ad3e00b0f59d796ad76f18f15240b39
PKG_CAT:=zcat
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
$(MAKE) -C $(HOST_BUILD_DIR) \
$(MTD_MAKEOPTS) \
TARGETS=mkfs.jffs2
+ $(MAKE) -C $(HOST_BUILD_DIR)/lib \
+ $(MTD_MAKEOPTS) \
+ TARGETS="libmtd.a libcrc32.a" \
+ LIBS="libmtd libcrc32"
$(MAKE) -C $(HOST_BUILD_DIR)/ubi-utils \
$(MTD_MAKEOPTS) \
TARGETS=ubinize
--- a/Makefile
+++ b/Makefile
-@@ -36,10 +36,16 @@ $(SYMLINKS):
+@@ -42,10 +42,15 @@ $(SYMLINKS):
ln -sf ../fs/jffs2/$@ $@
$(BUILDDIR)/mkfs.jffs2: $(addprefix $(BUILDDIR)/,\
-- crc32.o compr_rtime.o mkfs.jffs2.o compr_zlib.o compr_lzo.o \
-+ crc32.o compr_rtime.o mkfs.jffs2.o compr_zlib.o $(if $(NO_LZO),,compr_lzo.o) \
+- compr_rtime.o mkfs.jffs2.o compr_zlib.o compr_lzo.o \
++ compr_rtime.o mkfs.jffs2.o compr_zlib.o $(if $(NO_LZO),,compr_lzo.o) \
compr.o rbtree.o)
-LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
-LDLIBS_mkfs.jffs2 = -lz -llzo2
-+
+LDFLAGS_mkfs.jffs2 := $(ZLIBLDFLAGS)
+LDLIBS_mkfs.jffs2 := -lz
+ifndef NO_LZO
+CPPFLAGS += -DCONFIG_JFFS2_LZO
+endif
- $(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o
-
---- a/compr.h
-+++ b/compr.h
-@@ -18,7 +18,6 @@
-
- #define CONFIG_JFFS2_ZLIB
- #define CONFIG_JFFS2_RTIME
--#define CONFIG_JFFS2_LZO
-
- #define JFFS2_RUBINMIPS_PRIORITY 10
- #define JFFS2_DYNRUBIN_PRIORITY 20
+ $(BUILDDIR)/jffs2reader: $(BUILDDIR)/jffs2reader.o
+ LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
index a678b0a..919ce89 100644
--- a/mkfs.ubifs/Makefile
+++ b/mkfs.ubifs/Makefile
-@@ -5,7 +5,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
+@@ -6,7 +6,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
TARGETS = mkfs.ubifs
--LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L../ubi-utils/ -lubi
-+LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L../ubi-utils/ -lubi
-
- include ../common.mk
+-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
++LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
+ LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32
+ LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
diff --git a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c
index e378c5d..0208f80 100644
--- a/mkfs.ubifs/compr.c
+++ b/mkfs.ubifs/compr.c
-@@ -25,7 +25,9 @@
+@@ -24,7 +24,9 @@
+ #include <stdio.h>
#include <stdint.h>
#include <string.h>
- #include <zlib.h>
+#if CONFIG_UBIFS_LZO
#include <lzo/lzo1x.h>
+#endif
#include <linux/types.h>
- #include "compr.h"
-@@ -83,6 +85,17 @@ static int zlib_deflate(void *in_buf, size_t in_len, void *out_buf,
+ #define crc32 __zlib_crc32
+@@ -85,6 +87,16 @@ static int zlib_deflate(void *in_buf, si
return 0;
}
+static int no_compress(void *in_buf, size_t in_len, void *out_buf,
-+ size_t *out_len)
++ size_t *out_len)
+{
+ memcpy(out_buf, in_buf, in_len);
+ *out_len = in_len;
+ return 0;
+}
+
-+
+#if CONFIG_UBIFS_LZO
+
static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
{
-@@ -101,14 +114,16 @@ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
+@@ -103,14 +115,16 @@ static int lzo_compress(void *in_buf, si
return 0;
}
- memcpy(out_buf, in_buf, in_len);
- *out_len = in_len;
- return 0;
-+ return -1;
++ return 1;
}
+#endif
static char *zlib_buf;
static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf,
-@@ -195,9 +210,11 @@ int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
+@@ -197,9 +211,11 @@ int compress_data(void *in_buf, size_t i
int init_compression(void)
{
zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
if (!zlib_buf) {
-@@ -211,7 +228,9 @@ int init_compression(void)
+@@ -213,7 +229,9 @@ int init_compression(void)
void destroy_compression(void)
{
free(zlib_buf);
+endif
+
+ifneq ($(shell uname -o),Cygwin)
- SUBDIRS = ubi-utils mkfs.ubifs
+ SUBDIRS = lib ubi-utils mkfs.ubifs
TARGETS = ftl_format flash_erase flash_eraseall nanddump doc_loadbios \
@@ -17,6 +22,10 @@ TARGETS = ftl_format flash_erase flash_e
--- a/Makefile
-+++ b/Makefile
++++ b/Makefile
@@ -1,7 +1,7 @@
# -*- sh -*-
ifeq ($(WITHOUT_XATTR), 1)
CPPFLAGS += -DWITHOUT_XATTR
-@@ -45,7 +45,9 @@
+@@ -51,7 +51,9 @@ $(SYMLINKS):
ln -sf ../fs/jffs2/$@ $@
$(BUILDDIR)/mkfs.jffs2: $(addprefix $(BUILDDIR)/,\
-- crc32.o compr_rtime.o mkfs.jffs2.o compr_zlib.o $(if $(NO_LZO),,compr_lzo.o) \
-+ crc32.o compr_rtime.o mkfs.jffs2.o compr_zlib.o \
+- compr_rtime.o mkfs.jffs2.o compr_zlib.o $(if $(NO_LZO),,compr_lzo.o) \
++ compr_rtime.o mkfs.jffs2.o compr_zlib.o \
+ $(if $(NO_LZO),,compr_lzo.o) \
-+ compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o\
++ compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \
compr.o rbtree.o)
-
LDFLAGS_mkfs.jffs2 := $(ZLIBLDFLAGS)
+ LDLIBS_mkfs.jffs2 := -lz
--- a/compr.c 2009-06-05 16:59:08.000000000 +0200
+++ b/compr.c 2010-03-20 23:16:14.556367000 +0100
@@ -520,6 +520,9 @@
}
--- a/compr.h 2010-03-20 23:08:46.289595000 +0100
+++ b/compr.h 2010-03-20 23:51:41.953345921 +0100
-@@ -18,12 +18,14 @@
+@@ -18,13 +18,14 @@
#define CONFIG_JFFS2_ZLIB
#define CONFIG_JFFS2_RTIME
+-#define CONFIG_JFFS2_LZO
+#define CONFIG_JFFS2_LZMA
#define JFFS2_RUBINMIPS_PRIORITY 10
#define JFFS2_COMPR_MODE_NONE 0
#define JFFS2_COMPR_MODE_PRIORITY 1
-@@ -114,5 +116,10 @@
+@@ -115,5 +116,10 @@ void jffs2_rtime_exit(void);
int jffs2_lzo_init(void);
void jffs2_lzo_exit(void);
#endif
--- /dev/null
+--- a/Makefile
++++ b/Makefile
+@@ -67,8 +67,6 @@ $(BUILDDIR)/jffs2reader: $(BUILDDIR)/jff
+ LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
+ LDLIBS_jffs2reader = -lz -llzo2
+
+-$(BUILDDIR)/lib/libmtd.a: subdirs_lib_all ;
+-
+ install:: ${TARGETS}
+ mkdir -p ${DESTDIR}/${SBINDIR}
+ install -m 0755 ${TARGETS} ${DESTDIR}/${SBINDIR}/