aboutsummaryrefslogtreecommitdiffstats
path: root/tools/mtd-utils/patches
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-03-01 19:55:48 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-03-01 19:55:48 +0000
commit3698c6a3913d7db608475047ddf7a0e42936e7ba (patch)
tree50bf7127760f0b8a50449f76eb0b26b1176a99a5 /tools/mtd-utils/patches
parent705284797218b347ac67a73f0477ff75ed5ede56 (diff)
downloadupstream-3698c6a3913d7db608475047ddf7a0e42936e7ba.tar.gz
upstream-3698c6a3913d7db608475047ddf7a0e42936e7ba.tar.bz2
upstream-3698c6a3913d7db608475047ddf7a0e42936e7ba.zip
tools/mtd-utils: update to 1.4.5
This updates mtd-utils in tools: 100-optional_lzo.patch and 101-ubifs-optional_lzo.patch are now uneeded as a WITHOUT_LZO flag is provided by the upstream sources. All remaining patches are refreshed for the new version. 135-mkubifs_optional_lzo.patch was created to respect WITHOUT_LZO also in mkubifs. Signed-off-by: Daniel Golle <dgolle@allnet.de> SVN-Revision: 30769
Diffstat (limited to 'tools/mtd-utils/patches')
-rw-r--r--tools/mtd-utils/patches/100-optional_lzo.patch21
-rw-r--r--tools/mtd-utils/patches/101-ubifs-optional_lzo.patch84
-rw-r--r--tools/mtd-utils/patches/110-portability.patch18
-rw-r--r--tools/mtd-utils/patches/120-cygwin_fixes.patch22
-rw-r--r--tools/mtd-utils/patches/130-lzma_jffs2.patch12
-rw-r--r--tools/mtd-utils/patches/131-fix_lib_compile.patch6
-rw-r--r--tools/mtd-utils/patches/133-error-fix.patch6
-rw-r--r--tools/mtd-utils/patches/134-freebsd_loff_t.patch2
-rw-r--r--tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch125
9 files changed, 158 insertions, 138 deletions
diff --git a/tools/mtd-utils/patches/100-optional_lzo.patch b/tools/mtd-utils/patches/100-optional_lzo.patch
index 4bd3e5aba7..e69de29bb2 100644
--- a/tools/mtd-utils/patches/100-optional_lzo.patch
+++ b/tools/mtd-utils/patches/100-optional_lzo.patch
@@ -1,21 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -43,10 +43,15 @@ $(SYMLINKS):
- ln -sf ../fs/jffs2/$@ $@
-
- $(BUILDDIR)/mkfs.jffs2: $(addprefix $(BUILDDIR)/,\
-- 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
-+LDFLAGS_mkfs.jffs2 += $(LZOLDFLAGS)
-+LDLIBS_mkfs.jffs2 += -llzo2
-+CPPFLAGS += -DCONFIG_JFFS2_LZO
-+endif
-
- $(BUILDDIR)/jffs2reader: $(BUILDDIR)/jffs2reader.o
- LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
diff --git a/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch b/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch
index 7ab4f63ba1..e69de29bb2 100644
--- a/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch
+++ b/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch
@@ -1,84 +0,0 @@
---- a/mkfs.ubifs/Makefile
-+++ b/mkfs.ubifs/Makefile
-@@ -6,7 +6,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
-
- TARGETS = mkfs.ubifs
-
--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)
-
---- a/mkfs.ubifs/compr.c
-+++ b/mkfs.ubifs/compr.c
-@@ -24,7 +24,9 @@
- #include <stdio.h>
- #include <stdint.h>
- #include <string.h>
-+#if CONFIG_UBIFS_LZO
- #include <lzo/lzo1x.h>
-+#endif
- #include <linux/types.h>
-
- #define crc32 __zlib_crc32
-@@ -86,6 +88,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)
-+{
-+ 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)
- {
-@@ -104,14 +116,16 @@ static int lzo_compress(void *in_buf, si
- return 0;
- }
-
--static int no_compress(void *in_buf, size_t in_len, void *out_buf,
-- size_t *out_len)
-+#else
-+
-+static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
-+ size_t *out_len)
- {
-- memcpy(out_buf, in_buf, in_len);
-- *out_len = in_len;
-- return 0;
-+ return 1;
- }
-
-+#endif
-+
- static char *zlib_buf;
-
- static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf,
-@@ -198,9 +212,11 @@ int compress_data(void *in_buf, size_t i
-
- int init_compression(void)
- {
-+#ifdef CONFIG_UBIFS_LZO
- lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
- if (!lzo_mem)
- return -1;
-+#endif
-
- zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
- if (!zlib_buf) {
-@@ -214,7 +230,9 @@ int init_compression(void)
- void destroy_compression(void)
- {
- free(zlib_buf);
-+#ifdef CONFIG_UBIFS_LZO
- free(lzo_mem);
-+#endif
- if (errcnt)
- fprintf(stderr, "%llu compression errors occurred\n", errcnt);
- }
diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch
index 3b71231e48..5bf1b95bc2 100644
--- a/tools/mtd-utils/patches/110-portability.patch
+++ b/tools/mtd-utils/patches/110-portability.patch
@@ -1,9 +1,9 @@
--- a/compr_lzo.c
+++ b/compr_lzo.c
-@@ -24,7 +24,6 @@
- #include <stdint.h>
- #include <stdio.h>
+@@ -26,7 +26,6 @@
#include <string.h>
+
+ #ifndef WITHOUT_LZO
-#include <asm/types.h>
#include <linux/jffs2.h>
#include <lzo/lzo1x.h>
@@ -67,7 +67,7 @@
#include <sys/types.h>
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
-@@ -805,8 +805,8 @@ int write_leb(int lnum, int len, void *b
+@@ -821,8 +821,8 @@ int write_leb(int lnum, int len, void *b
if (ubi_leb_change_start(ubi, out_fd, lnum, c->leb_size, dtype))
return sys_err_msg("ubi_leb_change_start failed");
@@ -78,7 +78,7 @@
(long long)pos);
if (write(out_fd, buf, c->leb_size) != c->leb_size)
-@@ -1063,6 +1063,7 @@ static int add_inode_with_data(struct st
+@@ -1079,6 +1079,7 @@ static int add_inode_with_data(struct st
if (c->default_compr != UBIFS_COMPR_NONE)
use_flags |= UBIFS_COMPR_FL;
@@ -86,7 +86,7 @@
if (flags & FS_COMPR_FL)
use_flags |= UBIFS_COMPR_FL;
if (flags & FS_SYNC_FL)
-@@ -1073,6 +1074,7 @@ static int add_inode_with_data(struct st
+@@ -1089,6 +1090,7 @@ static int add_inode_with_data(struct st
use_flags |= UBIFS_APPEND_FL;
if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode))
use_flags |= UBIFS_DIRSYNC_FL;
@@ -94,7 +94,7 @@
memset(ino, 0, UBIFS_INO_NODE_SZ);
-@@ -1142,7 +1144,9 @@ static int add_dir_inode(DIR *dir, ino_t
+@@ -1158,7 +1160,9 @@ static int add_dir_inode(DIR *dir, ino_t
fd = dirfd(dir);
if (fd == -1)
return sys_err_msg("dirfd failed");
@@ -104,7 +104,7 @@
flags = 0;
}
-@@ -1327,10 +1331,12 @@ static int add_file(const char *path_nam
+@@ -1343,10 +1347,12 @@ static int add_file(const char *path_nam
key_write(&key, &dn->key);
dn->size = cpu_to_le32(bytes_read);
out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
@@ -117,7 +117,7 @@
use_compr = c->default_compr;
compr_type = compress_data(buf, bytes_read, &dn->data,
&out_len, use_compr);
-@@ -1372,7 +1378,9 @@ static int add_non_dir(const char *path_
+@@ -1388,7 +1394,9 @@ static int add_non_dir(const char *path_
if (fd == -1)
return sys_err_msg("failed to open file '%s'",
path_name);
diff --git a/tools/mtd-utils/patches/120-cygwin_fixes.patch b/tools/mtd-utils/patches/120-cygwin_fixes.patch
index e1c04048ed..3dc21614b1 100644
--- a/tools/mtd-utils/patches/120-cygwin_fixes.patch
+++ b/tools/mtd-utils/patches/120-cygwin_fixes.patch
@@ -1,7 +1,7 @@
--- a/Makefile
+++ b/Makefile
-@@ -7,6 +7,11 @@ ifeq ($(WITHOUT_XATTR), 1)
- CPPFLAGS += -DWITHOUT_XATTR
+@@ -12,6 +12,11 @@ else
+ LZOLDLIBS = -llzo2
endif
+ifeq ($(shell uname -o),Cygwin)
@@ -10,9 +10,9 @@
+
+ifneq ($(shell uname -o),Cygwin)
SUBDIRS = lib ubi-utils mkfs.ubifs
+ TESTS = tests
- TARGETS = ftl_format flash_erase nanddump doc_loadbios \
-@@ -17,6 +22,10 @@ TARGETS = ftl_format flash_erase nanddum
+@@ -23,6 +28,10 @@ TARGETS = ftl_format flash_erase nanddum
rfddump rfdformat \
serve_image recv_image \
sumtool #jffs2reader
@@ -373,8 +373,8 @@
+
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
-@@ -76,6 +76,14 @@
-
+@@ -77,6 +77,14 @@
+ #include "rbtree.h"
#include "common.h"
+#ifdef __CYGWIN__
@@ -388,7 +388,7 @@
/* Do not use the weird XPG version of basename */
#undef basename
-@@ -375,7 +383,7 @@ static struct filesystem_entry *recursiv
+@@ -376,7 +384,7 @@ static struct filesystem_entry *recursiv
the following macros use it if available or use a hacky workaround...
*/
@@ -397,10 +397,10 @@
#define SCANF_PREFIX "a"
#define SCANF_STRING(s) (&s)
#define GETCWD_SIZE 0
-@@ -458,6 +466,14 @@ static int interpret_table_entry(struct
+@@ -459,6 +467,14 @@ static int interpret_table_entry(struct
}
entry = find_filesystem_entry(root, name, mode);
- if (entry) {
+ if (entry && !(count > 0 && (type == 'c' || type == 'b'))) {
+ /* Check the type */
+ if ((mode & S_IFMT) != (entry->sb.st_mode & S_IFMT)) {
+ error_msg ("skipping device_table entry '%s': type mismatch!", name);
@@ -412,7 +412,7 @@
/* Ok, we just need to fixup the existing entry
* and we will be all done... */
entry->sb.st_uid = uid;
-@@ -467,11 +483,21 @@ static int interpret_table_entry(struct
+@@ -468,11 +484,21 @@ static int interpret_table_entry(struct
entry->sb.st_rdev = makedev(major, minor);
}
} else {
@@ -435,7 +435,7 @@
free(tmp);
if (parent == NULL) {
errmsg ("skipping device_table entry '%s': no parent directory!", name);
-@@ -485,6 +511,7 @@ static int interpret_table_entry(struct
+@@ -486,6 +512,7 @@ static int interpret_table_entry(struct
add_host_filesystem_entry(name, hostpath, uid, gid, mode, 0, parent);
break;
case 'f':
diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch
index f869118fc4..be1c361fe1 100644
--- a/tools/mtd-utils/patches/130-lzma_jffs2.patch
+++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch
@@ -9,17 +9,17 @@
ifeq ($(WITHOUT_XATTR), 1)
CPPFLAGS += -DWITHOUT_XATTR
-@@ -52,7 +52,9 @@ $(SYMLINKS):
+@@ -59,7 +59,9 @@ $(SYMLINKS):
ln -sf ../fs/jffs2/$@ $@
$(BUILDDIR)/mkfs.jffs2: $(addprefix $(BUILDDIR)/,\
-- 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) \
++ $(if $(WITHOUT_LZO),,compr_lzo.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
+ LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
+ LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS)
--- a/compr.c
+++ b/compr.c
@@ -520,6 +520,9 @@ int jffs2_compressors_init(void)
@@ -5013,7 +5013,7 @@
+}
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
-@@ -1684,11 +1684,11 @@ int main(int argc, char **argv)
+@@ -1685,11 +1685,11 @@ int main(int argc, char **argv)
}
erase_block_size *= units;
diff --git a/tools/mtd-utils/patches/131-fix_lib_compile.patch b/tools/mtd-utils/patches/131-fix_lib_compile.patch
index fef1333177..8c977c1774 100644
--- a/tools/mtd-utils/patches/131-fix_lib_compile.patch
+++ b/tools/mtd-utils/patches/131-fix_lib_compile.patch
@@ -3,9 +3,9 @@
@@ -7,7 +7,7 @@ SUBDIRS =
# CFLAGS += -Werror
CPPFLAGS += -I../include
- LIBS = libmtd libcrc32
--TARGETS = libmtd.a libcrc32.a
-+override TARGETS = libmtd.a libcrc32.a
+ LIBS = libmtd
+-TARGETS = libmtd.a
++override TARGETS = libmtd.a
include ../common.mk
diff --git a/tools/mtd-utils/patches/133-error-fix.patch b/tools/mtd-utils/patches/133-error-fix.patch
index 0fe072a6fb..4854138d02 100644
--- a/tools/mtd-utils/patches/133-error-fix.patch
+++ b/tools/mtd-utils/patches/133-error-fix.patch
@@ -1,7 +1,7 @@
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
-@@ -468,7 +468,7 @@ static int interpret_table_entry(struct
- if (entry) {
+@@ -469,7 +469,7 @@ static int interpret_table_entry(struct
+ if (entry && !(count > 0 && (type == 'c' || type == 'b'))) {
/* Check the type */
if ((mode & S_IFMT) != (entry->sb.st_mode & S_IFMT)) {
- error_msg ("skipping device_table entry '%s': type mismatch!", name);
@@ -9,7 +9,7 @@
free(name);
free(hostpath);
return 1;
-@@ -484,7 +484,7 @@ static int interpret_table_entry(struct
+@@ -485,7 +485,7 @@ static int interpret_table_entry(struct
}
} else {
if (type == 'f' || type == 'l') {
diff --git a/tools/mtd-utils/patches/134-freebsd_loff_t.patch b/tools/mtd-utils/patches/134-freebsd_loff_t.patch
index 805e5ff027..68a835292c 100644
--- a/tools/mtd-utils/patches/134-freebsd_loff_t.patch
+++ b/tools/mtd-utils/patches/134-freebsd_loff_t.patch
@@ -1,6 +1,6 @@
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
-@@ -98,8 +98,8 @@
+@@ -114,8 +114,8 @@ struct otp_info {
#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
diff --git a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
new file mode 100644
index 0000000000..86c6489a63
--- /dev/null
+++ b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
@@ -0,0 +1,125 @@
+--- a/mkfs.ubifs/compr.c
++++ b/mkfs.ubifs/compr.c
+@@ -24,7 +24,9 @@
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <string.h>
++#ifndef WITHOUT_LZO
+ #include <lzo/lzo1x.h>
++#endif
+ #include <linux/types.h>
+
+ #define crc32 __zlib_crc32
+@@ -35,7 +37,9 @@
+ #include "ubifs-media.h"
+ #include "mkfs.ubifs.h"
+
++#ifndef WITHOUT_LZO
+ static void *lzo_mem;
++#endif
+ static unsigned long long errcnt = 0;
+ static struct ubifs_info *c = &info_;
+
+@@ -86,6 +90,7 @@ static int zlib_deflate(void *in_buf, si
+ return 0;
+ }
+
++#ifndef WITHOUT_LZO
+ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
+ size_t *out_len)
+ {
+@@ -103,6 +108,7 @@ static int lzo_compress(void *in_buf, si
+
+ return 0;
+ }
++#endif
+
+ static int no_compress(void *in_buf, size_t in_len, void *out_buf,
+ size_t *out_len)
+@@ -120,14 +126,20 @@ static int favor_lzo_compress(void *in_b
+ int lzo_ret, zlib_ret;
+ size_t lzo_len, zlib_len;
+
++#ifndef WITHOUT_LZO
+ lzo_len = zlib_len = *out_len;
+ lzo_ret = lzo_compress(in_buf, in_len, out_buf, &lzo_len);
++#endif
+ zlib_ret = zlib_deflate(in_buf, in_len, zlib_buf, &zlib_len);
+-
++#ifndef WITHOUT_LZO
+ if (lzo_ret && zlib_ret)
++#else
++ if (zlib_ret)
++#endif
+ /* Both compressors failed */
+ return -1;
+
++#ifndef WITHOUT_LZO
+ if (!lzo_ret && !zlib_ret) {
+ double percent;
+
+@@ -152,6 +164,7 @@ select_lzo:
+ *out_len = lzo_len;
+ *type = MKFS_UBIFS_COMPR_LZO;
+ return 0;
++#endif
+
+ select_zlib:
+ *out_len = zlib_len;
+@@ -174,9 +187,11 @@ int compress_data(void *in_buf, size_t i
+ ret = favor_lzo_compress(in_buf, in_len, out_buf, out_len, &type);
+ else {
+ switch (type) {
++#ifndef WITHOUT_LZO
+ case MKFS_UBIFS_COMPR_LZO:
+ ret = lzo_compress(in_buf, in_len, out_buf, out_len);
+ break;
++#endif
+ case MKFS_UBIFS_COMPR_ZLIB:
+ ret = zlib_deflate(in_buf, in_len, out_buf, out_len);
+ break;
+@@ -198,13 +213,17 @@ int compress_data(void *in_buf, size_t i
+
+ int init_compression(void)
+ {
++#ifndef WITHOUT_LZO
+ lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
+ if (!lzo_mem)
+ return -1;
++#endif
+
+ zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
+ if (!zlib_buf) {
++#ifndef WITHOUT_LZO
+ free(lzo_mem);
++#endif
+ return -1;
+ }
+
+@@ -214,7 +233,9 @@ int init_compression(void)
+ void destroy_compression(void)
+ {
+ free(zlib_buf);
++#ifndef WITHOUT_LZO
+ free(lzo_mem);
++#endif
+ if (errcnt)
+ fprintf(stderr, "%llu compression errors occurred\n", errcnt);
+ }
+--- a/mkfs.ubifs/Makefile
++++ b/mkfs.ubifs/Makefile
+@@ -6,7 +6,13 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
+
+ TARGETS = mkfs.ubifs
+
+-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
++ifeq ($(WITHOUT_LZO), 1)
++ CPPFLAGS += -DWITHOUT_LZO
++else
++ LZOLDLIBS = -llzo2
++endif
++
++LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
+ LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd
+ LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
+