David Oberhollenzer [Wed, 1 Nov 2017 22:08:45 +0000 (23:08 +0100)]
Enable further warning flags, address new warnings
mtd_debug: Remove a duplicate if case. MTD_CAP_NANDFLASH has only one
flag set (MTD_WRITEABLE). Directly below, we had a check for
MTD_WRITEABLE in the else branch which can't possible ever have
triggered. Checking for MTD_WRITEABLE in addition to the CAP constants
was probably not intended anyway, given the check for the individual
flags if all else fails.
integck: We already established that "r" is less than the number of
elements in the list, so the loop condition doesn't need to check
if w is NULL in addition. At least this way, the compiler "gets"
that w cannot be NULL below and doesn't issue warnings.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Thu, 21 Sep 2017 09:15:32 +0000 (11:15 +0200)]
Mark or fix switch cases that fall through
Now that C++17 introduced a special fallthrough keyword for
explicitly tagging switch cases that are supposed to fall
through, newer gcc versions also implement a feature request
from 2002 to warn about maybe unwanted fall-throughs in switch
cases in other languages (like C).
For C code, we can either add a gcc specific attribute at the
end of the switch case, or use a special comment that gcc checks
for, indicating that the fall-through behaviour is indeed
intended.
This patch adds a "/* fall-through */" comment at the end of
various case blocks to silence gcc warnings and in some cases
a break, where fall-through was probably not intended.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Thu, 21 Sep 2017 11:36:42 +0000 (13:36 +0200)]
Add no-return attribute to usage() style functions
A common pattern in command line processing is having a usage()
function that prints out how to use the command line options and
then terminates.
The function is typically used inside a switch block for command
line options like `-h' or unknown options. In a lot of places, the
break keyword is omitted, because the function exits anyway. However,
this triggers gcc warnings about implicit fall-through.
Rather than adding a phony "/* fall-through */" this patch flags the
usage() style function with a gcc attribute, indicating that they do
not return and removes further superfluous break statements.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Thu, 21 Sep 2017 14:16:22 +0000 (16:16 +0200)]
misc-utils: initialize "ip" in docfdisk to NULL
Technically it is initializied in the for loop right before being
used. From the conditional above, we know that the for loop is
executed at least once and the variable is always initialized, but
gcc doesn't appear to perform the same reasoning.
This patch adds an initialization of the variable for the sake of
making the compiler happy.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Miquel Raynal [Thu, 24 Aug 2017 10:59:46 +0000 (12:59 +0200)]
mtd-utils: tests: Avoid using less than two blocks in nandpagetest
Forbid the use of less than 2 eraseblocks in nandpagetest. It is obvious
that the test cannot run on zero block, but it cannot run on only one
block neither. The reason is: get_first_and_last_block() will return the
same id for both the first and the last blocks. In erasecrosstest(),
the logic is:
- erase/write/read/verify first block
- erase/write again first block
- erase *last* block
- read/verify first block
When using only one block, 'first' refers to the same block as 'last',
leading to erasing the block before reading it. Hence, the test would
fail with no actual reason.
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
The include directory exported by uuid.pc is */include/uuid, so uuid.h
must be included without any directory in the path. This usually works
out because uuid is installed in the normal prefix, so the parent
directory of what uuid has as include dir ends up in the include path
anyway. In case one uses a custom uuid outside of the regular include
path this breaks.
Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Harpreet Eli Sangha [Fri, 30 Jun 2017 22:12:18 +0000 (15:12 -0700)]
mtd-utils: tests: Add Erased Pages Bit Flip Test
Bit flip detection for written and erased pages tend to have different
implementations. Where written pages are detected and corrected using
ECC, erased pages are typically detected by ensuring that the number of
zeros is less than a specified threshold.
As such, it's necessary to have the 'nandbiterrs' test support the
testing of written and erased pages. Bit flips in erased pages are
emulated by rewriting the page in raw mode, to prevent the use of ECC.
Signed-off-by: Harpreet Eli Sangha <harpreet@nestlabs.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Thu, 22 Jun 2017 11:37:40 +0000 (13:37 +0200)]
Eliminate warnings about missing prototypes
This patch eliminates warnings generated by the -Wmissing-prototypes
option. With this flag set, we are now forced to have prototypes for
all global, exported functions, that have to be made visible to the
definitions and we are forced to mark all local functions as static.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Thu, 22 Jun 2017 13:06:58 +0000 (15:06 +0200)]
Enable compiler warnings
This patch borrows the compiler.m4 script from util-linux to check
for compiler support of a number of warning flags and sets them if
they are supported.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Wed, 21 Jun 2017 08:27:47 +0000 (10:27 +0200)]
Use autoconf header detection correctly for libmissing
AC_CHECK_HEADERS already makes sure our config header contains a
HAVE_$FOO_H macro if a header was found. There is no need to
awkwardly set our own Automake conditionals and check for it all
over the place in the Automake files.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Wed, 14 Jun 2017 13:06:41 +0000 (15:06 +0200)]
Restructure autoconf configure.ac
This patch attempts to cleanly seperate configure switches,
dependency checking and generating of output files inside
the autoconf configure.ac file.
Also, instead of aborting immediately if a dependency is missing,
the configure script now completes dependency checking and then
lists ALL dependencies that are missing for the selected build
options. In addtion, suggestions on how to disable some features
that require the missing dependencies are printed out.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Daniel Wagner [Mon, 12 Jun 2017 10:50:54 +0000 (12:50 +0200)]
ubi-utils: Return error code if command line option is unknown
The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.
We need to return -1 instead of EXIT_FAILURE to be consistent with the
other exit code places.
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Daniel Wagner [Mon, 12 Jun 2017 10:50:52 +0000 (12:50 +0200)]
nor-utils: Return error code if command line option is unknown
The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Daniel Wagner [Mon, 12 Jun 2017 10:50:42 +0000 (12:50 +0200)]
jffsX-utils: Return error code if command line option is unknown
The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Engraf [Tue, 23 May 2017 06:52:52 +0000 (08:52 +0200)]
mkfs.ubifs: Add support for symlinks in device table
It is not possible to change ownership for symlinks in the device table file.
This patch adds support for symlinks equal to mkfs.jffs2 and updates the
sample device table file. The permission entry for symlinks in the device
table must be set to 0777.
Signed-off-by: David Engraf <david.engraf@sysgo.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Andrea Adami [Sat, 28 Jun 2014 22:40:15 +0000 (00:40 +0200)]
libubi.c: add klibc specific fixes for ioctl
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>
David Oberhollenzer [Wed, 22 Mar 2017 09:10:23 +0000 (10:10 +0100)]
Return correct error number in ubi_get_vol_info1
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>
David Oberhollenzer [Wed, 15 Mar 2017 10:26:38 +0000 (11:26 +0100)]
Fix libmtd behaviour if MTD is not present on the system
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>
David Oberhollenzer [Thu, 2 Mar 2017 10:40:36 +0000 (11:40 +0100)]
Replace rpmatch() usage with checking first character of line
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>
Yuanjie Huang [Thu, 2 Mar 2017 09:43:56 +0000 (10:43 +0100)]
Fix alignment trap triggered by NEON instructions
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>
Manikandan Ramachandran [Thu, 6 Aug 2015 18:38:14 +0000 (11:38 -0700)]
mtd-utils: Support jffs2 flash-erase for large OOB (>32b)
"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>
Richard Weinberger [Mon, 22 Feb 2016 13:52:05 +0000 (14:52 +0100)]
ubi: tests: Speedup io_paral by using rand_r()
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>
Richard Weinberger [Mon, 22 Feb 2016 13:52:04 +0000 (14:52 +0100)]
ubi: tests: Support up to 65k NAND page size
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>
David Gstir [Mon, 22 Feb 2016 13:52:03 +0000 (14:52 +0100)]
ubi: tests: Replace variable-length array with malloc()
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>
Richard Weinberger [Tue, 26 Apr 2016 21:47:37 +0000 (23:47 +0200)]
Remove UDEV_SETTLE_HACK
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>
Torsten Fleischer [Sat, 11 Feb 2017 16:43:31 +0000 (17:43 +0100)]
mtd-utils: Fix format specifier definitions for off_t and loff_t.
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 ",
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>
Mike Crowe [Tue, 17 Jan 2017 11:54:04 +0000 (11:54 +0000)]
nanddump: Add --skip-bad-blocks-to-start option
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>
Mike Crowe [Tue, 17 Jan 2017 11:54:03 +0000 (11:54 +0000)]
nandwrite: Add --skip-bad-blocks-to-start option
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>
David Oberhollenzer [Wed, 11 Jan 2017 13:02:04 +0000 (14:02 +0100)]
nandwrite: fix/cleanup bad block skipping
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>
David Oberhollenzer [Wed, 11 Jan 2017 10:45:18 +0000 (11:45 +0100)]
nandwrite: add stricter sanity checking for blockalign
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>
David Oberhollenzer [Wed, 21 Dec 2016 14:42:12 +0000 (15:42 +0100)]
mtd-utils: Add configure switches to disable jffsX or ubifs tools
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>
Jonathan Fether [Wed, 14 Dec 2016 02:00:28 +0000 (18:00 -0800)]
mtd-utils: Correct casting for final status report in flashcp
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>
David Oberhollenzer [Mon, 12 Dec 2016 10:31:59 +0000 (11:31 +0100)]
Fix packaging of unit test files
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>
Marek Vasut [Fri, 9 Dec 2016 01:47:41 +0000 (02:47 +0100)]
nandwrite: Factor out buffer checking code
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>
Boris Brezillon [Fri, 25 Nov 2016 17:30:41 +0000 (18:30 +0100)]
common: Fix 'unchecked return code' warnings
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>
Boris Brezillon [Fri, 25 Nov 2016 17:30:40 +0000 (18:30 +0100)]
common: Fix PRI{x,d}off definitions for x86_64 platform
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>
David Oberhollenzer [Tue, 29 Nov 2016 21:31:11 +0000 (22:31 +0100)]
Define WITHOUT_XATTR if sys/acl.h or sys/xattr.h is missing
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>
David Oberhollenzer [Thu, 1 Sep 2016 13:52:33 +0000 (15:52 +0200)]
Move ubi-utils libraries to common library location
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>
David Oberhollenzer [Thu, 1 Sep 2016 13:27:38 +0000 (15:27 +0200)]
Merge rest of ubiutils-common into libmtd common
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>
David Oberhollenzer [Thu, 1 Sep 2016 13:08:06 +0000 (15:08 +0200)]
Remove unused ubiutils_print_text from ubi-utils common
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>
David Oberhollenzer [Thu, 1 Sep 2016 13:03:14 +0000 (15:03 +0200)]
Add ubinize manpage
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:21:57 +0000 (16:21 +0200)]
mtd-utils: Add nand sub-page test utility
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:19:55 +0000 (16:19 +0200)]
mtd-utils: Add nand page test utility
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:14:37 +0000 (16:14 +0200)]
mtd-utils: Add flash read test utility
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:12:20 +0000 (16:12 +0200)]
mtd-utils: Add nand flash bit errors test
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:10:16 +0000 (16:10 +0200)]
mtd-utils: Add flash speed test utility
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:08:34 +0000 (16:08 +0200)]
mtd-utils: Add flash stress test utility
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>
David Oberhollenzer [Mon, 22 Aug 2016 14:05:19 +0000 (16:05 +0200)]
mtd-utils: Add flash torture test utility
Basically a user space port of the mtd torture 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.
In contrast to the kernel module, the torture test is implemented by
the libmtd mtd_toruture function and thus doesn't allow for similarly
fine grained options on diagnostics.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Thu, 1 Sep 2016 09:20:05 +0000 (11:20 +0200)]
Add libmissing
This patch adds a libmissing library to mtd-utils, containing
implementations of functionality found in glibc but typically
missing from embedded C libraries such as uclibc ot musl.
For now, the library only contains stub implementations of
the backtrace*() family of functions.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Tue, 19 Jul 2016 13:06:58 +0000 (15:06 +0200)]
Unify version string printing
When a program does sophisticated enough command line processing
(i.e. getopt), make sure it responds to -V and --version.
When a program prints a version string, make sure it uses the
common_print_version macro to print out its name, that it is part
of mtd-utils and the mtd-utils version from the build system in a
fashion similar to common program packages like the GNU coreutils.
When a program responds to -V/--version or -h/--help, make sure it
reports success exit status.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Wed, 13 Jul 2016 14:10:28 +0000 (16:10 +0200)]
Integrate tests into autotools build system
Add automake files for the test binaries. If configured to do so,
install the test binaries to libexec/mtd-utils and use autoconf to
fix the paths in the test scripts.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Richard Weinberger [Tue, 26 Apr 2016 20:09:08 +0000 (22:09 +0200)]
Change build system to autotools
This patch is largely based on Richards original RFC.
The major differences to the RFC patch are:
- Add missing sumtools & mtdpart targets
- Fix name of mkfs.jffs2 target
- Add missing subdir-objects option for non-recursive make
- Move all automake options to configure.ac
- Add manpages to install target
- Make XATTR & LZO support configurable
- Install binaries to sbin directory like in the old build system
- Install flash_erase wrapper script
- Add files missing from distribution target
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Thu, 1 Sep 2016 15:47:48 +0000 (17:47 +0200)]
Remove feature-removal-schedule.txt
This patch removes the old feature-removal-schedule.txt file from
mtd-utils, mostly for reasons similar to the ones that lead to the
decision of removing the feature-removal-schedule.txt from the kernel.
Removing features by itself is rather problematic as there is no
simple way of estimating whether something is being used widley or
not at all. Thus, consensus usually tends towards not removing
features at all.
Even if there is a file anouncing feature removal, users in large
won't read this file _if_ it is even included in distribution
packages. People working on mtd-uils would end up removing features
that _they_ find useless and users would start complaining once
their setups break after they install a new version of mtd-utils.
In conclusion, once introduced, features should not be removed to
begin with and this file is entirely usless.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
David Oberhollenzer [Tue, 23 Aug 2016 13:40:44 +0000 (15:40 +0200)]
Remove duplicate copies of GPLv2 license text
Some of the programs in the mtd-utils used to be seperate packages that
were at some point merged into mtd-utils. As a result, some subdirectories
contain their own README and COPYING files with copies of the GPLv2
license text.
Since those programs are now part of mtd-utils that contains a copy of the
GPLv2 in the file COPYING in the package root directory, those extra files
can be removed, as there is no need for distributing an extra copy of the
license text for each individual program in the bundle.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Tue, 23 Aug 2016 10:17:28 +0000 (12:17 +0200)]
Remove RPM spec file
Building packages for distributions is typically something highly
distribution specific. While there are widely used package formats
like RPM, implementing a de-facto standard, the build process,
list of files actually packaged, list of required dependencies,
package grouping, package versioning, etc... is still _very_
distribution specific. In fact, this spec file completely fails to
address some of these points.
Actual RPM based distributions out there currently use their own,
distribution specific, RPM spec files that were possibly _based_ on
this one at some point (judging from similar descriptions).
The spec file _may_ have worked at some point, but it definitely doesn't
work with the new build system and there is no real reason to fix it
(which, by definition, isn't possible for the reasons above) and drag it
along for another decade or two.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Thu, 25 Aug 2016 11:41:50 +0000 (13:41 +0200)]
Remove unused and broken mtd_write_img function from libmtd
The function _tries_ to support short reads but doesn't adjust the
pointer into the buffer. If a short read happens, we scrambles the
flash contents. Interrupted reads aren't handled. Short or
interrupted writes aren't handled at all. Either a write succeeds
writing the entire buffer or the function gives up.
During an attempt at fixing it, it was discovered, that no mtd-utils
program uses this function. Furthermore, its highly specific nature
makes it more of a "feature looking for use case".
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Tue, 23 Aug 2016 11:12:06 +0000 (13:12 +0200)]
Remove jffs-dump.c
This _entire_ file is dead code. The download packages on the FTP
server contain it all the way back to mtd-utils 1.0, but it isn't
built in any of them. The git history (which dates back to 2006)
contains no instance where that file was ever used in a build process.
A quick look at various distribution packages didn't reveal any that
contained a jffs-dump utilty. There have been no major changes to this
file since the initial commit. It won't even compile as it doesn't have
a PROGRAM_NAME defined required by common.h at least since 2010.
At this point, it can be safeley assumed that nobody will miss this.
They had at least 10 years to do something about it.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>