Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Use c->favor_percent, not c->favor_lzo.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We need to have access to "c" from various files.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
It will be used in the next patches.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Complain and exit if max. count of LEBs was not specified.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Add -N option to ubirmvol to support deleting volumes
by name.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|