]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
16 years agoPrevent git-clean from removing cscope files
Artem Bityutskiy [Mon, 20 Apr 2009 09:36:41 +0000 (12:36 +0300)]
Prevent git-clean from removing cscope files

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiformat: increase version to 1.2
Artem Bityutskiy [Sat, 18 Apr 2009 13:46:25 +0000 (16:46 +0300)]
ubiformat: increase version to 1.2

The previous patch fixed a nasty bug, so it is nice to increase
program version to reflect that.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiformat: fix segfault and messages
Artem Bityutskiy [Sat, 18 Apr 2009 13:35:22 +0000 (16:35 +0300)]
ubiformat: fix segfault and messages

ubiformat segfaults like this:

ubiformat: mtd0 (NAND), size 134217728 bytes (128.0 MiB), 16384 eraseblocks of 16384 bytes (16.0 KiB), min. I/O size 512 bytes
libscan: scanning eraseblock 8191 -- 100 % complete
ubiformat: 8190 eraseblocks have valid erase counter, mean value is 9
ubiformat: 2 eraseblocks are supposedly empty
ubiformat: warning!: VID header and data offsets on flash are 512 and 1024, which is different to calculated offsets 256 and 512
ubiformat: use new offsets 512 and 1024? (yes/no)  no
Segmentation fault

The reason is that volume table size is calculated for 256/512
layout, and when user chooses 512/1024 - it is not re-calculated
which leads to segfault in 'ubigen_write_layout_vol()'.

This patch also fixes the message - in the above output new
offsets are 256/512, not 512/1024.

Also, this patch adds explicit printing of the selected
positions.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibmtd: amend interface
Artem Bityutskiy [Sat, 18 Apr 2009 13:01:40 +0000 (16:01 +0300)]
libmtd: amend interface

Remove the fd field from the mtd information data structure,
because libmtd does not really know the device node file name,
and serves only as a place to save the descriptor. The callers
should find a better place.

This patch improves code readability and prepares for further
changes.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: remove unnecessary header files
Artem Bityutskiy [Sat, 18 Apr 2009 12:38:59 +0000 (15:38 +0300)]
libubi: remove unnecessary header files

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: amend included header files
Artem Bityutskiy [Sat, 18 Apr 2009 12:05:13 +0000 (15:05 +0300)]
libubi: amend included header files

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: remove useless variable
Artem Bityutskiy [Sat, 18 Apr 2009 11:29:46 +0000 (14:29 +0300)]
libubi: remove useless variable

We know that sysfs is always at /sys, so we do not have to
store it in lib->sysfs.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: remove incorrect comment
Artem Bityutskiy [Sat, 18 Apr 2009 11:04:24 +0000 (14:04 +0300)]
libubi: remove incorrect comment

sysfs if guaranteed to be in /sys.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: spelling fixes
Artem Bityutskiy [Sat, 18 Apr 2009 10:59:57 +0000 (13:59 +0300)]
libubi: spelling fixes

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibmtd: move comments to headers
Artem Bityutskiy [Sat, 18 Apr 2009 10:54:44 +0000 (13:54 +0300)]
libmtd: move comments to headers

Just for the sake of being consistent with libubi, move the
comments for API functions to the header file.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: tweak vpath handling
Mike Frysinger [Tue, 31 Mar 2009 04:09:40 +0000 (00:09 -0400)]
ubi-utils: tweak vpath handling

Building out of tree currently fails with ubi-utils because make gets
confused and can't figure out the vpathed .c files.  Using VPATH rather
than vpath seems to work around it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
16 years agolibubigen: don't define large array on stack
sonic zhang [Mon, 30 Mar 2009 08:22:48 +0000 (16:22 +0800)]
libubigen: don't define large array on stack

On nommu arch, local stack size is very limited and
can't be enlarged on demand. So, don't define large
array on local stack.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
16 years agolibmtd: fix mtd_is_bad return code
Roger Quadros [Fri, 27 Mar 2009 16:48:58 +0000 (18:48 +0200)]
libmtd: fix mtd_is_bad return code

Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiformat: mark faulty blocks as bad
Roger Quadros [Thu, 26 Mar 2009 12:14:27 +0000 (14:14 +0200)]
ubiformat: mark faulty blocks as bad

