Age | Commit message (Collapse) | Author |
|
As promised, we change the default bad block handling method to
--bb=skipbad. This works as a better inverse to nandwrite, since
nandwrite skips bad blocks when writing data.
And of course, we remove the warning messages.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
As mentioned previously, we are killing --omitbad in favor of the new
--bb=skipbad option, which functions fairly similarly. Also, --noskipbad
has become --bb=dumpbad, so remove the old `-N' and `--noskipbad' flags.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
To work as a proper inverse to nandwrite, nanddump must not dump OOB data by
default. This patch prints a warning regarding the future change. We also
suggest using the new flag, `--oob', for transitioning to the next release
with new default behavior.
Note that we are changing `-o' to mean `--oob' in the next release,
similar to `nandwrite -o'. This is a break from previous behavior.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
Adds an explicit option for including OOB data in our data dump.
Currently, this is the default behavior, but in the next release, the
default will be to exclude OOB data. This is done to mirror the '-o'
option in nandwrite.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
In an upcoming release, we will no longer default to --bb=padbad. Instead,
the default will be --bb=skipbad. This makes nanddump a better inverse
operation to nandwrite.
This patch prints warnings for users so that they get a chance to update
their scripts before the default changes officially.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
--noskipbad will soon be replaced by --bb=dumpbad, and --omitbad is being
removed entirely in favor of --bb=skipbad.
This patch adds warnings when using inappropriate configurations and adds
info to the help message. Please plan to migrate to the new usages shortly.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
We are moving to unify bad block handling methods under the --bb=METHOD
option. Since --skipbad has not been included in a mtd-utils release yet,
we can safely replace it without a deprecation and phase-out period.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
We have too many separate bad block handling methods:
--omitbad
--noskipbad
--skipbad
On top of these, we have the default option: that bad blocks are
replaced with 0xFF.
These options will be unified under --bb=METHOD. The end goal will be
something like:
----------------------------------------------------------------------------------------------
Old option New option Comment
----------------------------------------------------------------------------------------------
<default> --bb=padbad dump flash data, substituting 0xFF for any bad blocks
--noskipbad --bb=dumpbad dump flash data, including any bad blocks
--skipbad --bb=skipbad dump good data, completely skipping any bad blocks (new default)
--omitbad N/A very similar to `skipbad' (DEPRECTATED)
The BB options are all mutually exclusive, so we check that we do not
have more than one BB option explicitly enabled on the command line by
tracking whether or not a BB method has been set by the user.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch adds a new option "--skipbad" to nanddump. It is subtly
different than "--omitbad". The following description was included in
the help message to attempt to clarify the differences.
Notes on --omitbad and --skipbad:
With either option, we stop dumping data when we encounter a bad block
and resume dumping at the next good block. However, with --omitbad, we
count the bad block as part of the total dump length, whereas with
--skipbad, the bad block is 'skipped,' that is, not counted toward the
total dump length.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Implement the feature which we planned long time ago - make nanddump
fail if the -s parameter is not NAND page-aligned. Also bump nanddump
version.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The mtd-descriptor attributes contain signed data, not unsigned.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Includes error messages for negative device offsets and negative lengths,
telling the user what the offending option and value were.
Previous patch left out the "negative" in the error message.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
For consistency between nanddump and nandwrite and in order to provide
better means for checking for negative inputs, the "offset" and "length"
types in nanddump should be changed to signed integer types. This also
solves a signed/unsigned comparison warning.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
A do-while loop in pretty_dump_to_buffer() can be refactored into a
single sprintf() statement. MAX() and MIN() are used to ensure that:
(1) We have at least a single space between hex and ASCII output
(2) We don't overflow the line buffer
This patch was suggested by Mike Frysinger.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Per Mike Frysinger's suggestion, we check for strtoll() and strtoull()
errors by using the "common.h" helper functions simple_strtoll() and
simple_strtoull().
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We should allow the dump length to be 64-bit, especially since the value
was read in as a "long long" by strtoll().
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Adds support for 64-bit offsets (i.e., devices larger than 4GB).
Utilizes the "unsigned long long" data type as the standard type
for 64-bit offsets throughout. Reformats a few printf statements
to avoid casting and to properly handle "long long."
Calls to ioctls are mostly replaced by libmtd interfaces (which should
choose the proper ioctls for us); however, a few remain and probably
should be handled with more robust interfaces, as some of these
ioctls are considered "legacy."
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
There were some signed/unsigned integer comparisons. Their types were
changed for safety. Also, "strtol" was improperly used for unsigned
data types.
Nanddump's pretty print options needed a slight reformat to prepare for
printing offsets that are more than 32 bits (8 hex characters) wide.
This prevents overlap of output and ensures that at least one space is
printed between hex and ascii printouts. Perhaps this could use some
better alignment in the future.
Other fixes:
* Corrected several simple spacing issues
* Changed indentation of some global variable declarations in
order to prepare for the next patch, which makes those
declarations longer
* Used macro for PRETTY_ROW_SIZE instead of constant 16
* Reformatted, edited a multi-line comment
* Removed some unnecessary casts
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
|
|
nanddump should be consistent with nandwrite, which does not accept non page
aligned start addresses. Thus, non page aligned dumps are useless.
To ease migration only warn for now. Add the plan of making this an error to
feature-removal-schedule.txt.
Tweaked by Artem.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The buffers used for dumping page and OOB data needed dynamic
allocation to help eliminate burdens for updating (i.e., every
time there's a new OOB size we don't have to increase the sizes).
Also, there is no need to check flash chips for "standard sizes."
With recent changes to the printing codebase, we should be able to
handle arbitrary sizes with no problem.
More exit operations are now necessary on program failure, so
"goto closeall" is used more liberally.
Also, common.h is included for the use of xmalloc.
[conflicts fixed by Artem]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Check the first block even when start_addr is not eraseblock aligned.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When dumping oob data of a bad block, initialize oobbuf with 0xff, instead of
readbuf. This avoids bogus oob data on output.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make sure all the utils define PROGRAM_NAME and do so at the start of
the file so that sub-headers may assume it exists.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
"nobad" might lead to the assumption that bad blocks are skipped, but this
option does exactly the opposite. Use a more descriptive name.
Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Sometimes dumping bad blocks is useful, like when the data isn't actually
bad but the OOB layout isn't what the kernel is expecting or is otherwise
screwed up. The --nobad option allows just that.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Nowhere in the nanddump code is the "ignoreerrors" variable used. So
drop the option completely.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Hex dumps were being printed with the nybbles reversed since
commit 6ff458433ba15b8a7cb258ce64e64e98982df26e
Fix.
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
CC: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Restrict binary dumping so that by default, binary garbage is not
printed directly to a terminal. Output redicted to files or piped to
other commands should not be affected (as judged by "isatty(ofd)").
A new flag "-a" or "--forcebinary" is included so that users can
override this behavior if necessary.
Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Added the "-c" or "--canonicalprint" flag (modelled off 'hexdump -C')
so that users can choose to print ASCII output next to the prettyprint
output. This is really an extension to the prettyprint option, so the two
options do not conflict if they are both included in the same execution.
Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Adapted code from the linux kernel hex_dump_to_buffer() (lib/hexdump.c)
to provide a more robust hexdump for the pretty option. Now, nanddump
can print out any size of OOB (or page for that matter...) without
having to worry about non-multiples of 16.
This also provides ability to dump ASCII format next to the hex output
once additional command-line flags are added.
Tested with Samsung K9GAG08U0D
Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Supported OOB and page sizes can now be changed more easily by a
macro constant. NAND_MAX_OOBSIZE needed increased to support 218
and 224 byte OOB.
Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Add support for oobsize 64 and writesize 4096 in nanddump & nandwrite.
Artem: some more info from further e-mail exchange:
> Are there flashes with the 4096 page / 64 spare combination? Could you
> refer to one? May be any URL? I thought 4096 comes with 128.
Much to my regret I can't provide a URL because is not public. IGEP v2
board has a Onenand with two dice of 2048/64 spare combination but mtd
views 4096/64. The minimal write page is 4K (2K from first dice and 2K
from second dice).
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Tested with Samsung K9GAG08U0D.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Added support for the '-q,--quiet' option to suppress diagnostic output.
Made the new option mutually-exclusive with the pretty print option.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Realign help usage output to make it more explict when a description
needs to be wrapped.
Use sentence case for the help usage output option short descriptions.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Added include directive for stdbool.h and leveraged where appropriate
to improve code readability by making variable intent and usage more
explicit.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Pass the MTD device node and dump file name as arguments to perror
rather than more ambigous, static messages on open failures.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Replace main exit and return status codes with equivalent mnemonics.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Static-qualified all globals except 'main' because they have no use
beyond file scope.
Constant-qualified MTD device and input positional parameter globals.
Constant-qualified argv array.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Add support for 4K pages in nanddump & nandwrite.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The $Id:$ tags are left over from the old CVS repository. Several files have
since been changed, and they generally have little value in a git repo so they
should be removed.
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Older kernel do not implement the MTDFILEMODE ioctl. In this case
nandwrite and nanddump should have used MEMGETOOBSEL in combination
with MEMSETOOBSEL. Unfortunately the return value of the unsucessfull
ioctl is not -ENOTTY, but -1 and errno contains ENOTTY. This change
fixes this issue. I have not tested all cornercases. Would be
good if someone could do more careful testing than I did, or maybe
reviewing is sufficient in this case.
Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Some OneNAND chips use this spec.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Add the missing long option '--file'.
From: Timo Lindhorst <lindhors@linux.vnet.ibm.com>
Signed-off-by: Timo Lindhorst <lindhors@linux.vnet.ibm.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
|
|
The NAND rework exposes more information to userspace and
has a different mechanism to read raw FLASH contents without
ECC. Update nanddump and nandwrite. Use the new ECC statistics
ioctl to inform the user about corrected and uncorrectable
bitflips.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
Follow the kernel in the rename.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
|