summaryrefslogtreecommitdiff
path: root/tools/mtd-utils
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-06-14 20:42:12 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-06-14 20:42:12 +0000
commit2d6fc61216723b6dd30818f0675edbf82fe3ebae (patch)
treebdc1ea107c23d1683520bb4ce01b6936c73e09d7 /tools/mtd-utils
parent1e50157f84d5311603bf4871247d78440b634cbe (diff)
downloadmtk-20170518-2d6fc61216723b6dd30818f0675edbf82fe3ebae.zip
mtk-20170518-2d6fc61216723b6dd30818f0675edbf82fe3ebae.tar.gz
mtk-20170518-2d6fc61216723b6dd30818f0675edbf82fe3ebae.tar.bz2
upgrade to a more recent version of mtd-utils - preparation for adding UBI support
SVN-Revision: 16455
Diffstat (limited to 'tools/mtd-utils')
-rw-r--r--tools/mtd-utils/Makefile23
-rw-r--r--tools/mtd-utils/patches/100-gcc4_fix.patch22
-rw-r--r--tools/mtd-utils/patches/100-optional_lzo.patch32
-rw-r--r--tools/mtd-utils/patches/110-portability.patch72
-rw-r--r--tools/mtd-utils/patches/110-portability_fix.patch61
5 files changed, 121 insertions, 89 deletions
diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile
index 4486578..a74c941 100644
--- a/tools/mtd-utils/Makefile
+++ b/tools/mtd-utils/Makefile
@@ -7,14 +7,17 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mtd
-PKG_VERSION:=20050122
+PKG_VERSION:=20090505
-PKG_SOURCE=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
-PKG_SOURCE_URL=http://ftp.debian.org/debian/pool/main/m/mtd
+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_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_MD5SUM:=1f42c2cae08eb9e7b52d0c188f8d6338
PKG_CAT:=zcat
-HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).orig
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/host-build.mk
@@ -23,12 +26,20 @@ ifneq ($(HOST_OS),Linux)
CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h
endif
+MTD_MAKEOPTS = \
+ CFLAGS="$(CFLAGS)" \
+ NO_LZO=1 WITHOUT_XATTR=1 \
+ SUBDIRS="" \
+ BUILDDIR="$(HOST_BUILD_DIR)"
+
define Host/Compile
- $(MAKE) -C $(HOST_BUILD_DIR)/util CFLAGS="$(CFLAGS)" TARGETS=mkfs.jffs2
+ $(MAKE) -C $(HOST_BUILD_DIR) \
+ $(MTD_MAKEOPTS) \
+ TARGETS=mkfs.jffs2
endef
define Host/Install
- $(CP) $(HOST_BUILD_DIR)/util/mkfs.jffs2 $(STAGING_DIR_HOST)/bin/
+ $(CP) $(HOST_BUILD_DIR)/mkfs.jffs2 $(STAGING_DIR_HOST)/bin/
endef
define Host/Clean
diff --git a/tools/mtd-utils/patches/100-gcc4_fix.patch b/tools/mtd-utils/patches/100-gcc4_fix.patch
deleted file mode 100644
index 44bd7b5..0000000
--- a/tools/mtd-utils/patches/100-gcc4_fix.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- a/include/mtd/jffs2-user.h
-+++ b/include/mtd/jffs2-user.h
-@@ -19,8 +19,6 @@
- #undef je32_to_cpu
- #undef jemode_to_cpu
-
--extern int target_endian;
--
- #define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
- #define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
-
---- a/util/jffs3.h
-+++ b/util/jffs3.h
-@@ -177,8 +177,6 @@ union jffs3_node_union {
- #undef je32_to_cpu
- #undef jemode_to_cpu
-
--extern int target_endian;
--
- #define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
- #define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
-
diff --git a/tools/mtd-utils/patches/100-optional_lzo.patch b/tools/mtd-utils/patches/100-optional_lzo.patch
new file mode 100644
index 0000000..d9ebc3e
--- /dev/null
+++ b/tools/mtd-utils/patches/100-optional_lzo.patch
@@ -0,0 +1,32 @@
+--- a/Makefile
++++ b/Makefile
+@@ -36,10 +36,16 @@ $(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.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)/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
diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch
new file mode 100644
index 0000000..487aec7
--- /dev/null
+++ b/tools/mtd-utils/patches/110-portability.patch
@@ -0,0 +1,72 @@
+--- a/compr_lzo.c
++++ b/compr_lzo.c
+@@ -24,7 +24,6 @@
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <string.h>
+-#include <asm/types.h>
+ #include <linux/jffs2.h>
+ #include <lzo/lzo1x.h>
+ #include "compr.h"
+--- a/compr_zlib.c
++++ b/compr_zlib.c
+@@ -35,7 +35,6 @@
+ #include <stdint.h>
+ #include <zlib.h>
+ #include <stdio.h>
+-#include <asm/types.h>
+ #include <linux/jffs2.h>
+ #include "compr.h"
+
+--- a/mkfs.jffs2.c
++++ b/mkfs.jffs2.c
+@@ -1100,6 +1100,7 @@ static struct {
+ { 0, NULL, 0 }
+ };
+
++#ifndef NO_ACL_SUPPORT
+ static void formalize_posix_acl(void *xvalue, int *value_len)
+ {
+ struct posix_acl_xattr_header *pacl_header;
+@@ -1151,6 +1152,7 @@ static void formalize_posix_acl(void *xv
+ memcpy(xvalue, buffer, offset);
+ *value_len = offset;
+ }
++#endif
+
+ static xattr_entry_t *create_xattr_entry(int xprefix, char *xname, char *xvalue, int value_len)
+ {
+@@ -1205,9 +1207,11 @@ static xattr_entry_t *find_xattr_entry(i
+ if (!xentry_hash)
+ xentry_hash = xcalloc(1, sizeof(xe) * XATTRENTRY_HASHSIZE);
+
++#ifndef NO_ACL_SUPPORT
+ if (xprefix == JFFS2_XPREFIX_ACL_ACCESS
+ || xprefix == JFFS2_XPREFIX_ACL_DEFAULT)
+ formalize_posix_acl(xvalue, &value_len);
++#endif
+
+ name_len = strlen(xname);
+ index = (crc32(0, xname, name_len) ^ crc32(0, xvalue, value_len)) % XATTRENTRY_HASHSIZE;
+--- a/rbtree.h
++++ b/rbtree.h
+@@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa
+ #ifndef _LINUX_RBTREE_H
+ #define _LINUX_RBTREE_H
+
+-#include <linux/kernel.h>
+-#include <linux/stddef.h>
++#include <stddef.h>
+
+ struct rb_node
+ {
+@@ -131,7 +130,9 @@ static inline void rb_set_color(struct r
+
+ #define RB_ROOT (struct rb_root) { NULL, }
+
++#ifndef offsetof
+ #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
++#endif
+
+ #define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
diff --git a/tools/mtd-utils/patches/110-portability_fix.patch b/tools/mtd-utils/patches/110-portability_fix.patch
deleted file mode 100644
index 3a61321..0000000
--- a/tools/mtd-utils/patches/110-portability_fix.patch
+++ /dev/null
@@ -1,61 +0,0 @@
---- /dev/null
-+++ b/include/asm/types.h
-@@ -0,0 +1,3 @@
-+#ifdef linux
-+#include_next <asm/types.h>
-+#endif
---- a/util/mkfs.jffs2.c
-+++ b/util/mkfs.jffs2.c
-@@ -68,6 +68,7 @@
- #include <zlib.h>
- #undef crc32
- #include "crc32.h"
-+#include <endian.h>
-
- /* Do not use the wierd XPG version of basename */
- #undef basename
-@@ -1032,7 +1033,7 @@ static void recursive_populate_directory
- case S_IFDIR:
- if (verbose) {
- printf("\td %04o %9lu %5d:%-3d %s\n",
-- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
-+ e->sb.st_mode & ~S_IFMT, (unsigned long)e->sb.st_size,
- (int) (e->sb.st_uid), (int) (e->sb.st_gid),
- e->name);
- }
-@@ -1041,7 +1042,7 @@ static void recursive_populate_directory
- case S_IFSOCK:
- if (verbose) {
- printf("\ts %04o %9lu %5d:%-3d %s\n",
-- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
-+ e->sb.st_mode & ~S_IFMT, (unsigned long)e->sb.st_size,
- (int) e->sb.st_uid, (int) e->sb.st_gid, e->name);
- }
- write_pipe(e);
-@@ -1049,7 +1050,7 @@ static void recursive_populate_directory
- case S_IFIFO:
- if (verbose) {
- printf("\tp %04o %9lu %5d:%-3d %s\n",
-- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
-+ e->sb.st_mode & ~S_IFMT, (unsigned long)e->sb.st_size,
- (int) e->sb.st_uid, (int) e->sb.st_gid, e->name);
- }
- write_pipe(e);
-@@ -1075,7 +1076,7 @@ static void recursive_populate_directory
- case S_IFLNK:
- if (verbose) {
- printf("\tl %04o %9lu %5d:%-3d %s -> %s\n",
-- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
-+ e->sb.st_mode & ~S_IFMT, (unsigned long)e->sb.st_size,
- (int) e->sb.st_uid, (int) e->sb.st_gid, e->name,
- e->link);
- }
-@@ -1084,7 +1085,7 @@ static void recursive_populate_directory
- case S_IFREG:
- if (verbose) {
- printf("\tf %04o %9lu %5d:%-3d %s\n",
-- e->sb.st_mode & ~S_IFMT, e->sb.st_size,
-+ e->sb.st_mode & ~S_IFMT, (unsigned long)e->sb.st_size,
- (int) e->sb.st_uid, (int) e->sb.st_gid, e->name);
- }
- write_regular_file(e);