Few minor amendments by Artem. And increase the utility
version number.

Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: re-arrange directory layout
Artem Bityutskiy [Tue, 17 Mar 2009 08:14:54 +0000 (10:14 +0200)]
ubi-utils: re-arrange directory layout

Move new-utils to ubi-utils and old ones to ubi-utils/old-utils.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomake sure compiler supports warning flags
Mike Frysinger [Thu, 26 Feb 2009 08:30:06 +0000 (03:30 -0500)]
make sure compiler supports warning flags

Some compilers (like gcc-3.3) don't support all the newer -W flags that we
are using.  So import the compiler check found in the kernel and test each
flag we add.  The := is important so we only do the compiler tests once
per `make` rather than every time we compile a file.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoAdd generated binaries to gitignore
Mike Frysinger [Wed, 25 Feb 2009 23:38:53 +0000 (18:38 -0500)]
Add generated binaries to gitignore

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.jffs2: fix lzo usage on 64bit systems
Sebastian Andrzej Siewior [Mon, 23 Feb 2009 21:38:54 +0000 (22:38 +0100)]
mkfs.jffs2: fix lzo usage on 64bit systems

the compress size parameter in lzo is defined in the header file as lzo_uint.
This looks very much like uint32_t, I know, but is defined as unsigned long.
So on 64bit LE systems we zero some bytes near by and on BE systems we
get a size of zero.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoUBI: add ubirename utility
Richard Titmuss [Wed, 18 Feb 2009 08:51:39 +0000 (10:51 +0200)]
UBI: add ubirename utility

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoUBI: add forgotten ubi-media.h
Artem Bityutskiy [Wed, 18 Feb 2009 08:28:03 +0000 (10:28 +0200)]
UBI: add forgotten ubi-media.h

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoUBI: update ubi-header.h
Artem Bityutskiy [Wed, 18 Feb 2009 08:26:20 +0000 (10:26 +0200)]
UBI: update ubi-header.h

Take the latest version from the kernel, where it was renamed
to ubi-media.h.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoUBI: update ubi-user.h
Artem Bityutskiy [Wed, 18 Feb 2009 08:16:26 +0000 (10:16 +0200)]
UBI: update ubi-user.h

Just take the latest version from the kernel.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomtd-utils: handle non-power-of-2 erase size
Peter Korsgaard [Tue, 17 Feb 2009 14:03:40 +0000 (15:03 +0100)]
mtd-utils: handle non-power-of-2 erase size

E.g., this is needed for DataFlash.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: eliminate compiler warnings
Adrian Hunter [Thu, 12 Feb 2009 08:53:18 +0000 (10:53 +0200)]
mkfs.ubifs: eliminate compiler warnings

The warnings were:

lpt.c: In function ‘create_lpt’:
lpt.c:552: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long int’
mkfs.ubifs.c: In function ‘do_openat’:
mkfs.ubifs.c:251: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result
mkfs.ubifs.c: In function ‘get_options’:
mkfs.ubifs.c:542: warning: format not a string literal and no format arguments

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoArtem Bityutskiy said once:
linux-mtd-owner@lists.infradead.org [Wed, 11 Feb 2009 09:05:39 +0000 (04:05 -0500)]
Artem Bityutskiy said once:
|I mean, IMO most of these warnings are not really sane, and cleaning
|that up just adds mess - you stop understanding why is something signed
|or unsigned  :-)

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoI have here a mtd part which is 3 GiB with a flash page size of 256KiB.
linux-mtd-owner@lists.infradead.org [Wed, 11 Feb 2009 09:04:39 +0000 (04:04 -0500)]
I have here a mtd part which is 3 GiB with a flash page size of 256KiB.
The 2GiB limit is at erase block 8192. In mtd_is_bad() the computation
for the MEMGETBADBLOCK ioctl() looks like the following:

| seek = eb * mtd->eb_size;

with both eb and mtd->eb_size being a signed int results in seek being a
signed result.

