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>
Errors may happen, it's e.g. easy on embedded devices to run out of space
when dumping big partitions. This patch adds a helper function for
writing. It deals with partial writes and just returns 0 on success or
error number.
The old code didn't check for errors at all which could result in
incomplete dumps without exiting with an error.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at>
This fix was initialially part of a patch submitted by Carsten Schlote
in January 2009. It didn't get merged back then because of coding style
issues and a proposed buffer size change guessed by shotgun debugging.
I was unable to reproduce the claimed segfaults in the compression
function that lead to the proposed buffer size change. Valgrind did
not issue any errors or warnings about the code in question either,
so I didn't include the proposed buffer size change.
The original patch also added a call to lzo_init(), which (according
to LZO documentation & source code) does not actually perform any
initialization, but only checks at runtime that the data type sizes and
endianness of the library code match those in the caller code and
should be unnecessary.
Other fixes from the original patch have already been added over
the years.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Rahul Bedarkar [Thu, 18 Aug 2016 17:41:30 +0000 (23:11 +0530)]
fs-tests: integrity: don't include header <bits/stdio_lim.h>
In commit ca7a5eda221d("integck.c: Fix buffer overflow in save_file")
we started including header <bits/stdio_lim.h>.
But with musl C library, we get following build error
integck.c:37:28: fatal error: bits/stdio_lim.h: No such file or directory
#include <bits/stdio_lim.h>
^
compilation terminated.
make[2]: *** [integck] Error 1
Header <bits/stdio_lim.h> is not available in musl C library. However
<stdio.h> has all definition that <bits/stdio_lim.h> supposed to be
providing. Moreover <bits/stdio_lim.h> shouldn't be included directly
instead we should be using <stdio.h>.
Since we already include <stdio.h> and in case of uClibc or glibc
<bits/stdio_lim.h> gets included internally, we can safely remove it.
Mathias Kresin [Sun, 12 Jun 2016 10:05:45 +0000 (12:05 +0200)]
mtd-utils: fix wrong format specifiers on mips32
This patch fixes the follwing compiler warnings:
flash_erase.c: In function 'show_progress':
flash_erase.c:56:22: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t {aka long long int}' [-Wformat=]
bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ",
^
./include/common.h:81:10: note: in definition of macro 'bareverbose'
printf(fmt, ##__VA_ARGS__);
which are linked to the following buggy numerical output:
Erasing 128 Kibyte @ 0 -- 917504 % complete flash_erase: Cleanmarker written at 0
Erasing 128 Kibyte @ 0 -- 1048576 % complete flash_erase: Cleanmarker written at 0
Signed-off-by: Mathias Kresin <dev@kresin.me> Signed-off-by: Richard Weinberger <richard@nod.at>
Michal Suchanek [Mon, 27 Jul 2015 13:47:10 +0000 (15:47 +0200)]
mtd-utils: mtd_debug: check amount of data read.
The kernel refuses to read more data from a MTD device than the device
size. However, mtd_debug does not check the amount of data read as
returned by read(2) and assumes the requested amount is always read when
there is no error. Reading 8M data from a 4M flash chip results in 8M
file containing the flash data at the start.
Signed-off-by: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Gary Bisson [Wed, 18 Dec 2013 01:03:06 +0000 (17:03 -0800)]
mtd-utils: nanddump: write requested length only
nanddump was always writing a whole page of data into the output
discarding the length actually requested. This patch allows to
write only the remaining length if oob is omitted. In case oob
is needed, it makes sense to copy the entire page.
Signed-off-by: Richard Weinberger <richard@nod.at>
David Oberhollenzer [Mon, 25 Apr 2016 22:13:22 +0000 (00:13 +0200)]
libmtd: Fix return status in mtd_torture test function
This patch fixes the return status of the mtd_torture function
in libmtd.
The torture test function is currently only used by the ubiformat
utility to check if a block is bad after a write fails (blocks are
marked bad if the function returns an error status). However, the
way the function was written, it ALWAYS returns an error value
regardless of whether it failed or not.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Mike Frysinger [Sun, 17 Apr 2016 02:11:51 +0000 (22:11 -0400)]
fix build warnings w/newer glibc & _BSD_SOURCE
The _BSD_SOURCE define has been deprecated for a while now. Instead,
code should be defining _DEFAULT_SOURCE. By defining both, it'll work
with both new & old versions warning-free.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Mike Frysinger [Sun, 17 Apr 2016 02:30:45 +0000 (22:30 -0400)]
include sys/sysmacros.h for major/minor/makedev
These functions have always been defined in sys/sysmacros.h under
Linux C libraries. For some, including sys/types.h implicitly
includes that as well, but glibc wants to deprecate that, and some
others already have. Include the header explicitly for the funcs.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Brian Norris [Tue, 26 Jan 2016 21:36:56 +0000 (13:36 -0800)]
Makefile: install: don't look for scripts in BUILDDIR
Our ${SCRIPTS} (e.g., flash_eraseall) are not found in the build
directory; they should be found in their original location.
This fixes a typo in the Makefile refactoring, which caused 'make
install' to fail with messages like:
make: *** No rule to make target '[...my source-build directory...]/armv7a-cros-linux-gnueabi/misc-utils/flash_eraseall'. Stop.
because the install target is looking in the wrong place for
flash_eraseall.
Fixes: 7d81790ced34 ("mtd-utils: Restructure the mtd-utils source.") Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Marcus Prebble [Tue, 6 Oct 2015 12:13:23 +0000 (14:13 +0200)]
libmtd: mtd_read: Take the buffer offset into account when reading
Assuming the read() call does not return zero and the result is less
than len, the current implementation will overwrite the data already
read in buf which doesn't seem correct.
With this patch, subsequent calls to read() within the loop will now no
longer overwrite the existing contents of buf.
Signed-off-by: Marcus Prebble <marcus.prebble@axis.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Fabien Proriol [Fri, 7 Nov 2014 13:46:28 +0000 (13:46 +0000)]
flashcp: Use %llu to print filestat.st_size
filestat.st_size type is off_t.
For some paltforms, off_t can be 32 or 64bit but there is no C99 format specifier for off_t.
The best way to print it with printf is to cast it to long long and print with %llu
Signed-off-by: Fabien Proriol <fabien.proriol@jdsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Daniel Walter [Tue, 3 Nov 2015 13:50:02 +0000 (14:50 +0100)]
Fix scanf() formatstring for modern C version
mkfs.jffs2 is using an old assignment-allocation
modifier for scanf(). Add a check so this modifier
does not get confused with a float formatstring
on newer C standard (C99 onwards).
Signed-off-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Fixes this build error:
mkfs.ubifs/compr.c:27:23: lzo/lzo1x.h: No such file or directory
mkfs.ubifs/compr.c: In function `lzo_compress':
mkfs.ubifs/compr.c:92: error: `lzo_uint' undeclared (first use in this function)
mkfs.ubifs/compr.c:92: error: (Each undeclared identifier is reported only once
mkfs.ubifs/compr.c:92: error: for each function it appears in.)
mkfs.ubifs/compr.c:92: error: syntax error before "len"
mkfs.ubifs/compr.c:95: error: `len' undeclared (first use in this function)
mkfs.ubifs/compr.c:96: warning: implicit declaration of function `lzo1x_999_compress'
mkfs.ubifs/compr.c:99: error: `LZO_E_OK' undeclared (first use in this function)
mkfs.ubifs/compr.c: In function `init_compression':
mkfs.ubifs/compr.c:201: error: `LZO1X_999_MEM_COMPRESS' undeclared (first use in this function)
Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Sascha Hauer [Thu, 12 Nov 2015 09:31:28 +0000 (10:31 +0100)]
mkfs.ubifs: Optionally create extended attribute with inode number
This is done to allow creating images suitable for IMA directory
appraisal. IMA creates a hash for directories and attaches this
hash to the directory itself as an extended attribute. Among other
things the inode numbers of the files are hashed. So, to create
a valid hash in the UBIFS image the evmctl tool needs to know
the inode numbers which the files in the UBIFS image will have.
evmctl will read the inode numbers from the user.image-inode-number
extended attribute. Since extended attributes are inodes themselves
the inode numbers for the generated image will change when the
extended attributes change, so to generate a correctly hashed
UBIFS image, both evmctl and mkfs.ubifs must be run twice:
1) execute evmctl to iterate over the directory tree. This will
create the security.ima and security.evm extended attributes.
The existence of the attributes makes sure that subsequent
calls to mkfs.ubifs will use the same inode numbers. evmctl
will use the inode numbers from the host filesystem in this
step which makes the resulting image unusable
2) execute mkfs.ubifs -a. This will create the user.image-inode-number
extended attributes on files/directories added to the image.
3) execture evmctl again. This time evmctl will pick the inode
numbers from the user.image-inode-number extended attribute
instead of the ones from the host filesystem
4) execute mkfs.ubifs again. This will create the correct image.
The now existing user.image-inode-number extended attributes
are ignored and not added to the image.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Sascha Hauer [Thu, 12 Nov 2015 09:31:27 +0000 (10:31 +0100)]
mkfs.ubifs: Add extended attribute support
This adds extended attribute support to mkfs.ubifs. When creating
an image from a directory tree the existing extended attributes are
added to the UBIFS image.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Sascha Hauer [Thu, 12 Nov 2015 09:31:26 +0000 (10:31 +0100)]
mkfs.ubifs: simplify make_path with xasprintf
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Sascha Hauer [Thu, 12 Nov 2015 09:31:25 +0000 (10:31 +0100)]
mkfs.ubifs: use xmalloc/xzalloc for allocating memory
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Sascha Hauer [Thu, 12 Nov 2015 09:31:24 +0000 (10:31 +0100)]
mkfs.ubifs: change add_directory argument to 'existing'
A 'non_existing' argument which is only used with !non_existing
is just too confusing. Change this to positive logic.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Dongsheng Yang [Sat, 31 Oct 2015 03:12:01 +0000 (11:12 +0800)]
mtd-utils: Restructure the mtd-utils source.
* There is no code modification in this commit, only moving
* the files to proper place.
The user tools looks a little messy as we place almost
the all tools in the root directory of mtd-utils. To make
it more clear, I propose to introduce the following structure
for our source code.
Brian Norris [Thu, 27 Aug 2015 22:03:21 +0000 (15:03 -0700)]
flash_{un,}lock: support both lock/unlock in the same binary
Add new --lock/--unlock flags, so we can do either with the same binary.
This will prepare for the addition of other features, so we don't have
to keep duplicating the same binary via #include "flash_unlock.c".
The defaults still work as expected: flash_unlock will default to
REQUEST_UNLOCK, and flash_lock will default to REQUEST_LOCK.
Eventually, we might deprecate one of the two (flash_unlock, probably),
so we only have to ship one flash_{un,}lock binary.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Brian Norris [Fri, 30 Oct 2015 00:12:01 +0000 (17:12 -0700)]
nandtest: support hex/dec/oct for --offset and --length
These two options are handled inconsistently, which caused an
unnecessary amount of head scratching. Let's just use the simple helpers
too, so we get the error handling right.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Paul McGougan [Thu, 17 Apr 2014 05:09:26 +0000 (05:09 +0000)]
mtd: tests: Fix endian issue with CRC generation algorithm
The calculation of the CRC in /tests/checkfs/makefiles.c was writing the CRC
Into the produced files in host byte-order which would cause CRC validation
to fail on big-endian systems as the validation is performed bytewise.
Signed-off-by: Paul McGougan <pmcgougan AT topcon.com>
[Brian: add endian.h] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
mtd-utils: ubinize: Always return error code (at least -1) in case of an error
ubinize should not fail silenty, this can be very annoying when using
it from other tools that rely on the exit code for determining the
success of their operation.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Brian Norris [Fri, 28 Aug 2015 16:05:43 +0000 (09:05 -0700)]
don't include system headers in dependency files
System library headers are not strictly part of our build. If they are
changing beneath our feet, then we probably have bigger problems.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Suggested-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Brian Norris [Thu, 27 Aug 2015 22:48:22 +0000 (15:48 -0700)]
autogenerated dependency files are not being utilized properly
TL;DR Acked-by: Mike Frysinger <vapier@gentoo.org>
=====
Auto-generated dependency rules are not being written correctly, so
changes to dependent files (e.g., headers) do not actually trigger
rebuilds.
The problem
===========
It appears that when a dependency generation flag is passed directly to
the preprocessor (with '-Wp,...'), it loses information about the output
path. So, it just makes up the output name as $(basename).o, with no
path information. This yields .*.c.dep files that look like this:
This is the case for both in-tree *and* out-of-tree builds. Naturally,
this is a problem for out-of-tree builds. But it is also a problem for
in-tree builds, because we use rules like this for builds:
$(BUILDDIR)/%.o: %.c
and make doesn't recognize $(BUILDDIR)/%.o as the same as %.o even when
$(BUILDDIR) == $(PWD).
Example failures
================
## Rebuilding after touching common header doesn't recompile anything
$ make
(...)
$ touch include/libmtd.h
$ make
CHK include/version.h
## Same for out-of-tree builds
$ BUILDDIR=test make
(...)
$ touch include/libmtd.h
$ BUILDDIR=test make
CHK include/version.h
I noticed this when seeing that flash_lock would not get rebuilt when
modifying flash_unlock.c (where 99% of the source code lies):
$ make
(...)
$ touch flash_unlock.c
$ make
CHK include/version.h
CC flash_unlock.o
LD flash_unlock
The fix
=======
Just pass -MD straight to the compiler, and make sure to specify the
output file for the dependency info with -MF.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Dongsheng Yang [Mon, 29 Jun 2015 08:49:19 +0000 (16:49 +0800)]
mtd-utils: ubi-tests: fix a some overflows
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Dongsheng Yang [Mon, 29 Jun 2015 08:49:18 +0000 (16:49 +0800)]
mtd-utils: fs-tests: pass TEST_DIR to integck in run_all.sh
Test integck requires a parameter but run_all.sh did no pass any to it.
Then:
integck: error!: test file-system was not specified (use -h for help)
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Nam T. Nguyen [Tue, 28 Apr 2015 15:12:12 +0000 (08:12 -0700)]
mtd-utils: Add mtdpart to add/delete partition
Add a simple utility to exercise BLKPG ioctl.
Signed-off-by: Nam T. Nguyen <namnguyen@chromium.org> Acked-by: Mike Frysinger <vapier@chromium.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Like uClibc version older than (not yet released) 0.9.34 musl does not have
a rpmatch() implementation.
uClibc defines both __UCLIBC__ and __GLIBC__. So first check for uCibc and its
version and then for a non glibc implementation (like musl). Note, musl does
not define __MUSL__.
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Bernhard Walle [Sat, 2 May 2015 12:38:06 +0000 (14:38 +0200)]
mkfs.ubifs: Fix build with gcc 5.1
In gcc 5.1, the default C standard which is used to compile a C file,
has changed from gnu89 to gnu11. This changed the meaning of 'extern
inline'. See https://gcc.gnu.org/gcc-5/porting_to.html.
In mkfs.ubifs, this leads to multiple definitions of
hashtable_iterator_key and -hashtable_iterator_value. I think the most
pragmatic way to fix the issue is to replace 'extern inline' with
'static inline' here.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Brian Norris [Mon, 15 Sep 2014 17:35:00 +0000 (10:35 -0700)]
libmtd: don't ignore "region index" parameter in mtd_regioninfo()
ioctl(MEMGETREGIONINFO) has one input parameter (regionindex) and three
output parameters (info about the erase region). There are two problems
in mtdinfo/libmtd here:
1. mtdinfo.c doesn't initialize its region_info_user struct, instead
passing uninitialized data to mtd_regioninfo()
2. mtd_regioninfo() fails to utilize the 'regidx' parameter to fill out
the regionindex parameter properly, so the garbage from mtdinfo.c is
propagated to the ioctl()
This means that mtdinfo will continuously probe the same (possibly
out-of-range) erase region, instead of looping over the valid regions.
Let's fix this in the mtd_regioninfo() helper, and at the same time,
let's zero out the mtdinfo.c buffer, as an additional precaution to keep
from using uninitialized data.
Initial error report from Yang, when running "mtdinfo /dev/mtd0" on a
Cavium 6100 board:
root@CN61XX:~# mtdinfo /dev/mtd0
mtd0
Name: phys_mapped_flash
Type: nor
Eraseblock size: 65536 bytes, 64.0 KiB
Amount of eraseblocks: 128 (8388608 bytes, 8.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Additional erase regions: 0
Character device major/minor: 90:0
Bad blocks are allowed: false
Device is writable: true
libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 0
error 22 (Invalid argument)
Eraseblock region 0: info is unavailable
libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 1
error 22 (Invalid argument)
Eraseblock region 1: info is unavailable
Reported-by: Yang Wei <Wei.Yang@windriver.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
ubiformat: fix the subpage size hint on the error path
David Binderman <dcb314@hotmail.com> reports that the following piece of looks
wrong:
if (!args.subpage_size != mtd->min_io_size)
normsg("may be sub-page size is incorrect?");
I totally agree with him and I believe that we actually meant to have no
negation in fron to f 'args.subpage_size', so instead, the code should look
like this:
if (args.subpage_size != mtd->min_io_size)
normsg("may be sub-page size is incorrect?");
libmtd: fix mtd_dev_present return value on legacy systems
On legacy systems, if "/proc/mtd" doesn't exist or gives a read error,
mtd_dev_present returns -1 (since it calls legacy_dev_present), contrary
to what's specified in the header file.
This causes checks like
if (mtd_dev_present(n)) {
...
}
to give false positives. Fix this by comparing the return value to 1.
Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Guido Martínez [Thu, 14 Aug 2014 16:29:45 +0000 (13:29 -0300)]
nandtest: fix --reads argument
The --reads option specifies the argument as optional, but doesn't check
for a null optarg, which means that nandtest segfaults when run as
"nandtest --reads".
Fix this by making the argument required, and changing the help text to
not specify it as optional. Argument -r already specifies the argument
as required, so we fix this inconsistency too.
The current nandtest performs a simple test which consists of:
1. erase block
2. write data
3. read and verify
In order to improve the nandtest strength, this commit adds a new parameter
to increase the number of "read and verify" iterations. In other words,
the test now consists of:
1. erase block
2. write data
3. read and verify (N times)
This seem to apply more pressure on a NAND driver's ECC engine and has been
used to discover stability problems with an old OMAP2.
include/common.h: fix build against recent 0.9.33 uClibc
An implementation of rpmatch() was backported to the 0.9.33 branch of uClibc.
So the uClibc version check introduced in commit 50c9e11f7e (include/common.h:
fix build against current uClibc) is not enough. Rename the local rpmatch()
implementation to avoid collision.
Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
include/common.h: fix build against current uClibc
Commit dbe0fd17f2 (mtd-utils: new prompt() helper for talking to the user)
introduced a rpmatch() call. However, uClibc versions older than (not yet
released) 0.9.34 don't have rpmatch() implementation. Add one.
Artem Bityutskiy [Mon, 7 May 2012 08:44:38 +0000 (11:44 +0300)]
make_a_release.sh: suggest announcement e-mail
The 'make_a_release.sh' script appears to be extremely useful - I do not
forget things as I used to anymore (amending Makefile, signing, uploading
to the FTP server, etc). It is very useful that it suggest me exact commands
which I may just copy-past to my command line.
This patch improves the script and makes it suggest the e-mail announcement
which I may just copy-paste to my command line and the announcement will
be sent using 'git send-email' command. It will include all the interested
parties in CC.
Brian Norris [Mon, 31 Mar 2014 17:03:04 +0000 (10:03 -0700)]
ubiformat: correct "non-ubifs" warning message
UBI's raw flash scan actually scans for UBI data, not UBIFS data (there
*are* UBI users that are not UBIFS!), so correct the warning message.
This also matches the comment in libscan.h.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Aaron Sierra [Fri, 27 Sep 2013 16:34:04 +0000 (11:34 -0500)]
mtd-utils: Makefile: add LDFLAGS_mkfs.ubifs
The build rule for mkfs.ubifs was missing an LDFLAGS_* variable like
mkfs.jffs2 had. This prevented mkfs.ubifs from being built against
explicit external libraries which is needed when cross-compiling.
This also adds UUIDCPPFLAGS and UUIDLDFLAGS variables to support the
mkfs.ubifs build.
Huang Shijie [Tue, 20 Aug 2013 05:58:37 +0000 (13:58 +0800)]
check the MLC nand type
In the current code, the MTD_NANDFLASH stands for both the SLC and MLC.
In the kernel, the MTD_NANDFLASH only stands for the SLC now,
so in order to keep the logic unchanged, we should also check the MLC
NAND by MTD_MLCNANDFLASH.
Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Mike Frysinger [Thu, 9 May 2013 17:59:24 +0000 (13:59 -0400)]
ubiupdatevol: add a --skip option
This already has a --size option for controlling how many bytes to read
from the input. Add a --skip option to control the offset into the input
too. This way people don't have to do `dd | ubiupdatevol`.
While we're here, I've fixed the types used with args.size and the read
loop so that they can hold the right sizes (like setting a 32bit+ size).
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mike Frysinger [Thu, 9 May 2013 00:03:14 +0000 (20:03 -0400)]
nandwrite: add --input-{skip,size} options
If you have a file image and want to copy sub-portions out and into
NAND, there's no easy way to do that. You can use dd to extract it
to a temp file, or pipe it to nandwrite 1 page at a time. Both suck.
Add two new flags to explicitly set the size and offset of the input
file. Seeking stdin isn't currently supported as I'm not sure it's
necessary. It wouldn't be hard to add though...
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mike Frysinger [Thu, 9 May 2013 00:03:13 +0000 (20:03 -0400)]
nandwrite: clean up length types
We use 'int' in many places to represent offsets/sizes. That obviously
does not play well with larger NAND devices on 32bit systems. Instead,
use the right type as needed:
- long long to represent the length of the image
- use fstat() rather than lseek();lseek(); to get the length of the image
- use size_t/ssize_t when working with read()
- tweak the printf formats as needed
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mike Frysinger [Wed, 8 May 2013 16:27:26 +0000 (12:27 -0400)]
mkfs.ubifs: allow reformatting of devices
Sometimes I want to re-initialize an existing ubifs, but the tool
currently bails out if the volume is already formatted. Prompt the
user instead so they can decide.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mike Frysinger [Wed, 8 May 2013 16:27:24 +0000 (12:27 -0400)]
move _GNU_SOURCE to the main makefile
A bunch of utils are relying on _GNU_SOURCE already. The new prompt code
uses getline() which is now part of POSIX, but in older versions of glibc,
it was behind _GNU_SOURCE as it was a GNU extension.
This change doesn't actually tie us to glibc. Only code that uses GNU
extensions does that. It just kills warning when using older versions of
glibc.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mike Frysinger [Wed, 8 May 2013 16:26:13 +0000 (12:26 -0400)]
fix build errors w/newer kernel headers & glibc
Building with linux-headers-3.9 and glibc-2.17 fails like so:
In file included from summary.h:15:0,
from jffs2dump.c:37:
/usr/include/linux/uio.h:16:8: error: redefinition of 'struct iovec'
struct iovec
^
In file included from /usr/include/bits/fcntl-linux.h:38:0,
from /usr/include/bits/fcntl.h:61,
from /usr/include/fcntl.h:35,
from jffs2dump.c:25:
/usr/include/bits/uio.h:43:8: note: originally defined here
struct iovec
^