tools/mtd-utils: upgrade to latest git

Signed-off-by: Imre Kaloz <kaloz@openwrt.org>

SVN-Revision: 45760
This commit is contained in:
Imre Kaloz 2015-05-26 09:25:30 +00:00
parent a621b8c284
commit df23709f16
13 changed files with 180 additions and 632 deletions

View file

@ -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. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -7,14 +7,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mtd-utils 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_URL:=git://git.infradead.org/mtd-utils.git
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=5319b84974fcb71504aed2d1b8285e9c0a4a4bb8
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_MIRROR_MD5SUM:=a85581474b39e56b30439c903974acb9 PKG_MIRROR_MD5SUM:=154592f5bbb01e1e98bdd26c8a592305
PKG_CAT:=zcat PKG_CAT:=zcat
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
@ -31,31 +31,20 @@ MTD_MAKEOPTS = \
CFLAGS="$(CFLAGS)" \ CFLAGS="$(CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \
WITHOUT_LZO=1 WITHOUT_XATTR=1 \ WITHOUT_LZO=1 WITHOUT_XATTR=1 \
LZMA_STATIC_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \
SUBDIRS="" \ SUBDIRS="" \
BUILDDIR="$(HOST_BUILD_DIR)" BUILDDIR="$(HOST_BUILD_DIR)"
define Host/Compile define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)/lib \
$(MTD_MAKEOPTS) \
TARGETS="libmtd.a libcrc32.a" \
LIBS="libmtd libcrc32"
$(MAKE) -C $(HOST_BUILD_DIR) \ $(MAKE) -C $(HOST_BUILD_DIR) \
$(MTD_MAKEOPTS) \ $(MTD_MAKEOPTS) \
TARGETS=mkfs.jffs2 TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs"
$(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"
endef endef
define Host/Install define Host/Install
$(CP) \ $(CP) \
$(HOST_BUILD_DIR)/mkfs.jffs2 \ $(HOST_BUILD_DIR)/mkfs.jffs2 \
$(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \ $(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
$(HOST_BUILD_DIR)/ubinize \ $(HOST_BUILD_DIR)/ubi-utils/ubinize \
$(STAGING_DIR_HOST)/bin/ $(STAGING_DIR_HOST)/bin/
endef endef

View file

@ -1,6 +1,6 @@
--- a/mkfs.jffs2.c --- a/mkfs.jffs2.c
+++ b/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", if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu",
SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor, SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor,

View file

@ -50,7 +50,7 @@
#define UBI_VERSION 1 #define UBI_VERSION 1
--- a/mkfs.ubifs/mkfs.ubifs.h --- a/mkfs.ubifs/mkfs.ubifs.h
+++ b/mkfs.ubifs/mkfs.ubifs.h +++ b/mkfs.ubifs/mkfs.ubifs.h
@@ -34,7 +34,17 @@ @@ -32,7 +32,17 @@
#include <endian.h> #include <endian.h>
#include <byteswap.h> #include <byteswap.h>
#include <linux/types.h> #include <linux/types.h>
@ -70,18 +70,7 @@
#include <sys/types.h> #include <sys/types.h>
--- a/mkfs.ubifs/mkfs.ubifs.c --- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c +++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -821,8 +821,8 @@ int write_leb(int lnum, int len, void *b @@ -1010,6 +1010,7 @@ static int add_inode_with_data(struct st
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
if (c->default_compr != UBIFS_COMPR_NONE) if (c->default_compr != UBIFS_COMPR_NONE)
use_flags |= UBIFS_COMPR_FL; use_flags |= UBIFS_COMPR_FL;
@ -89,7 +78,7 @@
if (flags & FS_COMPR_FL) if (flags & FS_COMPR_FL)
use_flags |= UBIFS_COMPR_FL; use_flags |= UBIFS_COMPR_FL;
if (flags & FS_SYNC_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; use_flags |= UBIFS_APPEND_FL;
if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode)) if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode))
use_flags |= UBIFS_DIRSYNC_FL; use_flags |= UBIFS_DIRSYNC_FL;
@ -97,7 +86,7 @@
memset(ino, 0, UBIFS_INO_NODE_SZ); 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); fd = dirfd(dir);
if (fd == -1) if (fd == -1)
return sys_err_msg("dirfd failed"); return sys_err_msg("dirfd failed");
@ -107,7 +96,7 @@
flags = 0; 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); key_write(&key, &dn->key);
dn->size = cpu_to_le32(bytes_read); dn->size = cpu_to_le32(bytes_read);
out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
@ -120,7 +109,7 @@
use_compr = c->default_compr; use_compr = c->default_compr;
compr_type = compress_data(buf, bytes_read, &dn->data, compr_type = compress_data(buf, bytes_read, &dn->data,
&out_len, use_compr); &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) if (fd == -1)
return sys_err_msg("failed to open file '%s'", return sys_err_msg("failed to open file '%s'",
path_name); path_name);
@ -151,3 +140,52 @@
return err_msg("too long path"); return err_msg("too long path");
if (!strcmp(buf, "/")) 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