The _FILE_OFFSET_BITS=64 define is required to switch off_t from 32bit
to 64bit an 32bit systems. This is required in order to keep using
lseek() as lseek64 on 32bit system. Without this change lseek() in
mtd_read() is called with a 32bit value with most significat bit set and
the kernel performs a sign extension for the 64bit value which is used
in the mtd layer.

The last change also changes the size of the parameter which is passed
to the MEMGETBADBLOCK ioctl() from 32 to 64bit. The counter part in
kernel is also defined as loff_t which is of type __kernel_loff_t and
this is "long long". So this must have been broken for a while unless I
missed something.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: update program version to 1.2
Artem Bityutskiy [Wed, 28 Jan 2009 12:36:42 +0000 (14:36 +0200)]
mkfs.ubifs: update program version to 1.2

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: support reserved space allocation
Artem Bityutskiy [Wed, 28 Jan 2009 12:19:43 +0000 (14:19 +0200)]
mkfs.ubifs: support reserved space allocation

UBIFS may reserve some amount of flash space for the super-user,
ant this amount is stored in the superblock. Currently mkfs.ubifs
always puts 0 there. This patch adds -R option which may be used
to specify size of the reserved space.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiupdatevol: fix -t parameter
Sebastian Andrzej Siewior [Wed, 17 Dec 2008 10:15:54 +0000 (11:15 +0100)]
ubiupdatevol: fix -t parameter

The execution of
|./ubiupdatevol /dev/ubi0 -t
will fail because 'argv[optind + 1]' is undefined and the later executed
'strcmp(args.img, "-")' will segfault.
So I can hack around and supply a dummy image or fix it that way.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-tests: fix build and some warnings
Artem Bityutskiy [Fri, 16 Jan 2009 18:53:42 +0000 (20:53 +0200)]
ubi-tests: fix build and some warnings

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: fix various warnings
Artem Bityutskiy [Fri, 16 Jan 2009 14:11:32 +0000 (16:11 +0200)]
mkfs.ubifs: fix various warnings

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: fix compilation warnings
Artem Bityutskiy [Fri, 16 Jan 2009 13:40:54 +0000 (15:40 +0200)]
ubi-utils: fix compilation warnings

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiformat: nicify error messages
Artem Bityutskiy [Fri, 16 Jan 2009 13:30:40 +0000 (15:30 +0200)]
ubiformat: nicify error messages

In case of error, ubiformat prints error messages at the same
line as the previous messages. Fix this.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: minor printing fix
Artem Bityutskiy [Thu, 15 Jan 2009 17:57:15 +0000 (19:57 +0200)]
ubi-utils: minor printing fix

Add missing whitespace in ubimkvol help output

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agofs-tests: fix remounting in integck
Artem Bityutskiy [Wed, 14 Jan 2009 18:57:41 +0000 (20:57 +0200)]
fs-tests: fix remounting in integck

Teach integck properly save original mount options.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agocommon.mk: tweak rules to workaround make-3.80 bugs
Mike Frysinger [Mon, 12 Jan 2009 16:08:03 +0000 (11:08 -0500)]
common.mk: tweak rules to workaround make-3.80 bugs

I got some reports from people who use make-3.80 that mtd-utils wasn't
building correctly the first time.  Turns out that older versions of make
misbehave with pattern rules and full paths.  So I've tweaked the code a
little to work with make-3.80 and make-3.81 (the latest release).

Also, I added a small optimization to avoid running `mkdir` when building
in-tree.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: fix warning in fprintf() code
Mike Frysinger [Mon, 12 Jan 2009 16:08:07 +0000 (11:08 -0500)]
ubi-utils: fix warning in fprintf() code

When building with gcc security warnings enabled, the ubimirror.c code
triggers this warning:
./src/ubimirror.c: In function 'main':
./src/ubimirror.c:206: error: format not a string literal and no format arguments

Since the buffer in question should be a straight string anyways, avoid
ugly printf exploits by outputting the string indirectly:
printf("%s", buffer)

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.jffs2: fix dir creation in /
Mike Frysinger [Sat, 27 Dec 2008 03:35:08 +0000 (22:35 -0500)]
mkfs.jffs2: fix dir creation in /

