aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorImre Kaloz <kaloz@openwrt.org>2015-05-26 09:25:30 +0000
committerImre Kaloz <kaloz@openwrt.org>2015-05-26 09:25:30 +0000
commit94a2f9fedebfd48166970d9cd03430129974b949 (patch)
treeb5defc210aa1e3953205e6ae177a8355e56b42f2 /tools
parent3fe418e4e0bad06e4b33aa475261a6c0b4863600 (diff)
downloadmaster-187ad058-94a2f9fedebfd48166970d9cd03430129974b949.tar.gz
master-187ad058-94a2f9fedebfd48166970d9cd03430129974b949.tar.bz2
master-187ad058-94a2f9fedebfd48166970d9cd03430129974b949.zip
tools/mtd-utils: upgrade to latest git
Signed-off-by: Imre Kaloz <kaloz@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45760 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools')
-rw-r--r--tools/mtd-utils/Makefile25
-rw-r--r--tools/mtd-utils/patches/100-sscanf_fix.patch2
-rw-r--r--tools/mtd-utils/patches/110-portability.patch72
-rw-r--r--tools/mtd-utils/patches/120-cygwin_fixes.patch457
-rw-r--r--tools/mtd-utils/patches/130-lzma_jffs2.patch27
-rw-r--r--tools/mtd-utils/patches/131-fix_lib_compile.patch11
-rw-r--r--tools/mtd-utils/patches/133-error-fix.patch20
-rw-r--r--tools/mtd-utils/patches/134-freebsd_loff_t.patch13
-rw-r--r--tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch32
-rw-r--r--tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch110
-rw-r--r--tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch4
-rw-r--r--tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch4
-rw-r--r--tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch35
13 files changed, 180 insertions, 632 deletions
diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile
index aa0919a7b9..f831e3c348 100644
--- a/tools/mtd-utils/Makefile
+++ b/tools/mtd-utils/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2006-2012 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -7,14 +7,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mtd-utils
-PKG_VERSION:=1.4.5
+PKG_VERSION:=1.5.1
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_VERSION:=92686f212c9a4e16891c6a3c57629cbf4f0f8360
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=5319b84974fcb71504aed2d1b8285e9c0a4a4bb8
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_MIRROR_MD5SUM:=a85581474b39e56b30439c903974acb9
+PKG_MIRROR_MD5SUM:=154592f5bbb01e1e98bdd26c8a592305
PKG_CAT:=zcat
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
@@ -31,31 +31,20 @@ MTD_MAKEOPTS = \
CFLAGS="$(CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
WITHOUT_LZO=1 WITHOUT_XATTR=1 \
- LZMA_STATIC_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \
SUBDIRS="" \
BUILDDIR="$(HOST_BUILD_DIR)"
define Host/Compile
- $(MAKE) -C $(HOST_BUILD_DIR)/lib \
- $(MTD_MAKEOPTS) \
- TARGETS="libmtd.a libcrc32.a" \
- LIBS="libmtd libcrc32"
$(MAKE) -C $(HOST_BUILD_DIR) \
$(MTD_MAKEOPTS) \
- TARGETS=mkfs.jffs2
- $(MAKE) -C $(HOST_BUILD_DIR)/ubi-utils \
- $(MTD_MAKEOPTS) \
- TARGETS=ubinize
- $(MAKE) -C $(HOST_BUILD_DIR)/mkfs.ubifs \
- $(MTD_MAKEOPTS) \
- BUILDDIR="$(HOST_BUILD_DIR)/mkfs.ubifs"
+ TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs"
endef
define Host/Install
$(CP) \
$(HOST_BUILD_DIR)/mkfs.jffs2 \
$(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
- $(HOST_BUILD_DIR)/ubinize \
+ $(HOST_BUILD_DIR)/ubi-utils/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 2d31f41da7..0af583f4cb 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
-@@ -423,7 +423,7 @@ static int interpret_table_entry(struct
+@@ -422,7 +422,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 727c0e6c59..4ad209a449 100644
--- a/tools/mtd-utils/patches/110-portability.patch
+++ b/tools/mtd-utils/patches/110-portability.patch
@@ -50,7 +50,7 @@
#define UBI_VERSION 1
--- a/mkfs.ubifs/mkfs.ubifs.h
+++ b/mkfs.ubifs/mkfs.ubifs.h
-@@ -34,7 +34,17 @@
+@@ -32,7 +32,17 @@
#include <endian.h>
#include <byteswap.h>
#include <linux/types.h>
@@ -70,18 +70,7 @@
#include <sys/types.h>
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
-@@ -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");
-
-- if (lseek64(out_fd, pos, SEEK_SET) != pos)
-- return sys_err_msg("lseek64 failed seeking %lld",
-+ if (llseek(out_fd, pos, SEEK_SET) != pos)
-+ return sys_err_msg("llseek failed seeking %lld",
- (long long)pos);
-
- if (write(out_fd, buf, c->leb_size) != c->leb_size)
-@@ -1079,6 +1079,7 @@ static int add_inode_with_data(struct st
+@@ -1010,6 +1010,7 @@ static int add_inode_with_data(struct st
if (c->default_compr != UBIFS_COMPR_NONE)
use_flags |= UBIFS_COMPR_FL;
@@ -89,7 +78,7 @@
if (flags & FS_COMPR_FL)
use_flags |= UBIFS_COMPR_FL;
if (flags & FS_SYNC_FL)
-@@ -1089,6 +1090,7 @@ static int add_inode_with_data(struct st
+@@ -1020,6 +1021,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;
@@ -97,7 +86,7 @@
memset(ino, 0, UBIFS_INO_NODE_SZ);
-@@ -1158,7 +1160,9 @@ static int add_dir_inode(DIR *dir, ino_t
+@@ -1089,7 +1091,9 @@ static int add_dir_inode(DIR *dir, ino_t
fd = dirfd(dir);
if (fd == -1)
return sys_err_msg("dirfd failed");
@@ -107,7 +96,7 @@
flags = 0;
}
-@@ -1343,10 +1347,12 @@ static int add_file(const char *path_nam
+@@ -1274,10 +1278,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;
@@ -120,7 +109,7 @@
use_compr = c->default_compr;
compr_type = compress_data(buf, bytes_read, &dn->data,
&out_len, use_compr);
-@@ -1388,7 +1394,9 @@ static int add_non_dir(const char *path_
+@@ -1319,7 +1325,9 @@ static int add_non_dir(const char *path_
if (fd == -1)
return sys_err_msg("failed to open file '%s'",
path_name);
@@ -151,3 +140,52 @@
return err_msg("too long path");
if (!strcmp(buf, "/"))
+--- a/include/common.h
++++ b/include/common.h
+@@ -26,7 +26,6 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <errno.h>
+-#include <features.h>
+ #include <inttypes.h>
+ #include "version.h"
+
+@@ -117,11 +116,6 @@ extern "C" {
+ fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
+ } while(0)
+
+-#if defined(__UCLIBC__)
+-/* uClibc versions before 0.9.34 don't have rpmatch() */
+-#if __UCLIBC_MAJOR__ == 0 && \
+- (__UCLIBC_MINOR__ < 9 || \
+- (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34))
+ #undef rpmatch
+ #define rpmatch __rpmatch
+ static inline int __rpmatch(const char *resp)
+@@ -129,8 +123,6 @@ static inline int __rpmatch(const char *
+ return (resp[0] == 'y' || resp[0] == 'Y') ? 1 :
+ (resp[0] == 'n' || resp[0] == 'N') ? 0 : -1;
+ }
+-#endif
+-#endif
+
+ /**
+ * prompt the user for confirmation
+--- a/include/mtd/ubifs-media.h
++++ b/include/mtd/ubifs-media.h
+@@ -33,7 +33,15 @@
+ #ifndef __UBIFS_MEDIA_H__
+ #define __UBIFS_MEDIA_H__
+
++#ifdef __linux__
+ #include <asm/byteorder.h>
++#else
++#include <stdint.h>
++typedef uint8_t __u8;
++typedef uint16_t __be16;
++typedef uint32_t __be32;
++typedef uint64_t __be64;
++#endif
+
+ /* UBIFS node magic number (must not have the padding byte first or last) */
+ #define UBIFS_NODE_MAGIC 0x06101831
diff --git a/tools/mtd-utils/patches/120-cygwin_fixes.patch b/tools/mtd-utils/patches/120-cygwin_fixes.patch
deleted file mode 100644
index 3dc21614b1..0000000000
--- a/tools/mtd-utils/patches/120-cygwin_fixes.patch
+++ /dev/null
@@ -1,457 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -12,6 +12,11 @@ else
- LZOLDLIBS = -llzo2
- endif
-
-+ifeq ($(shell uname -o),Cygwin)
-+CPPFLAGS += -I./include/cygwin
-+endif
-+
-+ifneq ($(shell uname -o),Cygwin)
- SUBDIRS = lib ubi-utils mkfs.ubifs
- TESTS = tests
-
-@@ -23,6 +28,10 @@ TARGETS = ftl_format flash_erase nanddum
- rfddump rfdformat \
- serve_image recv_image \
- sumtool #jffs2reader
-+else
-+SUBDIRS =
-+TARGETS = mkfs.jffs2
-+endif
- SCRIPTS = flash_eraseall
-
- SYMLINKS =
---- /dev/null
-+++ b/include/cygwin/bits-byteswap.h
-@@ -0,0 +1,132 @@
-+/* Macros to swap the order of bytes in integer values.
-+ Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
-+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
-+#endif
-+
-+#ifndef _BITS_BYTESWAP_H
-+#define _BITS_BYTESWAP_H 1
-+
-+/* Swap bytes in 16 bit value. */
-+#define __bswap_constant_16(x) \
-+ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
-+
-+#ifdef __GNUC__
-+# if __GNUC__ >= 2
-+# define __bswap_16(x) \
-+ (__extension__ \
-+ ({ register unsigned short int __v, __x = (x); \
-+ if (__builtin_constant_p (__x)) \
-+ __v = __bswap_constant_16 (__x); \
-+ else \
-+ __asm__ ("rorw $8, %w0" \
-+ : "=r" (__v) \
-+ : "0" (__x) \
-+ : "cc"); \
-+ __v; }))
-+# else
-+/* This is better than nothing. */
-+# define __bswap_16(x) \
-+ (__extension__ \
-+ ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
-+# endif
-+#else
-+static __inline unsigned short int
-+__bswap_16 (unsigned short int __bsx)
-+{
-+ return __bswap_constant_16 (__bsx);
-+}
-+#endif
-+
-+/* Swap bytes in 32 bit value. */
-+#define __bswap_constant_32(x) \
-+ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
-+ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
-+
-+#ifdef __GNUC__
-+# if __GNUC__ >= 2
-+/* To swap the bytes in a word the i486 processors and up provide the
-+ `bswap' opcode. On i386 we have to use three instructions. */
-+# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
-+# define __bswap_32(x) \
-+ (__extension__ \
-+ ({ register unsigned int __v, __x = (x); \
-+ if (__builtin_constant_p (__x)) \
-+ __v = __bswap_constant_32 (__x); \
-+ else \
-+ __asm__ ("rorw $8, %w0;" \
-+ "rorl $16, %0;" \
-+ "rorw $8, %w0" \
-+ : "=r" (__v) \
-+ : "0" (__x) \
-+ : "cc"); \
-+ __v; }))
-+# else
-+# define __bswap_32(x) \
-+ (__extension__ \
-+ ({ register unsigned int __v, __x = (x); \
-+ if (__builtin_constant_p (__x)) \
-+ __v = __bswap_constant_32 (__x); \
-+ else \
-+ __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); \
-+ __v; }))
-+# endif
-+# else
-+# define __bswap_32(x) \
-+ (__extension__ \
-+ ({ register unsigned int __x = (x); __bswap_constant_32 (__x); }))
-+# endif
-+#else
-+static __inline unsigned int
-+__bswap_32 (unsigned int __bsx)
-+{
-+ return __bswap_constant_32 (__bsx);
-+}
-+#endif
-+
-+
-+#if defined __GNUC__ && __GNUC__ >= 2
-+/* Swap bytes in 64 bit value. */
-+#define __bswap_constant_64(x) \
-+ ((((x) & 0xff00000000000000ull) >> 56) \
-+ | (((x) & 0x00ff000000000000ull) >> 40) \
-+ | (((x) & 0x0000ff0000000000ull) >> 24) \
-+ | (((x) & 0x000000ff00000000ull) >> 8) \
-+ | (((x) & 0x00000000ff000000ull) << 8) \
-+ | (((x) & 0x0000000000ff0000ull) << 24) \
-+ | (((x) & 0x000000000000ff00ull) << 40) \
-+ | (((x) & 0x00000000000000ffull) << 56))
-+
-+# define __bswap_64(x) \
-+ (__extension__ \
-+ ({ union { __extension__ unsigned long long int __ll; \
-+ unsigned long int __l[2]; } __w, __r; \
-+ if (__builtin_constant_p (x)) \
-+ __r.__ll = __bswap_constant_64 (x); \
-+ else \
-+ { \
-+ __w.__ll = (x); \
-+ __r.__l[0] = __bswap_32 (__w.__l[1]); \
-+ __r.__l[1] = __bswap_32 (__w.__l[0]); \
-+ } \
-+ __r.__ll; }))
-+#endif
-+
-+#endif /* _BITS_BYTESWAP_H */
---- /dev/null
-+++ b/include/cygwin/byteswap.h
-@@ -0,0 +1,40 @@
-+/* Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _BYTESWAP_H
-+#define _BYTESWAP_H 1
-+
-+/* Get the machine specific, optimized definitions. */
-+#include "bits-byteswap.h"
-+
-+
-+/* The following definitions must all be macros since otherwise some
-+ of the possible optimizations are not possible. */
-+
-+/* Return a value with all bytes in the 16 bit argument swapped. */
-+#define bswap_16(x) __bswap_16 (x)
-+
-+/* Return a value with all bytes in the 32 bit argument swapped. */
-+#define bswap_32(x) __bswap_32 (x)
-+
-+#if defined __GNUC__ && __GNUC__ >= 2
-+/* Return a value with all bytes in the 64 bit argument swapped. */
-+# define bswap_64(x) __bswap_64 (x)
-+#endif
-+
-+#endif /* byteswap.h */
---- /dev/null
-+++ b/include/cygwin/endian.h
-@@ -0,0 +1,26 @@
-+#ifndef _CYGENDIAN_H_
-+#define _CYGENDIAN_H_
-+
-+#ifdef __CYGWIN__
-+
-+#include <sys/param.h>
-+
-+#ifndef __BIG_ENDIAN
-+#define __BIG_ENDIAN 4321
-+#endif
-+
-+#ifndef __LITTLE_ENDIAN
-+#define __LITTLE_ENDIAN 1234
-+#endif
-+
-+#ifndef __BYTE_ORDER
-+#define __BYTE_ORDER __LITTLE_ENDIAN
-+#endif
-+
-+#ifndef BYTE_ORDER
-+#define BYTE_ORDER __LITTLE_ENDIAN
-+#endif
-+
-+#endif /* __CYGWIN__ */
-+
-+#endif /* _CYGENDIAN_H_ */
---- /dev/null
-+++ b/include/cygwin/ioctl.h
-@@ -0,0 +1,38 @@
-+#ifndef _CYGIOCTL_H_
-+#define _CYGIOCTL_H_
-+
-+#ifdef __CYGWIN__
-+
-+#define _IOC_NRBITS 8
-+#define _IOC_TYPEBITS 8
-+#define _IOC_SIZEBITS 14
-+#define _IOC_DIRBITS 2
-+
-+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
-+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
-+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
-+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
-+
-+#define _IOC_NRSHIFT 0
-+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
-+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
-+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
-+
-+#define _IOC_NONE 0U
-+#define _IOC_WRITE 1U
-+#define _IOC_READ 2U
-+
-+#define _IOC(dir,type,nr,size) \
-+ (((dir) << _IOC_DIRSHIFT) | \
-+ ((type) << _IOC_TYPESHIFT) | \
-+ ((nr) << _IOC_NRSHIFT) | \
-+ ((size) << _IOC_SIZESHIFT))
-+
-+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
-+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
-+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
-+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
-+
-+#endif /* __CYGWIN__ */
-+
-+#endif /* _CYGIOCTL_H_ */
---- /dev/null
-+++ b/include/cygwin/pread.c
-@@ -0,0 +1,41 @@
-+#ifdef __CYGWIN__
-+
-+#include <errno.h>
-+
-+ssize_t
-+pread(int fd, void *p, size_t n, off_t off)
-+{
-+ off_t ooff;
-+ int oerrno;
-+
-+ if ((ooff = lseek(fd, off, SEEK_SET)) == -1)
-+ return -1;
-+
-+ n = read(fd, p, n);
-+
-+ oerrno = errno;
-+ lseek(fd, ooff, SEEK_SET);
-+ errno = oerrno;
-+
-+ return n;
-+}
-+
-+ssize_t
-+pwrite(int fd, const void *p, size_t n, off_t off)
-+{
-+ off_t ooff;
-+ int oerrno;
-+
-+ if ((ooff = lseek(fd, off, SEEK_SET)) == -1)
-+ return -1;
-+
-+ n = write(fd, p, n);
-+
-+ oerrno = errno;
-+ lseek(fd, ooff, SEEK_SET);
-+ errno = oerrno;
-+
-+ return n;
-+}
-+
-+#endif /* __CYGWIN__ */
---- /dev/null
-+++ b/lnconf.sh
-@@ -0,0 +1,53 @@
-+#!/bin/sh
-+#
-+# Generic configure replacement.
-+#
-+# $Id: lnconf.sh,v 1.1 2004/04/05 21:55:59 igor Exp $
-+#
-+# Copies all files from the script directory to the current one.
-+# Intended to replace 'configure' for packages that don't have one, to
-+# allow building outside of the source tree.
-+#
-+# Note: this does not do any fancy things with detecting shells and
-+# supporting other platforms. But it should work on Cygwin.
-+
-+# find out where the script is located
-+tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
-+test "x$tdir" = "x$0" && tdir=.
-+
-+a_srcdir=`cd $tdir; pwd`
-+a_destdir=`pwd`
-+
-+# sanity checks:
-+# are we in the script directory?
-+test "x$a_srcdir" = "x$a_destdir" && exit 0
-+# is there any chance that this is the script directory?
-+test "x`cd "$a_srcdir" && /bin/ls -id`" = "x`/bin/ls -id`" && exit 0
-+
-+# try to find lndir and use it if it's available
-+LNDIR="`which lndir 2>/dev/null`"
-+if [ "x$LNDIR" = "x" ]; then
-+ lndir() {
-+ test "x$1" = "x" && return 1
-+ # be careful of the current directory
-+ DINODE=`find . -maxdepth 0 -ls | sed 's/ .*$//'`
-+ case "`pwd`" in
-+ "`cd "$1" && pwd`"/*) CUR="-type d -inum $DINODE -prune -o";;
-+ esac
-+ # duplicate the directory structure
-+ (cd "$1" && find . $CUR -type d -mindepth 1 -print) | xargs -tr mkdir -p
-+ # copy all symbolic links
-+ (cd "$1" && find . $CUR -type l -mindepth 1 -print) | xargs -ri sh -c "ln -s \"\`readlink "$1/{}"\`\" \"{}\""
-+ # or simply
-+ #(cd "$1" && find . $CUR -type l -mindepth 1 -print) | xargs -ri ln -s "$1"/{} {}
-+ # link all files
-+ (cd "$1" && find . $CUR -type f -mindepth 1 -print) | xargs -ri ln -s "$1"/{} {}
-+ }
-+else
-+ lndir() {
-+ "$LNDIR" "$@"
-+ }
-+fi
-+
-+lndir "$tdir"
-+
---- a/mkfs.jffs2.c
-+++ b/mkfs.jffs2.c
-@@ -77,6 +77,14 @@
- #include "rbtree.h"
- #include "common.h"
-
-+#ifdef __CYGWIN__
-+#include <cygwin/ioctl.h>
-+#include <cygwin/endian.h>
-+#include <cygwin/pread.c>
-+# define IFTODT(mode) (((mode) & 0170000) >> 12)
-+# define DTTOIF(dirtype) ((dirtype) << 12)
-+#endif /* __CYGWIN__ */
-+
- /* Do not use the weird XPG version of basename */
- #undef basename
-
-@@ -376,7 +384,7 @@ static struct filesystem_entry *recursiv
- the following macros use it if available or use a hacky workaround...
- */
-
--#ifdef __GNUC__
-+#if defined __GNUC__ && !defined __CYGWIN__
- #define SCANF_PREFIX "a"
- #define SCANF_STRING(s) (&s)
- #define GETCWD_SIZE 0
-@@ -459,6 +467,14 @@ static int interpret_table_entry(struct
- }
- entry = find_filesystem_entry(root, name, mode);
- 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);
-+ free(name);
-+ free(hostpath);
-+ return 1;
-+ }
-+
- /* Ok, we just need to fixup the existing entry
- * and we will be all done... */
- entry->sb.st_uid = uid;
-@@ -468,11 +484,21 @@ static int interpret_table_entry(struct
- entry->sb.st_rdev = makedev(major, minor);
- }
- } else {
-+ if (type == 'f' || type == 'l') {
-+ error_msg ("skipping device_table entry '%s': file does not exist!", name);
-+ free(name);
-+ free(hostpath);
-+ return 1;
-+ }
- /* If parent is NULL (happens with device table entries),
- * try and find our parent now) */
- tmp = strdup(name);
- dir = dirname(tmp);
-- parent = find_filesystem_entry(root, dir, S_IFDIR);
-+ if (!strcmp(dir, "/")) {
-+ parent = root;
-+ } else {
-+ parent = find_filesystem_entry(root, dir, S_IFDIR);
-+ }
- free(tmp);
- if (parent == NULL) {
- errmsg ("skipping device_table entry '%s': no parent directory!", name);
-@@ -486,6 +512,7 @@ static int interpret_table_entry(struct
- add_host_filesystem_entry(name, hostpath, uid, gid, mode, 0, parent);
- break;
- case 'f':
-+ case 'l':
- add_host_filesystem_entry(name, hostpath, uid, gid, mode, 0, parent);
- break;
- case 'p':
---- a/ubi-utils/src/libubi.c
-+++ b/ubi-utils/src/libubi.c
-@@ -32,6 +32,9 @@
- #include <sys/ioctl.h>
- #include <sys/stat.h>
- #include <sys/types.h>
-+#ifdef __CYGWIN__
-+#include <cygwin/ioctl.h>
-+#endif
- #include <libubi.h>
- #include "libubi_int.h"
- #include "common.h"
diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch
index be1c361fe1..17f9978bef 100644
--- a/tools/mtd-utils/patches/130-lzma_jffs2.patch
+++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch
@@ -1,25 +1,24 @@
--- a/Makefile
+++ b/Makefile
-@@ -1,7 +1,7 @@
+@@ -4,6 +4,7 @@
+ VERSION = 1.5.1
- # -*- sh -*-
-
--CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
-+CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) -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
-@@ -59,7 +59,9 @@ $(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 $(WITHOUT_LZO),,compr_lzo.o) \
+@@ -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)
++ compr.o rbtree.o
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 +5012,7 @@
+}
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
-@@ -1685,11 +1685,11 @@ int main(int argc, char **argv)
+@@ -1659,11 +1659,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
deleted file mode 100644
index 8c977c1774..0000000000
--- a/tools/mtd-utils/patches/131-fix_lib_compile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -7,7 +7,7 @@ SUBDIRS =
- # CFLAGS += -Werror
- CPPFLAGS += -I../include
- 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
deleted file mode 100644
index 4854138d02..0000000000
--- a/tools/mtd-utils/patches/133-error-fix.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/mkfs.jffs2.c
-+++ b/mkfs.jffs2.c
-@@ -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);
-+ sys_errmsg ("skipping device_table entry '%s': type mismatch!", name);
- free(name);
- free(hostpath);
- return 1;
-@@ -485,7 +485,7 @@ static int interpret_table_entry(struct
- }
- } else {
- if (type == 'f' || type == 'l') {
-- error_msg ("skipping device_table entry '%s': file does not exist!", name);
-+ sys_errmsg ("skipping device_table entry '%s': file does not exist!", name);
- free(name);
- free(hostpath);
- return 1;
diff --git a/tools/mtd-utils/patches/134-freebsd_loff_t.patch b/tools/mtd-utils/patches/134-freebsd_loff_t.patch
index 68a835292c..2d141bd7a3 100644
--- a/tools/mtd-utils/patches/134-freebsd_loff_t.patch
+++ b/tools/mtd-utils/patches/134-freebsd_loff_t.patch
@@ -1,13 +1,14 @@
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
-@@ -114,8 +114,8 @@ struct otp_info {
- #define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
- #define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
+@@ -171,9 +171,9 @@ struct otp_info {
+ /* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */
#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
+ /* Check if an eraseblock is bad */
-#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
--#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
+#define MEMGETBADBLOCK _IOW('M', 11, loff_t)
+ /* Mark an eraseblock as bad */
+-#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
+#define MEMSETBADBLOCK _IOW('M', 12, loff_t)
+ /* Set OTP (One-Time Programmable) mode (factory vs. user) */
#define OTPSELECT _IOR('M', 13, int)
- #define OTPGETREGIONCOUNT _IOW('M', 14, int)
- #define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
+ /* Get number of OTP (One-Time Programmable) regions */
diff --git a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
index 82b6c2fe94..90d4ef4c36 100644
--- a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
+++ b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch
@@ -8,15 +8,15 @@
#include <linux/types.h>
#define crc32 __zlib_crc32
-@@ -35,7 +34,6 @@
- #include "ubifs-media.h"
+@@ -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_;
-@@ -86,6 +84,25 @@ static int zlib_deflate(void *in_buf, si
+@@ -85,6 +83,25 @@ static int zlib_deflate(void *in_buf, si
return 0;
}
@@ -42,7 +42,7 @@
static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
{
-@@ -103,6 +120,12 @@ static int lzo_compress(void *in_buf, si
+@@ -102,6 +119,12 @@ static int lzo_compress(void *in_buf, si
return 0;
}
@@ -55,7 +55,7 @@
static int no_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
-@@ -123,7 +146,6 @@ static int favor_lzo_compress(void *in_b
+@@ -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);
@@ -63,7 +63,7 @@
if (lzo_ret && zlib_ret)
/* Both compressors failed */
return -1;
-@@ -198,23 +220,28 @@ int compress_data(void *in_buf, size_t i
+@@ -197,23 +219,28 @@ int compress_data(void *in_buf, size_t i
int init_compression(void)
{
@@ -100,20 +100,20 @@
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
+--- 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 -L$(BUILDDIR)/../ubi-utils/ -lubi
- LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd
- LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
++LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
+ $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
+ #
diff --git a/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch b/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch
index 1e44ba4c27..d97c244faf 100644
--- a/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch
+++ b/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch
@@ -1,17 +1,32 @@
--- a/Makefile
+++ b/Makefile
-@@ -1,7 +1,7 @@
+@@ -4,7 +4,7 @@
+ VERSION = 1.5.1
- # -*- sh -*-
-
--CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) -I./include/linux/lzma
-+CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(XZCPPFLAGS) -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
++CPPFLAGS += $(XZCPPFLAGS) -I./include/linux/lzma
ifeq ($(WITHOUT_XATTR), 1)
CPPFLAGS += -DWITHOUT_XATTR
+@@ -113,8 +113,13 @@ ifeq ($(WITHOUT_LZO), 1)
+ else
+ LZOLDLIBS = -llzo2
+ endif
++ifeq ($(WITHOUT_XZ), 1)
++ CPPFLAGS += -DWITHOUT_XZ
++else
++ XZLDLIBS = -llzma
++endif
+
+-LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
++LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid
+ $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
+
+ #
--- a/mkfs.ubifs/compr.c
+++ b/mkfs.ubifs/compr.c
-@@ -127,6 +127,114 @@ static inline int lzo_init(void) { retur
+@@ -126,6 +126,114 @@ static inline int lzo_init(void) { retur
static inline void lzo_fini(void) { }
#endif
@@ -126,7 +141,7 @@
static int no_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
{
-@@ -199,6 +307,9 @@ int compress_data(void *in_buf, size_t i
+@@ -198,6 +306,9 @@ int compress_data(void *in_buf, size_t i
case MKFS_UBIFS_COMPR_LZO:
ret = lzo_compress(in_buf, in_len, out_buf, out_len);
break;
@@ -136,7 +151,7 @@
case MKFS_UBIFS_COMPR_ZLIB:
ret = zlib_deflate(in_buf, in_len, out_buf, out_len);
break;
-@@ -226,12 +337,18 @@ int init_compression(void)
+@@ -225,12 +336,18 @@ int init_compression(void)
if (ret)
goto err;
@@ -156,7 +171,7 @@
err_lzo:
lzo_fini();
err:
-@@ -241,6 +358,7 @@ err:
+@@ -240,6 +357,7 @@ err:
void destroy_compression(void)
{
free(zlib_buf);
@@ -174,50 +189,9 @@
};
int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
---- a/mkfs.ubifs/Makefile
-+++ b/mkfs.ubifs/Makefile
-@@ -6,21 +6,33 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch]
-
- TARGETS = mkfs.ubifs
-
-+MKFS_UBIFS_OBJS = $(addprefix $(BUILDDIR)/,\
-+ crc16.o lpt.o compr.o devtable.o \
-+ hashtable/hashtable.o hashtable/hashtable_itr.o)
-+
- ifeq ($(WITHOUT_LZO), 1)
- CPPFLAGS += -DWITHOUT_LZO
- else
- LZOLDLIBS = -llzo2
- endif
-
--LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
-+ifeq ($(WITHOUT_XZ), 1)
-+ CPPFLAGS += -DWITHOUT_XZ
-+else
-+ifneq ($(LZMA_STATIC_LIB),)
-+ MKFS_UBIFS_OBJS += $(LZMA_STATIC_LIB)
-+else
-+ XZLDLIBS = -llzma
-+endif
-+endif
-+
-+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi
- LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd
--LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
-+LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(XZLDFLAGS)
-
- include ../common.mk
-
--$(BUILDDIR)/mkfs.ubifs: $(addprefix $(BUILDDIR)/,\
-- crc16.o lpt.o compr.o devtable.o \
-- hashtable/hashtable.o hashtable/hashtable_itr.o)
-+$(BUILDDIR)/mkfs.ubifs: $(MKFS_UBIFS_OBJS)
-
- clean::
- rm -f $(BUILDDIR)/hashtable/*.o cscope.*
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
-@@ -98,6 +98,9 @@ struct ubifs_info info_;
+@@ -99,6 +99,9 @@ struct ubifs_info info_;
static struct ubifs_info *c = &info_;
static libubi_t ubi;
@@ -227,20 +201,20 @@
/* Debug levels are: 0 (none), 1 (statistics), 2 (files) ,3 (more details) */
int debug_level;
int verbose;
-@@ -132,7 +135,7 @@ static struct inum_mapping **hash_table;
+@@ -133,7 +136,7 @@ static struct inum_mapping **hash_table;
/* Inode creation sequence number */
static unsigned long long creat_sqnum;
--static const char *optstring = "d:r:m:o:D:h?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQq";
-+static const char *optstring = "d:r:m:o:D:h?vVe:c:g:f:Fp:k:x:X:y:j:R:l:j:UQq";
+-static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQq";
++static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:z:j:R:l:j:UQq";
static const struct option longopts[] = {
{"root", 1, NULL, 'r'},
-@@ -149,6 +152,7 @@ static const struct option longopts[] =
+@@ -151,6 +154,7 @@ static const struct option longopts[] =
{"reserved", 1, NULL, 'R'},
{"compr", 1, NULL, 'x'},
{"favor-percent", 1, NULL, 'X'},
-+ {"force-compr", 1, NULL, 'y'},
++ {"force-compr", 1, NULL, 'z'},
{"fanout", 1, NULL, 'f'},
{"space-fixup", 0, NULL, 'F'},
{"keyhash", 1, NULL, 'k'},
@@ -255,12 +229,12 @@
"-X, --favor-percent may only be used with favor LZO compression and defines\n"
" how many percent better zlib should compress to make\n"
" mkfs.ubifs use zlib instead of LZO (default 20%)\n"
-+"-y, --force-compr=TYPE force to build the fs with different compression -\n"
++"-z, --force-compr=TYPE force to build the fs with different compression -\n"
+" \"lzo\", \"zlib\" or \"none\"\n"
"-f, --fanout=NUM fanout NUM (default: 8)\n"
"-F, --space-fixup file-system free space has to be fixed up on first mount\n"
" (requires kernel version 3.0 or greater)\n"
-@@ -530,6 +536,43 @@ static int open_ubi(const char *node)
+@@ -472,6 +478,43 @@ static int open_ubi(const char *node)
return 0;
}
@@ -304,7 +278,7 @@
static int get_options(int argc, char**argv)
{
int opt, i;
-@@ -649,14 +692,13 @@ static int get_options(int argc, char**a
+@@ -594,14 +637,13 @@ static int get_options(int argc, char**a
return err_msg("bad key hash");
break;
case 'x':
@@ -326,11 +300,11 @@
break;
case 'X':
c->favor_percent = strtol(optarg, &endp, 0);
-@@ -665,6 +707,12 @@ static int get_options(int argc, char**a
+@@ -610,6 +652,12 @@ static int get_options(int argc, char**a
return err_msg("bad favor LZO percent '%s'",
optarg);
break;
-+ case 'y':
++ case 'z':
+ if (get_compr_option(optarg, &force_compr, NULL))
+ return err_msg("bad forced compressor name '%s'",
+ optarg);
@@ -339,7 +313,7 @@
case 'j':
c->max_bud_bytes = get_bytes(optarg);
if (c->max_bud_bytes <= 0)
-@@ -749,6 +797,9 @@ static int get_options(int argc, char**a
+@@ -684,6 +732,9 @@ static int get_options(int argc, char**a
c->min_io_size = 8;
c->rp_size = add_space_overhead(c->rp_size);
@@ -349,7 +323,7 @@
if (verbose) {
printf("mkfs.ubifs\n");
printf("\troot: %s\n", root);
-@@ -758,17 +809,10 @@ static int get_options(int argc, char**a
+@@ -693,17 +744,10 @@ static int get_options(int argc, char**a
printf("\toutput: %s\n", output);
printf("\tjrn_size: %llu\n", c->max_bud_bytes);
printf("\treserved: %llu\n", c->rp_size);
@@ -371,7 +345,7 @@
printf("\tkeyhash: %s\n", (c->key_hash == key_r5_hash) ?
"r5" : "test");
printf("\tfanout: %d\n", c->fanout);
-@@ -1353,7 +1397,7 @@ static int add_file(const char *path_nam
+@@ -1284,7 +1328,7 @@ static int add_file(const char *path_nam
use_compr = UBIFS_COMPR_LZO;
else
#endif
@@ -382,7 +356,7 @@
dn->compr_type = cpu_to_le16(compr_type);
--- a/mkfs.ubifs/mkfs.ubifs.h
+++ b/mkfs.ubifs/mkfs.ubifs.h
-@@ -77,6 +77,9 @@
+@@ -83,6 +83,9 @@
#if MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB
#error MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB
#endif
@@ -392,9 +366,9 @@
extern int verbose;
extern int debug_level;
---- a/mkfs.ubifs/ubifs-media.h
-+++ b/mkfs.ubifs/ubifs-media.h
-@@ -303,6 +303,7 @@ enum {
+--- a/include/mtd/ubifs-media.h
++++ b/include/mtd/ubifs-media.h
+@@ -313,6 +313,7 @@ enum {
UBIFS_COMPR_NONE,
UBIFS_COMPR_LZO,
UBIFS_COMPR_ZLIB,
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 8bd642fbc8..95ce1e9137 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/src/libubigen.c
-+++ b/ubi-utils/src/libubigen.c
+--- a/ubi-utils/libubigen.c
++++ b/ubi-utils/libubigen.c
@@ -122,8 +122,9 @@ int ubigen_add_volume(const struct ubige
return 0;
}
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 73b0c070a7..cbb2802c5a 100644
--- a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch
+++ b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch
@@ -1,5 +1,5 @@
---- a/ubi-utils/src/ubinize.c
-+++ b/ubi-utils/src/ubinize.c
+--- a/ubi-utils/ubinize.c
++++ b/ubi-utils/ubinize.c
@@ -70,6 +70,8 @@ static const char optionsstr[] =
" (default is 1)\n"
"-Q, --image-seq=<num> 32-bit UBI image sequence number to use\n"
diff --git a/tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch b/tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch
new file mode 100644
index 0000000000..73a68b5860
--- /dev/null
+++ b/tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch
@@ -0,0 +1,35 @@
+--- a/lib/libfec.c
++++ b/lib/libfec.c
+@@ -61,8 +61,6 @@ struct timeval {
+ };
+ #define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
+ #define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
+-typedef unsigned long u_long ;
+-typedef unsigned short u_short ;
+ #else /* typically, unix systems */
+ #include <sys/time.h>
+ #define DIFF_T(a,b) \
+@@ -75,12 +73,12 @@ typedef unsigned short u_short ;
+ t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \
+ }
+ #define TOCK(t) \
+- { u_long t1 ; TICK(t1) ; \
++ { unsigned long t1 ; TICK(t1) ; \
+ if (t1 < t) t = 256000000 + t1 - t ; \
+ else t = t1 - t ; \
+ if (t == 0) t = 1 ;}
+
+-u_long ticks[10]; /* vars for timekeeping */
++unsigned long ticks[10]; /* vars for timekeeping */
+ #else
+ #define DEB(x)
+ #define DDB(x)
+@@ -625,7 +623,7 @@ init_fec(void)
+ #define FEC_MAGIC 0xFECC0DEC
+
+ struct fec_parms {
+- u_long magic ;
++ unsigned long magic ;
+ int k, n ; /* parameters of the code */
+ gf *enc_matrix ;
+ } ;