View file

@ -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"

View file

@ -1,25 +1,24 @@
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -1,7 +1,7 @@ @@ -4,6 +4,7 @@
VERSION = 1.5.1
# -*- sh -*- CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS)
+CPPFLAGS += -I./include/linux/lzma
-CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
+CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) -I./include/linux/lzma
ifeq ($(WITHOUT_XATTR), 1) ifeq ($(WITHOUT_XATTR), 1)
CPPFLAGS += -DWITHOUT_XATTR CPPFLAGS += -DWITHOUT_XATTR
@@ -59,7 +59,9 @@ $(SYMLINKS): @@ -84,7 +85,9 @@ $(BUILDDIR)/include/version.h.tmp:
ln -sf ../fs/jffs2/$@ $@ #
# Utils in top level
$(BUILDDIR)/mkfs.jffs2: $(addprefix $(BUILDDIR)/,\ #
- compr_rtime.o mkfs.jffs2.o compr_zlib.o compr_lzo.o \ -obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o
+ compr_rtime.o mkfs.jffs2.o compr_zlib.o \ +obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o $(if $(WITHOUT_LZO),,compr_lzo.o)\
+ $(if $(WITHOUT_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) + compr.o rbtree.o
LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS)
--- a/compr.c --- a/compr.c
+++ b/compr.c +++ b/compr.c
@@ -520,6 +520,9 @@ int jffs2_compressors_init(void) @@ -520,6 +520,9 @@ int jffs2_compressors_init(void)
@ -5013,7 +5012,7 @@
+} +}
--- a/mkfs.jffs2.c --- a/mkfs.jffs2.c
+++ b/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; erase_block_size *= units;

View file

@ -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

View file

@ -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;

View file

@ -1,13 +1,14 @@
--- a/include/mtd/mtd-abi.h --- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h
@@ -114,8 +114,8 @@ struct otp_info { @@ -171,9 +171,9 @@ struct otp_info {
#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) /* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */
#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) #define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
/* Check if an eraseblock is bad */
-#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) -#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
-#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
+#define MEMGETBADBLOCK _IOW('M', 11, 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) +#define MEMSETBADBLOCK _IOW('M', 12, loff_t)
/* Set OTP (One-Time Programmable) mode (factory vs. user) */
#define OTPSELECT _IOR('M', 13, int) #define OTPSELECT _IOR('M', 13, int)
#define OTPGETREGIONCOUNT _IOW('M', 14, int) /* Get number of OTP (One-Time Programmable) regions */
#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)

View file

@ -8,15 +8,15 @@
#include <linux/types.h> #include <linux/types.h>
#define crc32 __zlib_crc32 #define crc32 __zlib_crc32
@@ -35,7 +34,6 @@ @@ -34,7 +33,6 @@
#include "ubifs-media.h" #include "compr.h"
#include "mkfs.ubifs.h" #include "mkfs.ubifs.h"
-static void *lzo_mem; -static void *lzo_mem;
static unsigned long long errcnt = 0; static unsigned long long errcnt = 0;
static struct ubifs_info *c = &info_; 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; return 0;
} }
@ -42,7 +42,7 @@
static int lzo_compress(void *in_buf, size_t in_len, void *out_buf, static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len) 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; return 0;
} }
@ -55,7 +55,7 @@
static int no_compress(void *in_buf, size_t in_len, void *out_buf, static int no_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len) 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_len = zlib_len = *out_len;
lzo_ret = lzo_compress(in_buf, in_len, out_buf, &lzo_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); zlib_ret = zlib_deflate(in_buf, in_len, zlib_buf, &zlib_len);
@ -63,7 +63,7 @@
if (lzo_ret && zlib_ret) if (lzo_ret && zlib_ret)
/* Both compressors failed */ /* Both compressors failed */
return -1; 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) int init_compression(void)
{ {
@ -100,20 +100,20 @@
if (errcnt) if (errcnt)
fprintf(stderr, "%llu compression errors occurred\n", errcnt); fprintf(stderr, "%llu compression errors occurred\n", errcnt);
} }
--- a/mkfs.ubifs/Makefile --- a/Makefile
+++ b/mkfs.ubifs/Makefile +++ b/Makefile
@@ -6,7 +6,13 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch] @@ -108,7 +108,13 @@ $(call _mkdep,lib/,libmtd.a)
obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \
TARGETS = mkfs.ubifs hashtable/hashtable.o hashtable/hashtable_itr.o
LDFLAGS_mkfs.ubifs = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDFLAGS)
-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi -LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid
+ifeq ($(WITHOUT_LZO), 1) +ifeq ($(WITHOUT_LZO), 1)
+ CPPFLAGS += -DWITHOUT_LZO + CPPFLAGS += -DWITHOUT_LZO
+else +else
+ LZOLDLIBS = -llzo2 + LZOLDLIBS = -llzo2
+endif +endif
+ +
+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi +LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
#