With older mtd-utils, creating a directory in the root worked fine.  With
current git, the parent dir search algo breaks this.

For example, just take the current git tree, build it up, and then run:
$ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
...
Doing `mkdir ./dev` first works around the issue, but where's the fun in
that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agonandwrite: correct data reading
Artem Bityutskiy [Tue, 16 Dec 2008 08:02:16 +0000 (10:02 +0200)]
nandwrite: correct data reading

The "read" syscall does not necessarily return all the requested
data, in which case the caller has to try again and read more.
Take this into account when reading input data.

This patch is an improved vestion of the original patch sent by
Hai Zaar.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tested-by: Hai Zaar <haizaar@codefidence.com>
16 years agoUnify all common build system parts
Mike Frysinger [Thu, 18 Dec 2008 21:05:18 +0000 (16:05 -0500)]
Unify all common build system parts

Rather than duplicating the same thing over and over in every Makefile,
move it all to common.mk.

Other things fixed here:
 - doing subdirs in parallel
 - fix src!=build compiling in subdirs

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: remove some too verbose messages
Artem Bityutskiy [Tue, 16 Dec 2008 07:52:40 +0000 (09:52 +0200)]
libubi: remove some too verbose messages

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agolibubi: be more verbose about errors
Artem Bityutskiy [Wed, 10 Dec 2008 14:26:53 +0000 (16:26 +0200)]
libubi: be more verbose about errors

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: fix up build system
Mike Frysinger [Tue, 9 Dec 2008 13:38:10 +0000 (08:38 -0500)]
ubi-utils: fix up build system

The previous change with CFLAGS handling was not entirely correct.  So fix
CFLAGS/CPPFLAGS/LDFLAGS to work like standard build systems (i.e. autotools)
and change `ranlib` to $(RANLIB) to fix cross-compiling.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: fix "smal" typo
Mike Frysinger [Tue, 9 Dec 2008 16:51:00 +0000 (11:51 -0500)]
mkfs.ubifs: fix "smal" typo

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiformat.c: fix printf(%d, size_t) warning
Mike Frysinger [Tue, 9 Dec 2008 13:28:03 +0000 (08:28 -0500)]
ubiformat.c: fix printf(%d, size_t) warning

