aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-08-24Release mtd-utils-2.0.1v2.0.1David Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-08-24mtd-utils: tests: Avoid using less than two blocks in nandpagetestMiquel Raynal
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>
2017-08-10mtd-utils: ubinfo: add parameter checkAaron Marcher
Adds a check if the UBI device number is specified when passing a volume name as parameter. This fixes an issue, where by default an inexistent UBI device named "ubi-1" is selected because of missing checks. Signed-off-by: Aaron Marcher <me@drkhsh.at> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-07-10mkfs-ubifs: fix inclusion of uuid.hRolf Eike Beer
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>
2017-07-03mtd-utils: tests: Add Erased Pages Bit Flip TestHarpreet Eli Sangha
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>
2017-06-28Add const modifier to read only strings and string constantsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28Silence warnings about unused argumentsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28Remove unused variables and functionsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28Eliminate warnings about missing prototypesDavid Oberhollenzer
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>
2017-06-28Enable compiler warningsDavid Oberhollenzer
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>
2017-06-28Move libfec declarations to public header in global include directoryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28Use autoconf header detection correctly for libmissingDavid Oberhollenzer
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>
2017-06-28Restructure autoconf configure.acDavid Oberhollenzer
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>
2017-06-28Replace defunct ubifs_assertDavid Oberhollenzer
The ubifs assert defined in defs.h was only used in three places inside key.h and defined to never perform any checks at all. This patch replaces ubifs_assert in mkfs.ubifs with the regular libc assert macro. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28mtd-utils: tests: Fix nandbiterrs Failure CheckHarpreet Eli Sangha
After a page read, the old failure statistics are compared against the new failure statistics before the new values are actually read. Signed-off-by: Harpreet "Eli" Sangha <harpreet@nestlabs.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14ubi-utils: Return error code if command line option is unknownDaniel Wagner
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>
2017-06-14nor-utils: Return error code if command line option is unknownDaniel Wagner
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>
2017-06-14jffsX-utils: Return error code if command line option is unknownDaniel Wagner
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>
2017-06-14ftl_format: Use return directly to leave main functionDaniel Wagner
We can use return with the exit code instead of the sliglty odd exit, return pattern. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14flashcp: Drop exit code definesDaniel Wagner
The EXIT_{FAILURE|SUCCESS} are already defined in stdlib.h. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14Use defines for exit code valuesDaniel Wagner
Make the usage of exit consist. That is use the pre defined exit values. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-05-31mkfs.ubifs: Add support for symlinks in device tableDavid Engraf
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>
2017-03-29libiniparser: remove unused function needing floatAndrea Adami
Fixes: | LD ubi-utils/ubiformat | .../git/ubi-utils/libiniparser.a(libiniparser.o): In function | ` LD ubi-utils/ubirename | iniparser_getdouble': | .../git/ubi-utils/libiniparser.c:336: undefined reference to `atof' Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so remove it: floating-point is not supported in klibc Upstream-Status: Pending Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-03-29libubi.c: add klibc specific fixes for ioctlAndrea Adami
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>
2017-03-22Return correct error number in ubi_get_vol_info1David Oberhollenzer
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>
2017-03-15Fix libmtd behaviour if MTD is not present on the systemDavid Oberhollenzer
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>
2017-03-02Fix build with muslKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-03-02Replace rpmatch() usage with checking first character of lineDavid Oberhollenzer
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>
2017-03-02Fix alignment trap triggered by NEON instructionsYuanjie Huang
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>
2017-02-21mtd-utils: Support jffs2 flash-erase for large OOB (>32b)Manikandan Ramachandran
"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>
2017-02-21ubi: tests: Speedup io_paral by using rand_r()Richard Weinberger
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>
2017-02-21ubi: tests: Support up to 65k NAND page sizeRichard Weinberger
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>
2017-02-21ubi: tests: Replace variable-length array with malloc()David Gstir
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>
2017-02-20Remove README.udev from ubi-tests extra distDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-02-20ubirename: trivial fixes to the help textLuca Ceresoli
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>
2017-02-20Remove UDEV_SETTLE_HACKRichard Weinberger
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>
2017-02-20mtd-utils: serve_image: Use PRIdoff_t as format specifier.Torsten Fleischer
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>
2017-02-20mtd-utils: Fix format specifier definitions for off_t and loff_t.Torsten Fleischer
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>
2017-01-18nanddump: Add --skip-bad-blocks-to-start optionMike Crowe
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>
2017-01-18nandwrite: Add --skip-bad-blocks-to-start optionMike Crowe
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>
2017-01-12nandwrite: fix/cleanup bad block skippingDavid Oberhollenzer
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>
2017-01-12nandwrite: replace erase loop with mtd_erase_multiDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-01-12nandwrite: add stricter sanity checking for blockalignDavid Oberhollenzer
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>
2016-12-22Release mtd-utils-2.0.0v2.0.0David Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-12-22mtd-utils: Add configure switches to disable jffsX or ubifs toolsDavid Oberhollenzer
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>
2016-12-14Release mtd-utils-2.0.0-rc2v2.0.0-rc2David Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-12-14Enable tests so they are included in the make dist targetDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-12-14mtd-utils: Correct casting for final status report in flashcpJonathan Fether
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>
2016-12-13Fix packaging of unit test filesDavid Oberhollenzer
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>
2016-12-09nandwrite: Factor out buffer checking codeMarek Vasut
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>