View file

@ -1,17 +1,32 @@
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -1,7 +1,7 @@ @@ -4,7 +4,7 @@
VERSION = 1.5.1
# -*- sh -*- CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS)
-CPPFLAGS += -I./include/linux/lzma
-CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) -I./include/linux/lzma +CPPFLAGS += $(XZCPPFLAGS) -I./include/linux/lzma
+CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(XZCPPFLAGS) -I./include/linux/lzma
ifeq ($(WITHOUT_XATTR), 1) ifeq ($(WITHOUT_XATTR), 1)
CPPFLAGS += -DWITHOUT_XATTR 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 --- a/mkfs.ubifs/compr.c
+++ b/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) { } static inline void lzo_fini(void) { }
#endif #endif
@ -126,7 +141,7 @@
static int no_compress(void *in_buf, size_t in_len, void *out_buf, static int no_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len) 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: case MKFS_UBIFS_COMPR_LZO:
ret = lzo_compress(in_buf, in_len, out_buf, out_len); ret = lzo_compress(in_buf, in_len, out_buf, out_len);
break; break;
@ -136,7 +151,7 @@
case MKFS_UBIFS_COMPR_ZLIB: case MKFS_UBIFS_COMPR_ZLIB:
ret = zlib_deflate(in_buf, in_len, out_buf, out_len); ret = zlib_deflate(in_buf, in_len, out_buf, out_len);
break; break;
@@ -226,12 +337,18 @@ int init_compression(void) @@ -225,12 +336,18 @@ int init_compression(void)
if (ret) if (ret)
goto err; goto err;
@ -156,7 +171,7 @@
err_lzo: err_lzo:
lzo_fini(); lzo_fini();
err: err:
@@ -241,6 +358,7 @@ err: @@ -240,6 +357,7 @@ err:
void destroy_compression(void) void destroy_compression(void)
{ {
free(zlib_buf); free(zlib_buf);
@ -174,50 +189,9 @@
}; };
int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len, 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 --- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/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 struct ubifs_info *c = &info_;
static libubi_t ubi; static libubi_t ubi;
@ -227,20 +201,20 @@
/* Debug levels are: 0 (none), 1 (statistics), 2 (files) ,3 (more details) */ /* Debug levels are: 0 (none), 1 (statistics), 2 (files) ,3 (more details) */
int debug_level; int debug_level;
int verbose; 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 */ /* Inode creation sequence number */
static unsigned long long creat_sqnum; 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:yh?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:z:j:R:l:j:UQq";
static const struct option longopts[] = { static const struct option longopts[] = {
{"root", 1, NULL, 'r'}, {"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'}, {"reserved", 1, NULL, 'R'},
{"compr", 1, NULL, 'x'}, {"compr", 1, NULL, 'x'},
{"favor-percent", 1, NULL, 'X'}, {"favor-percent", 1, NULL, 'X'},
+ {"force-compr", 1, NULL, 'y'}, + {"force-compr", 1, NULL, 'z'},
{"fanout", 1, NULL, 'f'}, {"fanout", 1, NULL, 'f'},
{"space-fixup", 0, NULL, 'F'}, {"space-fixup", 0, NULL, 'F'},
{"keyhash", 1, NULL, 'k'}, {"keyhash", 1, NULL, 'k'},
@ -255,12 +229,12 @@
"-X, --favor-percent may only be used with favor LZO compression and defines\n" "-X, --favor-percent may only be used with favor LZO compression and defines\n"
" how many percent better zlib should compress to make\n" " how many percent better zlib should compress to make\n"
" mkfs.ubifs use zlib instead of LZO (default 20%)\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" +" \"lzo\", \"zlib\" or \"none\"\n"
"-f, --fanout=NUM fanout NUM (default: 8)\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" "-F, --space-fixup file-system free space has to be fixed up on first mount\n"
" (requires kernel version 3.0 or greater)\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; return 0;
} }
@ -304,7 +278,7 @@
static int get_options(int argc, char**argv) static int get_options(int argc, char**argv)
{ {
int opt, i; 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"); return err_msg("bad key hash");
break; break;
case 'x': case 'x':
@ -326,11 +300,11 @@
break; break;
case 'X': case 'X':
c->favor_percent = strtol(optarg, &endp, 0); 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'", return err_msg("bad favor LZO percent '%s'",
optarg); optarg);
break; break;
+ case 'y': + case 'z':
+ if (get_compr_option(optarg, &force_compr, NULL)) + if (get_compr_option(optarg, &force_compr, NULL))
+ return err_msg("bad forced compressor name '%s'", + return err_msg("bad forced compressor name '%s'",
+ optarg); + optarg);
@ -339,7 +313,7 @@
case 'j': case 'j':
c->max_bud_bytes = get_bytes(optarg); c->max_bud_bytes = get_bytes(optarg);
if (c->max_bud_bytes <= 0) 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->min_io_size = 8;
c->rp_size = add_space_overhead(c->rp_size); c->rp_size = add_space_overhead(c->rp_size);
@ -349,7 +323,7 @@
if (verbose) { if (verbose) {
printf("mkfs.ubifs\n"); printf("mkfs.ubifs\n");
printf("\troot: %s\n", root); 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("\toutput: %s\n", output);
printf("\tjrn_size: %llu\n", c->max_bud_bytes); printf("\tjrn_size: %llu\n", c->max_bud_bytes);
printf("\treserved: %llu\n", c->rp_size); printf("\treserved: %llu\n", c->rp_size);
@ -371,7 +345,7 @@
printf("\tkeyhash: %s\n", (c->key_hash == key_r5_hash) ? printf("\tkeyhash: %s\n", (c->key_hash == key_r5_hash) ?
"r5" : "test"); "r5" : "test");
printf("\tfanout: %d\n", c->fanout); 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; use_compr = UBIFS_COMPR_LZO;
else else
#endif #endif
@ -382,7 +356,7 @@
dn->compr_type = cpu_to_le16(compr_type); dn->compr_type = cpu_to_le16(compr_type);
--- a/mkfs.ubifs/mkfs.ubifs.h --- a/mkfs.ubifs/mkfs.ubifs.h
+++ b/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 #if MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB
#error MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB #error MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB
#endif #endif
@ -392,9 +366,9 @@
extern int verbose; extern int verbose;
extern int debug_level; extern int debug_level;
--- a/mkfs.ubifs/ubifs-media.h --- a/include/mtd/ubifs-media.h
+++ b/mkfs.ubifs/ubifs-media.h +++ b/include/mtd/ubifs-media.h
@@ -303,6 +303,7 @@ enum { @@ -313,6 +313,7 @@ enum {
UBIFS_COMPR_NONE, UBIFS_COMPR_NONE,
UBIFS_COMPR_LZO, UBIFS_COMPR_LZO,
UBIFS_COMPR_ZLIB, UBIFS_COMPR_ZLIB,

View file

@ -1,5 +1,5 @@
--- a/ubi-utils/src/libubigen.c --- a/ubi-utils/libubigen.c
+++ b/ubi-utils/src/libubigen.c +++ b/ubi-utils/libubigen.c
@@ -122,8 +122,9 @@ int ubigen_add_volume(const struct ubige @@ -122,8 +122,9 @@ int ubigen_add_volume(const struct ubige
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
--- a/ubi-utils/src/ubinize.c --- a/ubi-utils/ubinize.c
+++ b/ubi-utils/src/ubinize.c +++ b/ubi-utils/ubinize.c
@@ -70,6 +70,8 @@ static const char optionsstr[] = @@ -70,6 +70,8 @@ static const char optionsstr[] =
" (default is 1)\n" " (default is 1)\n"
"-Q, --image-seq=<num> 32-bit UBI image sequence number to use\n" "-Q, --image-seq=<num> 32-bit UBI image sequence number to use\n"

View file

@ -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 ;
} ;