Age | Commit message (Collapse) | Author |
|
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Since nandwrite doesn't write OOB data by default, we don't dump OOB data
by default, in order to be a more proper inverse function.
Remove the warnings and change the default.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
As warned earlier, we are changing the meaning of `nanddump -o' to
mirror the usage in nandwrite, where -o means to include OOB (i.e.,
`nandwrite -o' writes data to both in-band and out-of-band areas, so
`nanddump -o' should dump data from both in-band and out-of-band areas).
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
The libcrc32.a is only used in one place: mkfs.ubifs. But this also
uses libmtd.a, and the only file in libcrc32.a is also in libmtd.a.
So libcrc32.a itself is completely redundant. Punt!
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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>
|
|
Include a few notes about the edited options and new defaults for bad
block handling in nanddump.
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>
|
|
This brings the mtdinfo utility in line with the functionality
of the flash_info utility. It dumps the erase regioninfo (if
the devices has it) as well as showing a handy eraseblock map
(if the user has requested it). The eraseblock map also shows
which blocks are locked and which ones are bad.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
A previous commit moved the code using this var into a diff func.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We are going to add some more code which prints eraseblocks map, so we need to
make 'print_dev_info()' a bit smaller to keep the code readable.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch first of all, re-names 'mtd_islocked()' into 'mtd_is_locked()' since
this seems to be the name Mike wanted, and it looks a bit nicer.
This patch also makes 'mtd_is_locked()' print an error message if it fails. I'm
not sure if it is good idea for a library to do so, but all functions do this,
so it certainly _not_ a good idea to be inconsistent.
However, for the special case, when the the "is locked" ioctl is not supported
or is not valid for this device, we do not print an error message and return
ENOTSUPP error code.
Thus, the user can distinguish between real errors and non-fatal "not
supported" cases.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This extends the libmtd with the helper functions:
mtd_regioninfo: interface to MEMGETREGIONINFO
mtd_islocked: interface to MEMISLOCKED
Users of these functions will follow shortly ...
Artem: do not print error message in mtd_islocked()
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The external lzo dep can be a pain to deal with when cross-compiling,
so make it optional for jffs2. This is useful if people aren't even
using the functionality, or for quicker development.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Artem: tweak the warning message
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Usage/version information should go to stdout when it is expected behavior
(i.e. the user requested it explicitly). This info should go to stderr
only when the usage info is being shown as a result of incorrect options.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
... because mtd device node name do not have to follow the "/dev/mtd%d"
pattern.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Not strictly necessary, but this is good library behavior and
should carry no runtime overhead.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Linux FLAT toolchains produce .gdb files alongside the normal program
for debugging purposes (so linking to "foo" will also produce "foo.gdb").
Ignore these too.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This basically reverts commit 43feb39f35a9ee0ed3 which changed the full
length calculation to be one less than one sector. I don't understand
the logic in the commit message where it states that the length should
be one sector smaller as this results in misbehavior at runtime.
For example, with a mtd device with total size 0x400000 and erase block
size of 0x20000 (which gives us a total of 32 sectors), this new logic
results in:
mtdLockInfo.start = 0;
mtdLockInfo.length = 0x3e0000; /* (32 - 1) * 0x20000 */
Calling MEMLOCK/MEMUNLOCK on the device with this range leaves the last
sector unchanged which is certainly not what we want. So drop this -1
part of the calculation.
To look at it another way, if we only attempt to lock one sector, this
calculation would end up with the .length set to 0. Calling MEMLOCK
with a length of 0 does not lock the sector as this simple code shows:
int main(int argc, char *argv[]) {
erase_info_t e0 = { 0, 0 }, e1 = { 0, 0x20000 };
int fd = open(argv[1], O_RDONLY);
ioctl(fd, MEMUNLOCK, &e1);
printf("%i\n", ioctl(fd, MEMISLOCKED, &e1));
ioctl(fd, MEMLOCK, &e0);
printf("%i\n", ioctl(fd, MEMISLOCKED, &e1));
}
MEMISLOCKED returns 0 both times. If we change the argument to MEMLOCK
to e1, then MEMISLOCKED returns 1.
Signed-off-by: Steven Miao <realmz6@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Now that the utils have equivalent functionality, merge the two source
code bases so they can't diverge in the future.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The flash_lock util has a bit of extra argument checking, and it supports
a magic value of "-1" to mean "all blocks".
The flash_unlock util supports automatic 2nd/3rd arguments to unlock the
whole flash. It also supports multiple bases (not just hex) for selecting
the range of the device to unlock.
So tweak both utilities so that they have equivalent functionality again
by adding the missing features to each.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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>
|
|
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>
|
|
In commit 04665066ebedb0a31335b525fb5f19df32cb8cfe it was noted that the free
space fixup feature would be available in kernels 2.6.40 or greater. Since
then it has been decided that the release following 2.6.39 will be 3.0.
Replace the instances of 2.6.40 with 3.0.
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Commit 924862c864da0b62cf93ba7abf2dc78a7e6ac48f broke ubimkvol parrameters
parsing by initializing the 'error' parameter of 'simple_strtoul()' to 1
instead of 0. This patch fixes the issue.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Currently pcv macro print the error message only if we are not doing power cut
testing or if we have -v flag. But if we run without -v and an error happen
and the error code is not EROFS/EIO, pcv() does not print anything. This patch
makes it print the error message in that case as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The 'file_new()' function should create a file but should not keep it
open. There is a different path to open files and keep them open. This
patch makes 'file_new()' close newly created files.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch makes the directory checking in case of power cut emulation
actually work. There were many bugs. Basically, we cannot rely on anything
unless the directory is marked as clean.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make -v switch control verbose integck output.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Check the clean data after every emulated power cut, not only when
'create_test_data()'/'update_test_data()' succeed. This required some minor
re-work.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Add a helper 'sync_directory()' function to synchronize directories.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
In 'dir_check()' print name of the directory if we fail to open it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Currently when we are doing UBIFS power cut emulation testing we assume that
EROFS is returned in case of an emulated power cut event. However, this is
not true and sometimes Linux returns EIO to user-space instead. Namely, this
happens when we are waiting for write-back to finish. Here is a call trace
form kernel 2.6.39-rc7:
Call Trace:
[<ffffffff810aaa77>] filemap_write_and_wait_range+0x78/0xb1
[<ffffffff8110f34d>] vfs_fsync_range+0x38/0xd3
[<ffffffff8110f42b>] generic_write_sync+0x43/0x65
[<ffffffff810ab0c9>] generic_file_aio_write+0xaa/0xf2
[<ffffffffa02224c9>] ubifs_aio_write+0x13a/0x1a1 [ubifs]
[<ffffffff810ed71f>] do_sync_write+0xcb/0x141
[<ffffffff810ee016>] vfs_write+0xb0/0x150
[<ffffffff810ee175>] sys_write+0x48/0x72
[<ffffffff813e0692>] system_call_fastpath+0x16/0x1b
'filemap_fdatawait_range()' returns hard-coded -EIO if a page write-back
happens with whatever error code.
Thus, this patch teaches integck to handle EIO when doing power cut emulation
testing.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch adds -m <mtdnum> option to integck and teaches integck to re-attach
the MTD device to UBI in case of an emulated power cut event. This is needed
for the new UBI power cut and unstable bits emulation infrastructure: when UBI
emulates a power cut the only way to recover form this is to re-attach the MTD
device.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This adds a superblock flag indicating that "free-space fixup" is needed, and
allows it to be set by the user via the "-F" command-line option. The first
time the filesystem is mounted, this flag will trigger a one-time re-mapping of
all LEBs containing free space. This fixes problems seen on some NAND flashes
when a non-UBIFS-aware flash programmer is used.
Artem: add a bit more help text, tweaked the patch a bit.
Thanks to Ben Gardiner <bengardiner@nanometrics.ca> for help.
Signed-off-by: Matthew L. Creech <mlcreech@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When we are in power cut mode read all files after re-mounting. This will
check that FS recovery worked well and all files are readable after recovery.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Currently we always verify holes when truncating, but we have -v switch for
this and should do this only if -v was given.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|