A size_t should be printed using %zu (unsigned size_t) rather than %d.  This
fixes the following warning on my system:
gcc -O2 -Werror -Wall -Iinclude -Isrc -I../../include src/ubiformat.c -c -o ubiformat.o
cc1: warnings being treated as errors
src/ubiformat.c: In function ‘read_all’:
src/ubiformat.c:345: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
src/ubiformat.c:352: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
make: *** [ubiformat.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: various fixes
Tom Rini [Mon, 8 Dec 2008 08:02:00 +0000 (01:02 -0700)]
ubi-utils: various fixes

gcc-4.3.x introduces a number of new warnings (and we use -Werror) for
things like not checking scanf return values and not using explicit
formatting.  Finally, it caught that we were overflowing our own buffer
in unubi.c, so increate the variable size as we want to declare and
clear PATH_MAX + 1, then use only PATH_MAX of the variable.

Signed-off-by: Tom Rini <trini@embeddedalley.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: clean the hashtable target as well
Sebastian Andrzej Siewior [Fri, 5 Dec 2008 10:20:46 +0000 (11:20 +0100)]
mkfs.ubifs: clean the hashtable target as well

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoSeparate '-m' and the mode with a space when invoking 'install'
Enrico Scholz [Wed, 26 Nov 2008 13:27:45 +0000 (14:27 +0100)]
Separate '-m' and the mode with a space when invoking 'install'

Some 'install' versions (e.g. this of OpenEmbedded) require the mode
to be a separate argument and don't understand the '-m0755' syntax:

  .../staging/x86_64-linux/usr/bin/install-sh: ./-m0755 does not exist.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: fix CFLAGS handling wrt cross compilation
Nicolas Pitre [Wed, 19 Nov 2008 18:31:28 +0000 (13:31 -0500)]
ubi-utils: fix CFLAGS handling wrt cross compilation

Let's have the "new ubi-utils" makefile handle CFLAGS like the other
makefiles.  This is important when cross compiling and CFLAGS is
externally provided. Without this, local include files are not found due
to the various -I arguments which are then lost.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoflash_eraseall reports incorrect percentage
Ladislav Michl [Tue, 18 Nov 2008 18:56:52 +0000 (19:56 +0100)]
flash_eraseall reports incorrect percentage

Fix flash_eraseall percentage reporting:

# flash_eraseall /dev/mtd4
Erasing 128 Kibyte @ 2800000 -- 100 % complete.

flash_eraseall
 * fix percentage reporting
 * exit()ing from main() is overkill, just return

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubinize: correct subpage_size print and initialise vol_info to zero
Adrian Hunter [Mon, 3 Nov 2008 08:41:58 +0000 (10:41 +0200)]
ubinize: correct subpage_size print and initialise vol_info to zero

J. Scott Merritt wrote:
> Dear list,
>
> I believe that I have stumbled upon two problems with the latest version
> of ubinize.c in mtd-utils - one serious, and one not so serious.
>
> - First, the easy one: At line 457, I believe that we should be printing
> args.subpage_size rather than ui.min_io_size.
>
> - More seriously, I believe that the "flags" field in the ubigen_vol_info
> structures is not being properly initialized.  Line 494 allocates memory
> for these structures with malloc, so they are not cleared to zero.  The
> read_section function updates the flag field if the AUTO-RESIZE flag is
> specified, but does not otherwise initialize or clear it.
>
> I reckon the latter problem could be repaired either with calloc, or by
> modifying read_section to more directly set/clear the flag.
>
> Thanks, Scott.

Reported-by: J. Scott Merritt <merrij3@rpi.edu>
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: make program version 1.1.
Artem Bityutskiy [Thu, 23 Oct 2008 17:18:33 +0000 (20:18 +0300)]
mkfs.ubifs: make program version 1.1.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoFix favor LZO implementation
Artem Bityutskiy [Wed, 22 Oct 2008 15:12:14 +0000 (18:12 +0300)]
Fix favor LZO implementation

Use c->favor_percent, not c->favor_lzo.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoImplement favor LZO method
Artem Bityutskiy [Wed, 22 Oct 2008 12:15:52 +0000 (15:15 +0300)]
Implement favor LZO method

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoIntroduce favor_lzo compressor options
Artem Bityutskiy [Wed, 22 Oct 2008 11:58:05 +0000 (14:58 +0300)]
Introduce favor_lzo compressor options

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoMake "c" global
Artem Bityutskiy [Wed, 22 Oct 2008 12:04:52 +0000 (15:04 +0300)]
Make "c" global

We need to have access to "c" from various files.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoDefine the worst case compression constant
Artem Bityutskiy [Wed, 22 Oct 2008 11:23:00 +0000 (14:23 +0300)]
Define the worst case compression constant

It will be used in the next patches.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoUBIFS: rename crc32 function
Artem Bityutskiy [Wed, 22 Oct 2008 11:18:43 +0000 (14:18 +0300)]
UBIFS: rename crc32 function

Zlib headers also declare crc32 symbol and it confilicts
with our crc32 fuction. So rename it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years ago[PATCH] [MTD] mtd-utils: fec.c: bzero->memset, bcopy->memcpy, bcmp->memcmp
Mitch Davis [Wed, 8 Oct 2008 02:36:13 +0000 (13:36 +1100)]
[PATCH] [MTD] mtd-utils: fec.c: bzero->memset, bcopy->memcpy, bcmp->memcmp

This patch alters fec.c so it does not use the deprecated bzero, bcopy
and bcmp functions.  This can help on platforms that do not have these
functions.

Signed-off-by: Mitch Davis <mitch.davis@symstream.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
16 years agoubinize: allow an absent 'image' in the ubinize configuration.
Richard Titmuss [Tue, 23 Sep 2008 20:32:10 +0000 (21:32 +0100)]
ubinize: allow an absent 'image' in the ubinize configuration.

Some recent changes to ubinize prevent the 'image' parameter from being
absent in the configuration file. The following patch fixes that.

Signed-off-by: Richard Titmuss <richard.titmuss@logitech.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agonanddump: Add Support for Quiet Option
Grant Erickson [Sun, 7 Sep 2008 20:45:57 +0000 (20:45 +0000)]
nanddump: Add Support for Quiet Option

Added support for the '-q,--quiet' option to suppress diagnostic output.
 Made the new option mutually-exclusive with the pretty print option.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonanddump: Clean-up Usage Output
Grant Erickson [Sun, 7 Sep 2008 20:45:51 +0000 (20:45 +0000)]
nanddump: Clean-up Usage Output

Realign help usage output to make it more explict when a description
needs to be wrapped.

Use sentence case for the help usage output option short descriptions.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonanddump: Use Boolean Mnemonics from stdbool.h
Grant Erickson [Sun, 7 Sep 2008 20:45:43 +0000 (20:45 +0000)]
nanddump: Use Boolean Mnemonics from stdbool.h

Added include directive for stdbool.h and leveraged where appropriate
to improve code readability by making variable intent and usage more
explicit.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonanddump: Pass Real Names as Arguments to perror
Grant Erickson [Sun, 7 Sep 2008 20:45:36 +0000 (20:45 +0000)]
nanddump: Pass Real Names as Arguments to perror

Pass the MTD device node and dump file name as arguments to perror
rather than more ambigous, static messages on open failures.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonanddump: Utilize Standard Exit Mnemonics
Grant Erickson [Sun, 7 Sep 2008 20:45:29 +0000 (20:45 +0000)]
nanddump: Utilize Standard Exit Mnemonics

Replace main exit and return status codes with equivalent mnemonics.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonanddump: Qualifier Clean-up
Grant Erickson [Sun, 7 Sep 2008 20:45:21 +0000 (20:45 +0000)]
nanddump: Qualifier Clean-up

Static-qualified all globals except 'main' because they have no use
beyond file scope.
Constant-qualified MTD device and input positional parameter globals.
Constant-qualified argv array.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonandwrite: Add Support for Reading from Standard Input
Grant Erickson [Sun, 7 Sep 2008 18:29:19 +0000 (18:29 +0000)]
nandwrite: Add Support for Reading from Standard Input

Added suppport for reading in band data from standard input based on a
patch originally generated by Richard Titmuss <titmuss@slimdevices.com>
at <http://lists.slimdevices.com/pipermail/jive-checkins/2008-May/001918.html>.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonandwrite: Clean-up Usage Output
Grant Erickson [Sun, 7 Sep 2008 18:29:11 +0000 (18:29 +0000)]
nandwrite: Clean-up Usage Output

Realign help usage output to make it more explict when a description
needs to be wrapped.

Use sentence case for the help usage output option short descriptions.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonandwrite: Use Boolean Mnemonics from stdbool.h
Grant Erickson [Sun, 7 Sep 2008 18:29:03 +0000 (18:29 +0000)]
nandwrite: Use Boolean Mnemonics from stdbool.h

Added include directive for stdbool.h and leveraged where appropriate
to improve code readability by making variable intent and usage more
explicit.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonandwrite: Pass Real Names as Arguments to perror
Grant Erickson [Sun, 7 Sep 2008 18:28:56 +0000 (18:28 +0000)]
nandwrite: Pass Real Names as Arguments to perror

Pass the MTD device node and input file name as arguments to perror
rather than more ambigous, static messages on open failures.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonandwrite: Utilize Standard Exit Mnemonics
Grant Erickson [Sun, 7 Sep 2008 18:28:24 +0000 (18:28 +0000)]
nandwrite: Utilize Standard Exit Mnemonics

Replace main exit and return status codes with equivalent mnemonics.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agonandwrite: Qualifier Clean-up
Grant Erickson [Sun, 7 Sep 2008 18:24:54 +0000 (18:24 +0000)]
nandwrite: Qualifier Clean-up

Static-qualified all globals except 'main' because they have no use
beyond file scope.
Constant-qualified MTD device and input positional parameter globals.
Constant-qualified argv array.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
16 years agofs-tests: also preserve mount options when mounting again
Adrian Hunter [Mon, 8 Sep 2008 08:39:29 +0000 (11:39 +0300)]
fs-tests: also preserve mount options when mounting again

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: amend help print
Artem Bityutskiy [Sun, 7 Sep 2008 13:46:41 +0000 (16:46 +0300)]
mkfs.ubifs: amend help print

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: update ubifs-media.h
Artem Bityutskiy [Sun, 7 Sep 2008 13:38:15 +0000 (16:38 +0300)]
mkfs.ubifs: update ubifs-media.h

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiupdatevol: remove non-existing option from help message
Artem Bityutskiy [Fri, 5 Sep 2008 08:56:59 +0000 (11:56 +0300)]
ubiupdatevol: remove non-existing option from help message

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: check max_leb_count
Artem Bityutskiy [Fri, 5 Sep 2008 08:56:22 +0000 (11:56 +0300)]
mkfs.ubifs: check max_leb_count

Complain and exit if max. count of LEBs was not specified.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubirmvol: learn to remove volume by name
Artem Bityutskiy [Wed, 3 Sep 2008 16:18:29 +0000 (19:18 +0300)]
ubirmvol: learn to remove volume by name

Add -N option to ubirmvol to support deleting volumes
by name.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: minor rename
Artem Bityutskiy [Tue, 2 Sep 2008 14:41:47 +0000 (17:41 +0300)]
ubi-utils: minor rename

We use term "volume ID", not "volume number". So change few
vol_num variables to vol_id to be consistent.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubimkvol: check for free LEBs
Artem Bityutskiy [Tue, 2 Sep 2008 13:46:48 +0000 (16:46 +0300)]
ubimkvol: check for free LEBs

Check for free LEBs before trying to create a volume. This fixes
the following issue:

$ ubimkvol /dev/ubi0 -n 0 -N test_fs -m
ubimkvol: error!: cannot UBI create volume
          error 22 (Invalid argument)
Error: cannot create UBI volume

"Invalid argument" ? Not understandable. But the thing is that
-m makes ubimkvol use available space, which is zero, then it
passes zero to the ioctl, which fails in request validation
code, because 0 invalid volume size.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubiattach: minor help text fix
Artem Bityutskiy [Tue, 2 Sep 2008 13:31:27 +0000 (16:31 +0300)]
ubiattach: minor help text fix

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: added missing linefeed in 'ubinfo'
Enrico Scholz [Tue, 26 Aug 2008 09:13:57 +0000 (11:13 +0200)]
ubi-utils: added missing linefeed in 'ubinfo'

Trivial patch to add a missing linefeed in static volume info:

| Data bytes:  113112 bytes (110.5 KiB)State:       OK

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: allow 'ubiformat' to read from stdin
Enrico Scholz [Mon, 25 Aug 2008 19:09:51 +0000 (21:09 +0200)]
ubi-utils: allow 'ubiformat' to read from stdin

This patch allows to read the image from stdin and adds an
'--image-size' option to specify its size.  'upiupdatevol' has this
feature already and it is useful for 'ubiformat' too.

It adds a read_all() function which reads a block of data. Plain
'read(2)' can fail on

  nc -l -p 1234 | ubiformat -f - -S 25427968

else.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: fixed and enhanced '--flash-image' option
Enrico Scholz [Mon, 25 Aug 2008 19:09:50 +0000 (21:09 +0200)]
ubi-utils: fixed and enhanced '--flash-image' option

The '--flash-image' option of 'ubiformat' requires an argument and
'.has_arg' must not be 0 hence.  The patch adds this option to the
commandline synopsis too.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-utils: use 'stat(2)' instead of 'lstat(2)'
Enrico Scholz [Mon, 25 Aug 2008 09:21:48 +0000 (11:21 +0200)]
ubi-utils: use 'stat(2)' instead of 'lstat(2)'

The UBI tools refuse to work with symlinks like
'/dev/ubi/bootloader -> ../ubi0_2' because they use 'lstat(2)' and get
information about the symlink but not about the device.  This is
unwanted and fixed by this patch.

This patch renames 'struct stat stat' variables to 'st' to avoid
compilation errors.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomtd-utils: add support for 4k pages.
Thomas Gleixner [Wed, 20 Aug 2008 10:32:14 +0000 (12:32 +0200)]
mtd-utils: add support for 4k pages.

Add support for 4K pages in nanddump & nandwrite.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: remove debugging leftovers from Makefile
Artem Bityutskiy [Thu, 21 Aug 2008 08:57:37 +0000 (11:57 +0300)]
mkfs.ubifs: remove debugging leftovers from Makefile

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agouse $(MAKE) rather than make
Mike Frysinger [Wed, 20 Aug 2008 17:52:05 +0000 (13:52 -0400)]
use $(MAKE) rather than make

If you execute straight `make`, this prevents the active make env from
being passed on to sub children.  This prevents parallel building as well
as build flag passing.

I also dropped the recursive make in ubi-utils/Makefile for the all target
as this causes problems when building in parallel.  All of the targets
that we actually care about are handled by the $(NTARGETS) target anyways.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomkfs.ubifs: set CFLAGS/LDLIBS properly
Mike Frysinger [Wed, 20 Aug 2008 17:57:09 +0000 (13:57 -0400)]
mkfs.ubifs: set CFLAGS/LDLIBS properly

CFLAGS should only be set as a default instead of overriding the user's
choices.  LDLIBS is for adding libraries, not LDFLAGS.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agomtd-utils: enable parallel build process
Sebastian Siewior [Wed, 20 Aug 2008 19:50:18 +0000 (21:50 +0200)]
mtd-utils: enable parallel build process

-j 2 build was not possible without this patch.

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
16 years agomkfs.ubifs: set program version as 1.0
Artem Bityutskiy [Tue, 19 Aug 2008 10:21:47 +0000 (13:21 +0300)]
mkfs.ubifs: set program version as 1.0

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoAdd mkfs.ubifs
Artem Bityutskiy [Tue, 19 Aug 2008 10:18:07 +0000 (13:18 +0300)]
Add mkfs.ubifs

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agofs-tests: allow for symlink name too long in integrity test
Adrian Hunter [Tue, 12 Aug 2008 11:08:14 +0000 (14:08 +0300)]
fs-tests: allow for symlink name too long in integrity test

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agofs-tests: fix max file name length in integrity test
Adrian Hunter [Tue, 12 Aug 2008 11:08:11 +0000 (14:08 +0300)]
fs-tests: fix max file name length in integrity test

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agofs-tests: fix symlink bug in integrity test
Adrian Hunter [Tue, 12 Aug 2008 11:08:06 +0000 (14:08 +0300)]
fs-tests: fix symlink bug in integrity test

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubinize: fix static volumes generation
Artem Bityutskiy [Mon, 28 Jul 2008 09:52:24 +0000 (12:52 +0300)]
ubinize: fix static volumes generation

When static volumes is generated, the 'used_ebs' field of VID
header has to be calculated based on image file size, not on
the volume size. Fix this.

This patch also improves error reporting a little and re-arrages
the code so that all the validation is done in 'read_section()'

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-tests: fix run script
Artem Bityutskiy [Mon, 14 Jul 2008 09:59:26 +0000 (12:59 +0300)]
ubi-tests: fix run script

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubi-tests: fix makefile
Artem Bityutskiy [Mon, 14 Jul 2008 09:51:07 +0000 (12:51 +0300)]
ubi-tests: fix makefile

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agouninize: add more ini-file validation
Artem Bityutskiy [Tue, 8 Jul 2008 12:26:42 +0000 (15:26 +0300)]
uninize: add more ini-file validation

Check that volume names and IDs are unique

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
16 years agoubinize: validate number of sections
Artem Bityutskiy [Tue, 8 Jul 2008 11:06:35 +0000 (14:06 +0300)]
ubinize: validate number of sections

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>