diff --git a/tools/Makefile b/tools/Makefile
index 8dfab9892b..d2b5daf18c 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -50,7 +50,7 @@ $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(
 $(curdir)/gmp/compile := $(curdir)/libtool/compile
 $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
 $(curdir)/mpfr/compile := $(curdir)/gmp/compile
-$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
+$(curdir)/mtd-utils/compile := $(curdir)/libtool/compile $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
 $(curdir)/mklibs/compile := $(curdir)/libtool/compile
 $(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
 $(curdir)/upslug2/compile := $(curdir)/libtool/compile
diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile
index 7b4a91a73d..c94de3acf8 100644
--- a/tools/mtd-utils/Makefile
+++ b/tools/mtd-utils/Makefile
@@ -7,44 +7,30 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mtd-utils
-PKG_VERSION:=1.5.2
+PKG_VERSION:=2.0.1
 
-PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1
+PKG_SOURCE_VERSION:=81049e599775bac4238361752f659a86f67328e6
 PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
 PKG_SOURCE_PROTO:=git
-PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7
+PKG_MIRROR_HASH:=a79784eb52c77dbc73a08863ce6651b3d22931e7c670cd1782168f9bba13f5a8
+PKG_FIXUP:=autoreconf
 
 include $(INCLUDE_DIR)/host-build.mk
 
-HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
-CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
-ifneq ($(HOST_OS),Linux)
-CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include endian.h -I$(CURDIR)/include -include fls.h
-MTD_STATIC := 0
-else
-MTD_STATIC := 1
-endif
-
-MTD_MAKEOPTS = \
-	CFLAGS="$(CFLAGS)" \
-	LDFLAGS="$(HOST_LDFLAGS)" \
-	WITHOUT_LZO=1 WITHOUT_XATTR=1 \
-	SUBDIRS="" \
-	BUILDDIR="$(HOST_BUILD_DIR)" \
-	STATIC=$(MTD_STATIC) \
-	V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1)
-
-define Host/Compile
-	$(MAKE) -C $(HOST_BUILD_DIR) \
-		$(MTD_MAKEOPTS) \
-		TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs"
-endef
+
+HOST_CONFIGURE_VARS+= \
+	UUID_CFLAGS="-I$(STAGING_DIR_HOST)/include/e2fsprogs/uuid"
+
+HOST_CONFIGURE_ARGS+= \
+	--disable-tests \
+	--without-xattr \
+	--without-lzo
 
 define Host/Install
 	$(CP) \
 		$(HOST_BUILD_DIR)/mkfs.jffs2 \
-		$(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
-		$(HOST_BUILD_DIR)/ubi-utils/ubinize \
+		$(HOST_BUILD_DIR)/mkfs.ubifs \
+		$(HOST_BUILD_DIR)/ubinize \
 		$(STAGING_DIR_HOST)/bin/
 endef
 
diff --git a/tools/mtd-utils/patches/100-sscanf_fix.patch b/tools/mtd-utils/patches/100-sscanf_fix.patch
index 0af583f4cb..ae6f86722b 100644
--- a/tools/mtd-utils/patches/100-sscanf_fix.patch
+++ b/tools/mtd-utils/patches/100-sscanf_fix.patch
@@ -1,6 +1,6 @@
---- a/mkfs.jffs2.c
-+++ b/mkfs.jffs2.c
-@@ -422,7 +422,7 @@ static int interpret_table_entry(struct
+--- a/jffsX-utils/mkfs.jffs2.c
++++ b/jffsX-utils/mkfs.jffs2.c
+@@ -427,7 +427,7 @@ static int interpret_table_entry(struct
  
  	if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu",
  				SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor,
diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch
index c4cdab928a..033c865830 100644
--- a/tools/mtd-utils/patches/110-portability.patch
+++ b/tools/mtd-utils/patches/110-portability.patch
@@ -1,5 +1,5 @@
---- a/compr_lzo.c
-+++ b/compr_lzo.c
+--- a/jffsX-utils/compr_lzo.c
++++ b/jffsX-utils/compr_lzo.c
 @@ -26,7 +26,6 @@
  #include <string.h>
  
@@ -8,8 +8,8 @@
  #include <linux/jffs2.h>
  #include <lzo/lzo1x.h>
  #include "compr.h"
---- a/compr_zlib.c
-+++ b/compr_zlib.c
+--- a/jffsX-utils/compr_zlib.c
++++ b/jffsX-utils/compr_zlib.c
 @@ -39,7 +39,6 @@
  #include <zlib.h>
  #undef crc32
@@ -18,8 +18,8 @@
  #include <linux/jffs2.h>
  #include "common.h"
  #include "compr.h"
---- a/rbtree.h
-+++ b/rbtree.h
+--- a/jffsX-utils/rbtree.h
++++ b/jffsX-utils/rbtree.h
 @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa
  #ifndef	_LINUX_RBTREE_H
  #define	_LINUX_RBTREE_H
@@ -48,8 +48,8 @@
  
  /* The version of UBI images supported by this implementation */
  #define UBI_VERSION 1
---- a/mkfs.ubifs/mkfs.ubifs.h
-+++ b/mkfs.ubifs/mkfs.ubifs.h
+--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
 @@ -32,7 +32,17 @@
  #include <endian.h>
  #include <byteswap.h>
@@ -68,9 +68,9 @@
  
  #include <getopt.h>
  #include <sys/types.h>
---- a/mkfs.ubifs/mkfs.ubifs.c
-+++ b/mkfs.ubifs/mkfs.ubifs.c
-@@ -1010,6 +1010,7 @@ static int add_inode_with_data(struct st
+--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+@@ -1219,6 +1219,7 @@ static int add_inode(struct stat *st, in
  
  	if (c->default_compr != UBIFS_COMPR_NONE)
  		use_flags |= UBIFS_COMPR_FL;
@@ -78,7 +78,7 @@
  	if (flags & FS_COMPR_FL)
  		use_flags |= UBIFS_COMPR_FL;
  	if (flags & FS_SYNC_FL)
-@@ -1020,6 +1021,7 @@ static int add_inode_with_data(struct st
+@@ -1229,6 +1230,7 @@ static int add_inode(struct stat *st, in
  		use_flags |= UBIFS_APPEND_FL;
  	if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode))
  		use_flags |= UBIFS_DIRSYNC_FL;
@@ -86,7 +86,7 @@
  
  	memset(ino, 0, UBIFS_INO_NODE_SZ);
  
-@@ -1089,7 +1091,9 @@ static int add_dir_inode(DIR *dir, ino_t
+@@ -1293,7 +1295,9 @@ static int add_dir_inode(const char *pat
  		fd = dirfd(dir);
  		if (fd == -1)
  			return sys_err_msg("dirfd failed");
@@ -96,20 +96,23 @@
  			flags = 0;
  	}
  
-@@ -1274,10 +1278,12 @@ static int add_file(const char *path_nam
+@@ -1476,6 +1480,7 @@ 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;
 +#ifndef NO_NATIVE_SUPPORT
  		if (c->default_compr == UBIFS_COMPR_NONE &&
  		    (flags & FS_COMPR_FL))
+ #ifdef WITHOUT_LZO
+@@ -1484,6 +1489,7 @@ static int add_file(const char *path_nam
  			use_compr = UBIFS_COMPR_LZO;
+ #endif
  		else
 +#endif
  			use_compr = c->default_compr;
  		compr_type = compress_data(buf, bytes_read, &dn->data,
  					   &out_len, use_compr);
-@@ -1319,7 +1325,9 @@ static int add_non_dir(const char *path_
+@@ -1527,7 +1533,9 @@ static int add_non_dir(const char *path_
  		if (fd == -1)
  			return sys_err_msg("failed to open file '%s'",
  					   path_name);
@@ -119,9 +122,9 @@
  			flags = 0;
  		if (close(fd) == -1)
  			return sys_err_msg("failed to close file '%s'",
---- a/mkfs.ubifs/devtable.c
-+++ b/mkfs.ubifs/devtable.c
-@@ -134,6 +134,7 @@ static int interpret_table_entry(const c
+--- a/ubifs-utils/mkfs.ubifs/devtable.c
++++ b/ubifs-utils/mkfs.ubifs/devtable.c
+@@ -135,6 +135,7 @@ static int interpret_table_entry(const c
  	unsigned int mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
  	unsigned int start = 0, increment = 0, count = 0;
  
@@ -129,7 +132,7 @@
  	if (sscanf(line, "%1023s %c %o %u %u %u %u %u %u %u",
  		   buf, &type, &mode, &uid, &gid, &major, &minor,
  		   &start, &increment, &count) < 0)
-@@ -144,8 +145,8 @@ static int interpret_table_entry(const c
+@@ -145,8 +146,8 @@ static int interpret_table_entry(const c
  		buf, type, mode, uid, gid, major, minor, start,
  		increment, count);
  
@@ -148,8 +151,8 @@
  #include <errno.h>
 -#include <features.h>
  #include <inttypes.h>
- #include "version.h"
- 
+ #include <unistd.h>
+ #include <sys/sysmacros.h>
 --- a/include/mtd/ubifs-media.h
 +++ b/include/mtd/ubifs-media.h
 @@ -33,7 +33,15 @@
diff --git a/tools/mtd-utils/patches/120-include_sysmacros.patch b/tools/mtd-utils/patches/120-include_sysmacros.patch
deleted file mode 100644
index 81ba1cfb2b..0000000000
--- a/tools/mtd-utils/patches/120-include_sysmacros.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 9a06f45ec71116d76ee4b268ebe1b33d45b06fc0 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Sat, 16 Apr 2016 22:10:43 -0400
-Subject: [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev
-
-These functions have always been defined in sys/sysmacros.h under
-Linux C libraries.  For some, including sys/types.h implicitly
-includes that as well, but glibc wants to deprecate that, and some
-others already have.  Include the header explicitly for the funcs.
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- include/common.h | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/include/common.h
-+++ b/include/common.h
-@@ -27,6 +27,7 @@
- #include <fcntl.h>
- #include <errno.h>
- #include <inttypes.h>
-+#include <sys/sysmacros.h>
- #include "version.h"
- 
- #ifndef PROGRAM_NAME
diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch
index 05ced4f42c..d9cbfeebec 100644
--- a/tools/mtd-utils/patches/130-lzma_jffs2.patch
+++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch
@@ -1,26 +1,29 @@
---- a/Makefile
-+++ b/Makefile
-@@ -4,6 +4,7 @@
- VERSION = 1.5.2
+--- a/jffsX-utils/Makemodule.am
++++ b/jffsX-utils/Makemodule.am
+@@ -4,11 +4,19 @@ mkfs_jffs2_SOURCES = \
+ 	jffsX-utils/compr_zlib.c \
+ 	jffsX-utils/compr.h \
+ 	jffsX-utils/rbtree.c \
+-	jffsX-utils/compr_lzo.c \
++	jffsX-utils/compr_lzma.c \
++	jffsX-utils/lzma/LzFind.c \
++	jffsX-utils/lzma/LzmaEnc.c \
++	jffsX-utils/lzma/LzmaDec.c \
+ 	jffsX-utils/compr.c \
+ 	jffsX-utils/compr_rtime.c
++
++if !WITHOUT_LZO
++mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c
++endif
++
+ mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+-mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS)
++mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) -I./include/linux/lzma
  
- CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS)
-+CPPFLAGS += -I./include/linux/lzma
- 
- ifeq ($(WITHOUT_XATTR), 1)
-   CPPFLAGS += -DWITHOUT_XATTR
-@@ -84,7 +85,9 @@ $(BUILDDIR)/include/version.h.tmp:
- #
- # Utils in top level
- #
--obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o
-+obj-mkfs.jffs2 = compr_rtime.o compr_zlib.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) $(LZOLDFLAGS)
- LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
- 
---- a/compr.c
-+++ b/compr.c
+ jffs2reader_SOURCES = jffsX-utils/jffs2reader.c
+ jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+--- a/jffsX-utils/compr.c
++++ b/jffsX-utils/compr.c
 @@ -520,6 +520,9 @@ int jffs2_compressors_init(void)
  #ifdef CONFIG_JFFS2_LZO
  	jffs2_lzo_init();
@@ -40,8 +43,8 @@
 +#endif
  	return 0;
  }
---- a/compr.h
-+++ b/compr.h
+--- a/jffsX-utils/compr.h
++++ b/jffsX-utils/compr.h
 @@ -18,13 +18,14 @@
  
  #define CONFIG_JFFS2_ZLIB
@@ -72,7 +75,7 @@
  
  #endif /* __JFFS2_COMPR_H__ */
 --- /dev/null
-+++ b/compr_lzma.c
++++ b/jffsX-utils/compr_lzma.c
 @@ -0,0 +1,128 @@
 +/*
 + * JFFS2 -- Journalling Flash File System, Version 2.
@@ -900,7 +903,7 @@
 +
 +#endif
 --- /dev/null
-+++ b/lzma/LzFind.c
++++ b/jffsX-utils/lzma/LzFind.c
 @@ -0,0 +1,753 @@
 +/* LzFind.c  -- Match finder for LZ algorithms
 +2008-04-04
@@ -1656,7 +1659,7 @@
 +  }
 +}
 --- /dev/null
-+++ b/lzma/LzmaDec.c
++++ b/jffsX-utils/lzma/LzmaDec.c
 @@ -0,0 +1,1014 @@
 +/* LzmaDec.c -- LZMA Decoder
 +2008-04-29
@@ -2673,7 +2676,7 @@
 +  return res;
 +}
 --- /dev/null
-+++ b/lzma/LzmaEnc.c
++++ b/jffsX-utils/lzma/LzmaEnc.c
 @@ -0,0 +1,2335 @@
 +/* LzmaEnc.c -- LZMA Encoder
 +2008-04-28
@@ -5010,9 +5013,9 @@
 +  LzmaEnc_Destroy(p, alloc, allocBig);
 +  return res;
 +}
---- a/mkfs.jffs2.c
-+++ b/mkfs.jffs2.c
-@@ -1659,11 +1659,11 @@ int main(int argc, char **argv)
+--- a/jffsX-utils/mkfs.jffs2.c
++++ b/jffsX-utils/mkfs.jffs2.c
+@@ -1666,11 +1666,11 @@ int main(int argc, char **argv)
  						  }
  						  erase_block_size *= units;
  
diff --git a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
deleted file mode 100644
index 90d4ef4c36..0000000000
--- a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
+++ /dev/null
@@ -1,119 +0,0 @@
---- a/mkfs.ubifs/compr.c
-+++ b/mkfs.ubifs/compr.c
-@@ -24,7 +24,6 @@
- #include <stdio.h>
- #include <stdint.h>
- #include <string.h>
--#include <lzo/lzo1x.h>
- #include <linux/types.h>
- 
- #define crc32 __zlib_crc32
-@@ -34,7 +33,6 @@
- #include "compr.h"
- #include "mkfs.ubifs.h"
- 
--static void *lzo_mem;
- static unsigned long long errcnt = 0;
- static struct ubifs_info *c = &info_;
- 
-@@ -85,6 +83,25 @@ static int zlib_deflate(void *in_buf, si
- 	return 0;
- }
- 
-+#ifndef WITHOUT_LZO
-+#include <lzo/lzo1x.h>
-+
-+static void *lzo_mem;
-+
-+static int lzo_init(void)
-+{
-+	lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
-+	if (!lzo_mem)
-+		return -1;
-+
-+	return 0;
-+}
-+
-+static void lzo_fini(void)
-+{
-+	free(lzo_mem);
-+}
-+
- static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
- 			size_t *out_len)
- {
-@@ -102,6 +119,12 @@ static int lzo_compress(void *in_buf, si
- 
- 	return 0;
- }
-+#else
-+static inline int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
-+			       size_t *out_len) { return -1; }
-+static inline int lzo_init(void) { return 0; }
-+static inline void lzo_fini(void) { }
-+#endif
- 
- static int no_compress(void *in_buf, size_t in_len, void *out_buf,
- 		       size_t *out_len)
-@@ -122,7 +145,6 @@ static int favor_lzo_compress(void *in_b
- 	lzo_len = zlib_len = *out_len;
- 	lzo_ret = lzo_compress(in_buf, in_len, out_buf, &lzo_len);
- 	zlib_ret = zlib_deflate(in_buf, in_len, zlib_buf, &zlib_len);
--
- 	if (lzo_ret && zlib_ret)
- 		/* Both compressors failed */
- 		return -1;
-@@ -197,23 +219,28 @@ int compress_data(void *in_buf, size_t i
- 
- int init_compression(void)
- {
--	lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
--	if (!lzo_mem)
--		return -1;
-+	int ret;
-+
-+	ret = lzo_init();
-+	if (ret)
-+		goto err;
- 
- 	zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
--	if (!zlib_buf) {
--		free(lzo_mem);
--		return -1;
--	}
-+	if (!zlib_buf)
-+		goto err_lzo;
- 
- 	return 0;
-+
-+err_lzo:
-+	lzo_fini();
-+err:
-+	return ret;
- }
- 
- void destroy_compression(void)
- {
- 	free(zlib_buf);
--	free(lzo_mem);
-+	lzo_fini();
- 	if (errcnt)
- 		fprintf(stderr, "%llu compression errors occurred\n", errcnt);
- }
---- a/Makefile
-+++ b/Makefile
-@@ -108,7 +108,13 @@ $(call _mkdep,lib/,libmtd.a)
- obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \
- 	hashtable/hashtable.o hashtable/hashtable_itr.o
- LDFLAGS_mkfs.ubifs = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDFLAGS)
--LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid
-+ifeq ($(WITHOUT_LZO), 1)
-+  CPPFLAGS += -DWITHOUT_LZO
-+else
-+  LZOLDLIBS = -llzo2
-+endif
-+
-+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
- $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
- 
- #
diff --git a/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch b/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch
index 95ce1e9137..d95ece184c 100644
--- a/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch
+++ b/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch
@@ -1,5 +1,5 @@
---- a/ubi-utils/libubigen.c
-+++ b/ubi-utils/libubigen.c
+--- a/lib/libubigen.c
++++ b/lib/libubigen.c
 @@ -122,8 +122,9 @@ int ubigen_add_volume(const struct ubige
  	return 0;
  }
@@ -75,8 +75,8 @@
  	return 0;
  
  out_free:
---- a/ubi-utils/include/libubigen.h
-+++ b/ubi-utils/include/libubigen.h
+--- a/include/libubigen.h
++++ b/include/libubigen.h
 @@ -188,6 +188,9 @@ int ubigen_write_layout_vol(const struct
  			    long long ec1, long long ec2,
  			    struct ubi_vtbl_record *vtbl, int fd);
diff --git a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch
index cbb2802c5a..0da28b71f2 100644
--- a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch
+++ b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch
@@ -1,6 +1,6 @@
 --- a/ubi-utils/ubinize.c
 +++ b/ubi-utils/ubinize.c
-@@ -70,6 +70,8 @@ static const char optionsstr[] =
+@@ -60,6 +60,8 @@ static const char optionsstr[] =
  "                             (default is 1)\n"
  "-Q, --image-seq=<num>        32-bit UBI image sequence number to use\n"
  "                             (by default a random number is picked)\n"
@@ -8,17 +8,8 @@
 +"                             output image\n"
  "-v, --verbose                be verbose\n"
  "-h, --help                   print help message\n"
- "-V, --version                print program version";
-@@ -79,7 +81,7 @@ static const char usage[] =
- "\t\t[-x <num>] [-Q <num>] [-v] [-h] [-V] [--output=<filename>] [--peb-size=<bytes>]\n"
- "\t\t[--min-io-size=<bytes>] [--sub-page-size=<bytes>] [--vid-hdr-offset=<num>]\n"
- "\t\t[--erase-counter=<num>] [--ubi-ver=<num>] [--image-seq=<num>] [--verbose] [--help]\n"
--"\t\t[--version] ini-file\n"
-+"\t\t[--eof-markers=<num>] [--version] ini-file\n"
- "Example: " PROGRAM_NAME " -o ubi.img -p 16KiB -m 512 -s 256 cfg.ini - create UBI image\n"
- "         'ubi.img' as described by configuration file 'cfg.ini'";
- 
-@@ -125,6 +127,7 @@ static const struct option long_options[
+ "-V, --version                print program version\n\n";
+@@ -79,6 +81,7 @@ static const struct option long_options[
  	{ .name = "erase-counter",  .has_arg = 1, .flag = NULL, .val = 'e' },
  	{ .name = "ubi-ver",        .has_arg = 1, .flag = NULL, .val = 'x' },
  	{ .name = "image-seq",      .has_arg = 1, .flag = NULL, .val = 'Q' },
@@ -26,7 +17,7 @@
  	{ .name = "verbose",        .has_arg = 0, .flag = NULL, .val = 'v' },
  	{ .name = "help",           .has_arg = 0, .flag = NULL, .val = 'h' },
  	{ .name = "version",        .has_arg = 0, .flag = NULL, .val = 'V' },
-@@ -144,6 +147,7 @@ struct args {
+@@ -98,6 +101,7 @@ struct args {
  	uint32_t image_seq;
  	int verbose;
  	dictionary *dict;
@@ -34,7 +25,7 @@
  };
  
  static struct args args = {
-@@ -162,7 +166,7 @@ static int parse_opt(int argc, char * co
+@@ -116,7 +120,7 @@ static int parse_opt(int argc, char * co
  		int key, error = 0;
  		unsigned long int image_seq;
  
@@ -43,7 +34,7 @@
  		if (key == -1)
  			break;
  
-@@ -222,6 +226,12 @@ static int parse_opt(int argc, char * co
+@@ -176,6 +180,12 @@ static int parse_opt(int argc, char * co
  			args.image_seq = image_seq;
  			break;
  
@@ -56,7 +47,7 @@
  		case 'v':
  			args.verbose = 1;
  			break;
-@@ -599,6 +609,18 @@ int main(int argc, char * const argv[])
+@@ -559,6 +569,18 @@ int main(int argc, char * const argv[])
  			printf("\n");
  	}
  
diff --git a/tools/mtd-utils/patches/310-add-static-linking-option.patch b/tools/mtd-utils/patches/310-add-static-linking-option.patch
deleted file mode 100644
index 828d7751e5..0000000000
--- a/tools/mtd-utils/patches/310-add-static-linking-option.patch
+++ /dev/null
@@ -1,43 +0,0 @@
---- a/common.mk
-+++ b/common.mk
-@@ -2,6 +2,16 @@ CC := $(CROSS)gcc
- AR := $(CROSS)ar
- RANLIB := $(CROSS)ranlib
- 
-+ifeq ($(STATIC),1)
-+ define static_link
-+  -Wl,-Bstatic $(1) -Wl,-Bdynamic
-+ endef
-+else
-+ define static_link
-+  $(1)
-+ endef
-+endif
-+
- # Stolen from Linux build system
- comma = ,
- try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
---- a/Makefile
-+++ b/Makefile
-@@ -89,10 +89,10 @@ obj-mkfs.jffs2 = compr_rtime.o compr_zli
- 	compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \
- 	compr.o rbtree.o
- LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
--LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
-+LDLIBS_mkfs.jffs2  = $(call static_link,-lz $(LZOLDLIBS))
- 
- LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
--LDLIBS_jffs2reader  = -lz $(LZOLDLIBS)
-+LDLIBS_jffs2reader  = $(call static_link,-lz $(LZOLDLIBS))
- 
- $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
- 
-@@ -114,7 +114,7 @@ else
-   LZOLDLIBS = -llzo2
- endif
- 
--LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
-+LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS)) -lm $(call static_link,-luuid)
- $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
- 
- #
diff --git a/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
index 70e6a7e360..8e58059576 100644
--- a/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
+++ b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
@@ -1,6 +1,6 @@
---- a/mkfs.jffs2.c
-+++ b/mkfs.jffs2.c
-@@ -108,7 +108,7 @@ static char *rootdir = default_rootdir;
+--- a/jffsX-utils/mkfs.jffs2.c
++++ b/jffsX-utils/mkfs.jffs2.c
+@@ -109,7 +109,7 @@ static char *rootdir = default_rootdir;
  static int verbose = 0;
  static int squash_uids = 0;
  static int squash_perms = 0;
@@ -8,8 +8,8 @@
 +static time_t fixed_timestamp = -1;
  int target_endian = __BYTE_ORDER;
  
- uint32_t find_hardlink(struct filesystem_entry *e)
-@@ -249,8 +249,8 @@ static struct filesystem_entry *add_host
+ static uint32_t find_hardlink(struct filesystem_entry *e)
+@@ -250,8 +250,8 @@ static struct filesystem_entry *add_host
  			mode &= ~(S_ISUID | S_ISGID);
  		}
  	}
@@ -20,7 +20,7 @@
  	}
  
  	entry = xcalloc(1, sizeof(struct filesystem_entry));
-@@ -1554,6 +1554,20 @@ void parse_image(){
+@@ -1557,6 +1557,20 @@ static void parse_image(void){
  	close(in_fd);
  }
  
@@ -41,7 +41,7 @@
  int main(int argc, char **argv)
  {
  	int c, opt;
-@@ -1572,6 +1586,7 @@ int main(int argc, char **argv)
+@@ -1575,6 +1589,7 @@ int main(int argc, char **argv)
  		warn_page_size = 1; /* warn user if page size not 4096 */
  
  	jffs2_compressors_init();
@@ -49,7 +49,7 @@
  
  	while ((opt = getopt_long(argc, argv,
  					"D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
-@@ -1622,7 +1637,7 @@ int main(int argc, char **argv)
+@@ -1625,7 +1640,7 @@ int main(int argc, char **argv)
  				break;
  
  			case 'f':
