Age | Commit message (Collapse) | Author |
|
First issue is that ioctl() in klibc doesn't expect a constant as arg3.
Second issue is that arg3 in klibc ioctl() implementation is not optional.
Fixes:
| ubi-utils/libubi.c: In function 'do_attach':
| ubi-utils/libubi.c:698:8: warning: passing argument 3 of 'ioctl' discards
| 'const' qualifier from pointer target type
| ret = ioctl(fd, UBI_IOCATT, r);
| ^
| In file included from ubi-utils/libubi.c:32:0:
| .../lib/klibc/include/sys/ioctl.h:15:14: note: expected 'void *' but argument
| is of type 'const struct ubi_attach_req *'
| __extern int ioctl(int, int, void *);
| ^
| ubi-utils/libubi.c: In function 'ubi_vol_block_create':
| ubi-utils/libubi.c:1118:9: error: too few arguments to function 'ioctl'
| return ioctl(fd, UBI_IOCVOLCRBLK);
| ^
| In file included from ubi-utils/libubi.c:32:0:
| .../lib/klibc/include/sys/ioctl.h:15:14: note: declared here
| __extern int ioctl(int, int, void *);
| ^
| ubi-utils/libubi.c: In function 'ubi_vol_block_remove':
| ubi-utils/libubi.c:1123:9: error: too few arguments to function 'ioctl'
| return ioctl(fd, UBI_IOCVOLRMBLK);
| ^
| In file included from ubi-utils/libubi.c:32:0:
| .../usr/lib/klibc/include/sys/ioctl.h:15:14: note: declared here
| __extern int ioctl(int, int, void *);
| ^
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
If the specified UBI device or volume does not exist, the function
is supposed to set errno to ENODEV.
This patch adds a check to ubi_get_vol_info1 to change the errno
to ENODEV if vol_get_major cannot access the underlying sysfs file,
so the function propperly returns that the device or volume does
not exist, instead of failing with errno set to ENOENT.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The documentation of libmtd_open says, if it returns NULL and errno is
zero, MTD is not present. However, the current version always returns
a libmtd_t object. The function internally checks, if it can access the
MTD sysfs files and, if not, sets a flag to use the procfs fallback.
This patch adds an additional check to libmtd_open, to test if the
MTD procfs file can be read and fails with errno cleared if it does
not exist.
Furhtermore, mtd_get_info is documented to fail with errno set to ENODEV
if MTD is not present. First of all, this was broken in the original
version. It was implemented to specification for the sysfs code path,
but if MTD is not present, that won't be executed, because of the flag
set by libmtd_open. This makes the check not only redundant, but masks
an actual error (the sysfs paths suddenly not being readable anymore).
The legacy path that was used if the sysfs files are not avaible fails
with ENOENT if it cannot read the procfs file. With the above changes
in addition, we don't have a libmtd_t object if neither sysfs nor
procfs is readable, so this error status no longer makes sense.
This patch removes the documentation on the ENODEV errno, and
makes sure that mtd_get_info always returns with apropriate errno
on failure.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This is based on the patch from Khem Raj used by openembedded. In
addition to the original patch, this also removes the fallback
implementation that was provided for C libraries that don't implement
rpmatch.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
NEON instruction VLD1.64 was used to copy 64 bits data after type
casting, and they will trigger alignment trap.
This patch uses memcpy to avoid alignment problem.
Signed-off-by: Yuanjie Huang <Yuanjie.Huang@windriver.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
"flash_erase" fails on nand flash with JFFS2 that has OOB size greater than
32 bytes. "flash_erase" uses "MEMGETOOSEL" to determine OOB size. This ioctl
call is obsolete and returns error if OOB size is more than 32 bytes.
This patch fixes this issue by using "mtd_write" to update clean-marker
instead of mtd_oob_write. This fix is based on the discussion:
http://lists.infradead.org/pipermail/linux-mtd/2011-September/037958.html.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
rand() is not thread safe, but glibc seems to use a shared state which is
protected by a mutex. io_paral spawns a few threads and they call rand()
more or less in parallel, which causes heavy lock contention. That
makes the test extremely slow on some setups.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
io_read and io_update of mtd-utils support NAND with 4k page size only.
Increase that to support up to 65k page size.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
io_read and io_update of mtd-utils use variable-length arrays for test data.
Since this could result in allocating many megabytes using alloca(), switch
to malloc().
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Add a missing space after PROGRAM_NAME and fix a typo.
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
UDEV_SETTLE_HACK addresses a problem which does no longer exist on Linux.
These days we have devtmpfs. New devices will automatically created on
the kernel side and user space has no longer to wait for udev.
As udev has a hard dependency on devtmpfs we can depend on it too.
People which don't use udev nor plain devtmpfs are anyways on their own.
Android, I'm looking at you...
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
To be independent on the size of off_t the format specifier determined of
common.h should be used instead of PRIu64.
Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
On 32bit systems (e.g. ARM) the size of off_t can be 4 byte and the size of loff_t 8 byte.
This causes compiler warnings like the following:
flash_erase.c: In function 'show_progress':
flash_erase.c:56:22: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'off_t {aka long int}' [-Wformat=]
bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ",
and an output like this:
~# flash_erase /dev/mtd2 0 1
Erasing 64 Kibyte @ 6400000000 -- 0 % complete
~#
Since the size of off_t and loff_t can differ from each other, the
printf format specifier should be determined separately for both.
Further the format specifiers should be based directly on the size of the
particular data type.
Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The --skip-bad-blocks-to-start option will increase the start address by
the size of each bad block encountered between the start of the partition
and the specified start address.
This can be useful if other readers of the partition will be reading using
a simple bad-block-skipping algorithm.
Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The --skip-bad-blocks-to-start option will increase the seek offset by the
size of each bad block encountered between the start of the partition and
the specified start address.
This can be useful when writing part way through a partition that will be
read using a simple bad-block-skipping algorithm.
Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
JFFS2 supports clustering erase blocks to virtual erase blocks.
nandwrite supports this, but previously mixed up virtual and
physical erase block numbers when checking for bad blocks.
This patch adds a function for checking if a virtual erase block
is bad and replaces the broken mtd_is_bad loop.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This patch makes sure that a virtual erase block is always
composed of a postivie number of erase blocks (i.e. 1 or more)
and enforces the block alignment to be a power of two as
suggested by the help text and assumed throughout the program.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
For some applications, like building a root filesystem for an embedded
device, it may be desireable to only build and install a subset of the
mtd-utils. This can be done throught the targets of the generated
Makefile and hand picking executables, however the jffsX and ubifs
utilities have external build dependencies that may not be needed.
This patch adds configure switches to disable building the jffsX and
ubifs utilities. Their respective build dependencies (zlib, lzo, uuid)
are only requested if the tools are being built.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Richard Weinberger <richard@nod.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Add correct casting for filestat.st_size in flashcp.c. While the
interim status updates had correct casting from commit 08b243, the
final update was not.
Signed-off-by: Jonathan Fether <jonf@mds.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Previously, the unit test sysfs mock files and headers were not
added to the distribution packag. Not packaging the header leads
to compilation of the unit tests failing. Not packaging the stub
files caueses the unit tests themselves to fail.
This patch explicitly adds the header and sysfs mock files to the
distribution target, allowing the unit tests to be used outside
the git tree.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Pull the buffer content checking code into separate function and
simplify the code invoking it slightly.
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Several tools are simply not checking return code of functions marked
with 'warn_unused_result'.
Provide wrappers for the read/write functions to avoid patching old
code and providing proper error handling.
Fix the remaining ones (calls to fgets() and system()).
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
|
|
Compiling for x86_64 generates a lot of warning because the PRIxoff_t and
PRIdoff_t are not properly defined, which comes from the missing
SIZEOF_LONG definition.
Use the autotools to generate a config.h header, include this header from
common.h and ask autoheader to generate the SIZEOF_LONG and SIZEOF_LOFF_T
definitions.
Use these new definitions to assign the proper descriptors to PRIxoff_t
and PRIdoff_t.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
|
|
Signed-off-by: Kees Trommel <ctrommel@linvm302.aimsys.nl>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The programs mkfs.jffs2 and mkfs.ubifs include those two headers if
WITHOUT_XATTR is not defined. Up to now, this macro is only defined
if the configure script is run with --without-xattr. If the headers
are not present on a system and the configure script is run without
special flags set, the build fails.
This patch adds a check for the presence of those headers and disables
the feature if one of the headers is missing.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Historically, the mtd-utils and ubi-utils were seperate packages. The
ubi-utils were at some point merged into the mtd-utils. They first
appeared in the release tar-ball in version 1.1.0 in their own
sub-hirarchy with their own buildsystem, readme, documentation, etc.
A lot of the duplicated stuff got centralized/removed over time.
This patch further cleans up the directory hirarchy duplication by
moving common libraries from the ubi-utils/ into the central lib/
and include/ directories in the top directory of the mtd-utils package.
This includes:
- libuib.a & libubigen.a used by the ubi utilities
- libscan.a currently only used by ubiformat
- libiniparser.a used by ubinize
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This patch moves the remaining 3 functions from ubiutils-common.{c,h}
into libmtd common.{c,h}.
The functions are only generic utility functions that other mtd-utils
programs may also find usefull and every program that uses libubi links
against libmtd anyway so there is no real reason for keeping around a
seperate ubiutils-common with only generic helper functions.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The function ubiutils_print_text was previously used by ubinize to
pretty-print parts of the help text. Since the help text has been
moved to a man page, the function is no longer used/needed.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This patch removes the lengthy help text from the ubinize utility
that attempted to describte the file format and every minor detail,
and reformats it into a more readable man page.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Add unittests for most functions provided by
libubi
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
|
|
unit tests for most functions provided by
libmtd.
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
|
|
add mocked sysfs used by libmtd and libubi
unittests
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
|
|
In order to use test files, allow sysfs root
to be set during compile time
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
|
|
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
|
|
Uninitialized buffers lead to failing
unittests, since padding was not set to 0.
Additionally this stops valgrind from complaining as well.
Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
|
|
Basically a user space port of the mtd sub page test kernel module.
In addition to the module parameters, the utility supports using
only a sub-range of the flash erase blocks with a configurable
stride and can restore the block contents after the test.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
|
|
Basically a user space port of the mtd page test kernel module.
In addition to the module parameters, the utility supports using
only a sub-range of the flash erase blocks with a configurable stride.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
|
|
Basically a user space port of the mtd read test kernel module.
In addition to the module parameters, the utility can scan only
a sub-range of the flash erase block with a configurable stride.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
|
|
Basically a user space port of the mtd speed test kernel module.
In addition to the module parameters, the utility can resture
the block contents after test and allows setting the maxium writes
for the test.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
|
|
Basically a user space port of the mtd speed test kernel module.
In addition to the block offset and count module parameters, the
utility supports a block stride and can restore the block contents
after test. Furthermore, a flag can be used to disable destructive
tests (i.e. only perform read speed tests).
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
|
|
Basically a user space port of the mtd stress test kernel module.
In addition to the block offset and count module parameters, the
utility supports a block stride and can restore the block contents
after test.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
|