]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
12 years agolibubi: kill ubi_attach_mtd
Artem Bityutskiy [Thu, 23 Aug 2012 08:37:05 +0000 (11:37 +0300)]
libubi: kill ubi_attach_mtd

The 'ubi_attach_mtd()' is not used and it is redundant now. 'ubi_attach()'
function may be used instead.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agolibubi: factorize ubi_attach and ubi_attach_mtd code
Richard Genoud [Wed, 22 Aug 2012 16:04:34 +0000 (18:04 +0200)]
libubi: factorize ubi_attach and ubi_attach_mtd code

The req->mtd_num value is now updated with the MTD device number found
by mtd_node_to_num.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoubi-user.h: add max_beb_per1024 parameter
Richard Genoud [Wed, 22 Aug 2012 09:27:59 +0000 (11:27 +0200)]
ubi-user.h: add max_beb_per1024 parameter

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoUBI: sync ubi-user.h with kernel v3.6-rc1
Richard Genoud [Wed, 22 Aug 2012 09:27:56 +0000 (11:27 +0200)]
UBI: sync ubi-user.h with kernel v3.6-rc1

Also remove the eraseblock type support, because kernel commit
a65a0eb6d198e058687a9214683bd1c418f20d39 set the dtype
parameter as obsolete.

Also adjust to some renames:
* 'UBI_PROP_DIRECT_WRITE' -> 'UBI_VOL_PROP_DIRECT_WRITE'
* 'struct ubi_set_prop_req' -> 'struct ubi_set_vol_prop_req'.
* 'UBI_IOCSETPROP' -> 'UBI_IOCSETVOLPROP'

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostress-test.sh: remove a warning
Artem Bityutskiy [Fri, 3 Aug 2012 14:25:40 +0000 (17:25 +0300)]
stress-test.sh: remove a warning

If /proc/mtd does not exist, we have this warning:
grep: /proc/mtd: No such file or directory

Get rid of this.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostress-test.sh: add mtdram tests
Artem Bityutskiy [Fri, 3 Aug 2012 13:38:16 +0000 (16:38 +0300)]
stress-test.sh: add mtdram tests

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostress-test.sh: support testing without sub-pages
Artem Bityutskiy [Fri, 3 Aug 2012 12:36:04 +0000 (15:36 +0300)]
stress-test.sh: support testing without sub-pages

Run the tests with VID header at the second page as well for better coverage.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostress-test.sh: develop the test further
Artem Bityutskiy [Fri, 3 Aug 2012 08:33:07 +0000 (11:33 +0300)]
stress-test.sh: develop the test further

Add a lot of test passes on nandsim with different geometry.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoruntests.sh: print more consistent messages
Artem Bityutskiy [Fri, 3 Aug 2012 08:32:18 +0000 (11:32 +0300)]
runtests.sh: print more consistent messages

On success we print "SUCCESS", lets print "FAILURE" on failure.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim: switch to sh
Artem Bityutskiy [Fri, 3 Aug 2012 07:35:36 +0000 (10:35 +0300)]
load_nandsim: switch to sh

We do not use bashizms any longer, so we can switch to 'sh'. Also, use
strict sh options.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: simplify the code
Artem Bityutskiy [Fri, 3 Aug 2012 07:33:35 +0000 (10:33 +0300)]
load_nandsim.sh: simplify the code

First find out what the kernel module parameters should be, then load it
once, instead of doing it in each 'case' section.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: rename variable
Artem Bityutskiy [Fri, 3 Aug 2012 07:22:40 +0000 (10:22 +0300)]
load_nandsim.sh: rename variable

Rename local variables - make them more descriptive and stop using capital
letters.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: introduce a separate usage function
Artem Bityutskiy [Fri, 3 Aug 2012 07:19:07 +0000 (10:19 +0300)]
load_nandsim.sh: introduce a separate usage function

Just because this is more readable.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: intruduce fatal function
Artem Bityutskiy [Fri, 3 Aug 2012 07:18:04 +0000 (10:18 +0300)]
load_nandsim.sh: intruduce fatal function

And used it, which simplifies the code.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: use dochere for help output
Artem Bityutskiy [Fri, 3 Aug 2012 07:14:33 +0000 (10:14 +0300)]
load_nandsim.sh: use dochere for help output

Because it is cleaner.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostress-test.sh: do not use pipe unnecessarily
Artem Bityutskiy [Fri, 3 Aug 2012 07:11:02 +0000 (10:11 +0300)]
stress-test.sh: do not use pipe unnecessarily

Use 'grep patt file' instead of cat file | grep patt.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: use less bashisms + cleanups
Artem Bityutskiy [Fri, 3 Aug 2012 07:09:17 +0000 (10:09 +0300)]
load_nandsim.sh: use less bashisms + cleanups

Use posix shell constructs in the "if" statements.
Additionally, use quotes everywhere for variables.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agoload_nandsim.sh: remove useless function
Artem Bityutskiy [Fri, 3 Aug 2012 07:01:18 +0000 (10:01 +0300)]
load_nandsim.sh: remove useless function

We do not really need a separate complex function to check if nandsim
is already loaded or not. Besides, it is safer to check /proc/mtd
in case nandsim is compiled-in.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agotests: ubi: add stress-test.sh
Artem Bityutskiy [Thu, 2 Aug 2012 18:51:43 +0000 (21:51 +0300)]
tests: ubi: add stress-test.sh

It is not finished yet, but it will run all tests on nandsim and mtdram
of different geometry.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agotests: ubi: clean-up runtests.sh some more
Artem Bityutskiy [Thu, 2 Aug 2012 14:51:39 +0000 (17:51 +0300)]
tests: ubi: clean-up runtests.sh some more

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agotests: ubi: clean-up the runtests.sh script
Artem Bityutskiy [Thu, 2 Aug 2012 14:38:05 +0000 (17:38 +0300)]
tests: ubi: clean-up the runtests.sh script

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agomtd-utils: Check mtdoffset is not larger than mtd.size in case of a bad block.
Tomer Barletz [Tue, 26 Jun 2012 21:46:41 +0000 (14:46 -0700)]
mtd-utils: Check mtdoffset is not larger than mtd.size in case of a bad block.

mtdoffset is being tested against mtd.size in the outer two loops, but
the third nested one does not test against it.
In case of a bad block we'll try to access an out of bounds offset in
the next MEMGETBADBLOCK ioctl, which will fail with EINVAL.
In case mtdoffset is indeed larger than the partition size, we need to
bail, since there are not enough "good" blocks to complete the write.

Signed-off-by: Tomer Barletz <barletz@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agonandwrite: minor cleanups
Artem Bityutskiy [Fri, 29 Jun 2012 07:18:57 +0000 (10:18 +0300)]
nandwrite: minor cleanups

Remove extra brackets and some style changes to make it more readable for a
person who deals mostly with the kernel code.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agoRelease mtd-utils-1.5.0 v1.5.0
Artem Bityutskiy [Mon, 7 May 2012 07:19:39 +0000 (10:19 +0300)]
Release mtd-utils-1.5.0

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agomtd-utils: better document --pagesize of mkfs.jffs2
Shmulik Ladkani [Thu, 3 May 2012 18:59:59 +0000 (21:59 +0300)]
mtd-utils: better document --pagesize of mkfs.jffs2

Add a strict explanation '--pagesize' refers to target system's mm page
size.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agoMakefile: fixup previous 'make clean' fix
Brian Norris [Wed, 28 Mar 2012 23:59:06 +0000 (16:59 -0700)]
Makefile: fixup previous 'make clean' fix

Apparently, Makefile comments need to be made without indentation. Otherwise,
they are printed out as shell commands. This fix prevents seeing this in your
shell during 'make clean':

  $ make clean
  ...
  # findutils v4.1.x (RHEL 4) do not have '+' syntax
  ...

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agoMakefile: fix "make clean" for old GNU find
Brian Norris [Fri, 9 Mar 2012 17:49:09 +0000 (09:49 -0800)]
Makefile: fix "make clean" for old GNU find

findutils v4.1.x does not have the `-exec CMD {} +' syntax. We can just as
easily use the `-exec CMD {} \;' syntax. However, it will launch a lot more
`rm' processes, so we only use it if the first form fails with an error.
This isn't a perfect solution (`find -exec +' can fail for other reasons)
but it works well enough.

This problem manifests itself in RHEL 4, findutils 4.1.20:

  $ make clean
  rm -f /XXX/mtd-utils/*.o /XXX/mtd-utils/ftl_format  ...
  find: missing argument to `-exec'
  make: *** [clean] Error 1

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agomkfs.ubifs: do not ignore --max-leb-cnt when formatting an UBI volume
Artem Bityutskiy [Wed, 7 Mar 2012 14:08:30 +0000 (16:08 +0200)]
mkfs.ubifs: do not ignore --max-leb-cnt when formatting an UBI volume

When the output file is an UBI volume - mkfs.ubifs just sets --max-leb-cnt
to the volume size and ignores the user-supplied --max-leb-cnt value, which
is wrong. Let's set it to the volume size only if the user did not supply
--max-leb-cnt.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd_legacy: don't open device in R/W
Brian Norris [Wed, 8 Feb 2012 21:26:21 +0000 (13:26 -0800)]
libmtd_legacy: don't open device in R/W

On legacy kernels with ROM devices, we can get mtdinfo errors like:

libmtd: error!: cannot open "/dev/mtd4"
        error 13 (Permission denied)
mtdinfo: error!: libmtd failed get MTD device 4 information
         error 13 (Permission denied)

We don't need O_RDRW access for informational ioctls(), so make this
O_RDONLY.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: perform device checking first
Brian Norris [Wed, 8 Feb 2012 21:26:20 +0000 (13:26 -0800)]
libmtd: perform device checking first

If we don't check for the MTD before calling `legacy_get_dev_info1', we may
get errors like:

libmtd: MTD subsystem is old and does not support sysfs, so MTD character device nodes have to exist
libmtd: error!: "/dev/mtd2" is not a character device
mtdinfo: error!: libmtd failed get MTD device 2 information
         error 22 (Invalid argument)

So reverse the order of these two checks.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: fix mtd_write() issues for large data-only writes
Brian Norris [Sat, 11 Feb 2012 04:35:05 +0000 (20:35 -0800)]
libmtd: fix mtd_write() issues for large data-only writes

ioctl(MEMWRITE) is implemented with memdup_user(), and so it allocates
kernel memory in contiguous regions. This limits its usefulness for large
amounts of data, since contiguous kernel memory can become scarce. I have
experienced "out of memory" problems with ubiformat, for instance, which
writes in eraseblock-sized regions:

  ...
  ubiformat: flashing eraseblock 12 -- 72 % complete
  ubiformat: page allocation failure.
  order:8, mode:0xd0
  Call Trace:
  [<8043fa7c>] dump_stack+0x8/0x34
  [<8008c940>] __alloc_pages_nodemask+0x408/0x618
  [<800bd748>] cache_alloc_refill+0x400/0x730
  [<800bdbbc>] __kmalloc+0x144/0x154
  [<8009cae4>] memdup_user+0x24/0x94
  [<802d04e4>] mtd_ioctl+0xba8/0xbd0
  [<802d0544>] mtd_unlocked_ioctl+0x38/0x5c
  [<800d43c0>] do_vfs_ioctl+0xa4/0x6e4
  [<800d4a44>] sys_ioctl+0x44/0xa0
  [<8000f95c>] stack_done+0x20/0x40
  ...
  libmtd: error!: MEMWRITE ioctl failed for eraseblock 12 (mtd0)
          error 12 (Cannot allocate memory)
  ubiformat: error!: cannot write eraseblock 12
             error 12 (Cannot allocate memory)

This error can be mitigated for now by only using ioctl(MEMWRITE) when we
need to write OOB data, since we can only do this in small transactions
anyway. Then, data-only transactions (like those originating from
ubiformat) can be carried out with write() calls.

This issue can also be solved within the kernel ioctl(), but either way,
this patch is still useful, since write() is more straightforward (and
efficient?) than ioctl() for data-only writes.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agomtdinfo: correct grammar on error message
Brian Norris [Thu, 9 Feb 2012 18:13:31 +0000 (10:13 -0800)]
mtdinfo: correct grammar on error message

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: fix segmentation fault on lib->mtd
Brian Norris [Thu, 9 Feb 2012 18:13:30 +0000 (10:13 -0800)]
libmtd: fix segmentation fault on lib->mtd

Legacy systems do not initialize lib->mtd, so we shouldn't perform
strlen(lib->mtd); this produces a segmentation fault. As this code isn't
used in the legacy codepath, we can just move it down to an 'else' branch.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolimbtd: implement mtd_dev_present for old kernels
Artem Bityutskiy [Thu, 9 Feb 2012 18:13:29 +0000 (10:13 -0800)]
limbtd: implement mtd_dev_present for old kernels

Implement the 'legacy_dev_present()' function which will check whether an MTD
device is present by scanning the /proc/mtd file when the MTD subsystem does
not support sysfs (the case for pre-2.6.30 kernels).

This patch also moves the 'mtd_dev_present()' function to a slightly more
logical position.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agodocfsdisk: minor cosmetic cleanup
Artem Bityutskiy [Thu, 2 Feb 2012 11:27:03 +0000 (13:27 +0200)]
docfsdisk: minor cosmetic cleanup

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agomtdinfo: fix `--all' for non-consecutive device numbers
Brian Norris [Fri, 27 Jan 2012 18:30:46 +0000 (10:30 -0800)]
mtdinfo: fix `--all' for non-consecutive device numbers

When we have assigned non-consecutive device numbers to our MTD devices,
then we run `mtdinfo --all', we get errors once mtdinfo tries to process
the devices in the "hole". For instance, suppose that at boot time, we have
one MTD (/dev/mtd0) then perform a sequence like the following:

 # modprobe mtdram
 # modprobe nandsim
 # rmmod mtdram

Then at this point, we have should have devices 0 and 2 without 1. Then:

 # mtdinfo --all
 ...
 mtdinfo: error!: mtd1 does not correspond to any existing MTD device

We add a check to first see if device is present, then continue to the next
ID if it doesn't exist.

Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: add `mtd_dev_present()' library function
Brian Norris [Fri, 27 Jan 2012 18:30:45 +0000 (10:30 -0800)]
libmtd: add `mtd_dev_present()' library function

Will be used for `mtdinfo --all'

Artem: add a temporary stub for pre-2.6.30 kernels.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agoubinfo: fix `--all' for non-consecutive device numbers
Brian Norris [Thu, 26 Jan 2012 07:31:50 +0000 (23:31 -0800)]
ubinfo: fix `--all' for non-consecutive device numbers

When we have assigned non-consecutive device numbers to our UBI devices,
then we run `ubinfo --all', we get errors once ubinfo tries to process the
devices in the "hole". For instance, suppose there are two UBI devices,
/dev/ubi0 and /dev/ubi10; then, ubinfo will fail trying to open /dev/ubi1
with:

  ubinfo: error!: cannot get information about UBI device 1
         error 2 (No such file or directory)

This patch adds a check to first see if device is present, then continue
to the next ID if it doesn't exist.

Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibubi: make `ubi_dev_present()' a library function
Brian Norris [Thu, 26 Jan 2012 07:31:49 +0000 (23:31 -0800)]
libubi: make `ubi_dev_present()' a library function

We will use this function in ubinfo.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: Variable name same as function name causing compile to fail (Android)
Thomas Cannon [Mon, 9 Jan 2012 16:20:53 +0000 (16:20 +0000)]
libmtd: Variable name same as function name causing compile to fail (Android)

When compiling mtd-utils against Android's bionic libc using the
supplied cross compiler environment it errors:

lib/libmtd.c: In function 'dev_node2num':
lib/libmtd.c:444: error: called object 'major' is not a function
lib/libmtd.c:445: error: called object 'minor' is not a function
lib/libmtd.c: In function 'mtd_probe_node':
lib/libmtd.c:1384: error: called object 'major' is not a function
lib/libmtd.c:1385: error: called object 'minor' is not a function

This patch updates the variable names for "major" and "minor" in two
places. It then compiles cleanly.

Artem: pick different names, also rename major1/minor1 variables for
consistency.

Signed-off-by: Thomas Cannon <mail at thomascannon.net>
Cc: linux-mtd at lists.infradead.org
13 years agomake_a_release.sh: remind about pushing the master branch
Artem Bityutskiy [Mon, 19 Dec 2011 20:37:28 +0000 (22:37 +0200)]
make_a_release.sh: remind about pushing the master branch

When we print about pushing the tag, also print about pushing the
master branch - I forgot to do this when releasing 1.4.9.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
13 years agoRelease mtd-utils-1.4.9 v1.4.9
Artem Bityutskiy [Sat, 17 Dec 2011 14:38:56 +0000 (16:38 +0200)]
Release mtd-utils-1.4.9

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agolibmtd: allow write operations when MEMWRITE is not supported
Brian Norris [Fri, 9 Dec 2011 19:45:14 +0000 (11:45 -0800)]
libmtd: allow write operations when MEMWRITE is not supported

MEMWRITE is a recently introduced write interface for MTD; however, it
is only supported on NAND flash. mtd-utils should fall back to
old write methods when either ENOTTY or EOPNOTSUPP are returned.

This is a showstopper when, for instance, using ubiformat on NOR, which
don't have a mtd->write_oob interface (and thus don't support MEMWRITE):

  ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
          error 122 (Operation not supported)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
13 years agoAdd a script to make releases
Artem Bityutskiy [Wed, 7 Dec 2011 07:09:22 +0000 (09:09 +0200)]
Add a script to make releases

Credits to Mike Frysinger <vapier.adi@gmail.com> for review and comments.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13 years agonandtest: seed random generator with time
Brian Norris [Fri, 2 Dec 2011 17:46:12 +0000 (09:46 -0800)]
nandtest: seed random generator with time

If a seed is not provided via --seed, we use the default rand() values,
which produces the same sequence of values every run. Since this is
undesirable, we should choose a random seed via the current time().

Note that this patch moves the srand() until after all the initial
options processing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agonandtest: use seed argument
Jan Weitzel [Thu, 24 Nov 2011 10:57:34 +0000 (11:57 +0100)]
nandtest: use seed argument

if a seed is provided it is actually not used. First call is
"seed = rand()" killing the given seed.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Tested-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agonandtest: set oldstats.failed
Jan Weitzel [Thu, 24 Nov 2011 10:57:21 +0000 (11:57 +0100)]
nandtest: set oldstats.failed

if new ecc failed occures oldstats.corrected is updated not oldstats.failed

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoMakefile: separate man page install and compression steps
Mike Frysinger [Sat, 19 Nov 2011 21:02:03 +0000 (16:02 -0500)]
Makefile: separate man page install and compression steps

If the system doesn't have gzip installed, we should still be able
to install the man pages.  So install the file in one step, and then
compress it in another (and ignore failures from that).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoMakefile: fix install target with out-of-tree builds
Mike Frysinger [Sat, 19 Nov 2011 21:00:07 +0000 (16:00 -0500)]
Makefile: fix install target with out-of-tree builds

The install target always looks for the compiled binaries in the working
directory which breaks when doing something like `make CHOST=... install`.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years ago1.4.8 release v1.4.8
Artem Bityutskiy [Sat, 19 Nov 2011 20:38:50 +0000 (22:38 +0200)]
1.4.8 release

Unfortunately I forgot to update the version in Makefile and tagged v1.4.7.
To fix this, I could not invent anything better than cut a new release 1.4.8.

Sorry for this :-(

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoMerge branch 'brian' v1.4.7
Artem Bityutskiy [Fri, 18 Nov 2011 21:53:11 +0000 (23:53 +0200)]
Merge branch 'brian'

13 years agomtdinfo: provide info when used without arguments
Brian Norris [Wed, 16 Nov 2011 20:03:57 +0000 (12:03 -0800)]
mtdinfo: provide info when used without arguments

If the user specifies neither a MTD argument nor the `-a' flag, we print
a cryptic message; i.e.,

    # mtdinfo
    libmtd: error!: cannot get information about "(null)"
            error 14 (Bad address)
    mtdinfo: error!: cannot get information about MTD device "(null)"
             error 14 (Bad address)

This is a regression; previously, mtdinfo would give some short info
about number of devices, etc. when used without arguments. To fix this,
we revert commit d53c03b0989f8354a7e4dbb947a150fc7fe3f6d1 and call
print_general_info() when no device is specified.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agomtd-utils: add jffs2reader to .gitignore
Brian Norris [Wed, 16 Nov 2011 20:03:56 +0000 (12:03 -0800)]
mtd-utils: add jffs2reader to .gitignore

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agotests: checkfs: remove unused code
Andy Shevchenko [Mon, 10 Oct 2011 08:40:43 +0000 (11:40 +0300)]
tests: checkfs: remove unused code

There are two variables which are not used anymore. Thos patch removes useless
lines and suppresses gcc warnings.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomkfs_jffs2: fix typo for word unknown
Andy Shevchenko [Mon, 10 Oct 2011 08:40:42 +0000 (11:40 +0300)]
mkfs_jffs2: fix typo for word unknown

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: use major() and minor() helpers
Andy Shevchenko [Mon, 19 Sep 2011 11:25:24 +0000 (14:25 +0300)]
jffs2reader: use major() and minor() helpers

There are major() and minor() helpers in the standard library. We can use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: print ctime only by user's request
Andy Shevchenko [Mon, 19 Sep 2011 11:25:23 +0000 (14:25 +0300)]
jffs2reader: print ctime only by user's request

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: use const char * for path variables
Andy Shevchenko [Mon, 19 Sep 2011 11:25:22 +0000 (14:25 +0300)]
jffs2reader: use const char * for path variables

This patch brings const char * type for path variables. It allows to eliminate
compiler warning.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: get rid of linker error
Andy Shevchenko [Mon, 19 Sep 2011 11:25:21 +0000 (14:25 +0300)]
jffs2reader: get rid of linker error

There is a linker errors:
undefined reference to `target_endian'

This patch fixes the issue and turns on the jffs2reader build in the Makefile.

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agojffs2reader: introduce ADD_BYTES macro
Andy Shevchenko [Mon, 19 Sep 2011 11:25:20 +0000 (14:25 +0300)]
jffs2reader: introduce ADD_BYTES macro

This macro is dedicated to get rid of the compiler errors:
lvalue required as left operand of assignment

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
13 years agojffs2reader: eliminate compiler errors
Andy Shevchenko [Mon, 19 Sep 2011 11:25:19 +0000 (14:25 +0300)]
jffs2reader: eliminate compiler errors

There are many errors like "error: invalid operands to binary". This patch
converts the values to the proper types.

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
13 years agojffs2reader: update the header inclusion block
Andy Shevchenko [Mon, 19 Sep 2011 11:25:18 +0000 (14:25 +0300)]
jffs2reader: update the header inclusion block

Signed-off-by: Alexey Dokuchaev <danfe@nsu.ru>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agoubiformat: handle write errors correctly
Artem Bityutskiy [Sun, 11 Sep 2011 10:52:08 +0000 (13:52 +0300)]
ubiformat: handle write errors correctly

This issue was reported and analyzed by
Anton Olofsson <anol.martinsson@gmail.com>:

when ubiformat encounters a write error while flashing the UBI image (which may
come from a file of from stdout), it correctly marks the faulty eraseblock as
bad and skips it. However, it also incorrectly drops the data buffer which was
supposed to be written, and reads next block of data.

This patch fixes this issue - in case of a write error, we preserve the current
data and write it to the next eraseblock, instead of dropping it.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: use common.h "errmsg" functions
Brian Norris [Wed, 31 Aug 2011 20:00:39 +0000 (13:00 -0700)]
nandwrite: use common.h "errmsg" functions

Convert several forms of exit(), perror(), etc. to use common.h helper
functions.

Also, move one of our parameter checks inside the process_options()
function for consistency.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: re-implement `--autoplace' option
Brian Norris [Wed, 31 Aug 2011 20:00:38 +0000 (13:00 -0700)]
nandwrite: re-implement `--autoplace' option

The restructuring of mtd_write() has allowed us to use `--autoplace'
somewhat successfully; it is supported by the new ioctl(MEMWRITE) as
well as some legacy code utilizing the deprecated ioctl(MEMGETOOBSEL).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: kill `--raw' option
Brian Norris [Wed, 31 Aug 2011 20:00:37 +0000 (13:00 -0700)]
nandwrite: kill `--raw' option

The `--raw' option has lost all usefulness as it overlapped with several
other OOB modes. I cannot even figure out what it was actually intended
to do, but I'm sure its functionality fits somewhere in the
MTD_OPS_{AUTO_OOB,PLACE_OOB,RAW} options, which are mostly implemented
in libmtd's mtd_write().

I don't think users need a warning for this one, unless someone can tell
me what it actually was supposed to have done in the first place.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdutils: move OOB auto-layout into libmtd's mtd_write
Brian Norris [Wed, 31 Aug 2011 20:00:36 +0000 (13:00 -0700)]
mtdutils: move OOB auto-layout into libmtd's mtd_write

With the addition of the the new ioctl(MEMWRITE), we can use the
kernel's internal OOB autoplacement option. It's a cleaner interface and
avoids too much duplication of coding effort.

This patch moves any legacy code (using MEMGETOOBSEL) into a legacy
function in libmtd.c. It's not exactly a "pre-2.6.30" feature, so I'm not
moving it to libmtd_legacy.c.

Now, autoplacement features are only activated if we call mtd_write with
mode == MTD_OPS_AUTO_OOB. This should fix some discrepancies for
nandwrite, where we weren't handling OOB consistently (i.e., we had
different functionality when the kernel did/didn't support MEMWRITE).
But that also means that we now default to using MTD_OPS_PLACE_OOB
instead of AUTO layout. To re-enable autoplacement, we can re-implement
the `--autoplace' option that had previously rotted.

This patch also cleans up a need for an extra OOB buffer in nandwrite.

This has been tested a little in nandsim as well as on SLC NAND flash.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: merge `mtd_write_oob' and `mtd_write' calls
Brian Norris [Wed, 31 Aug 2011 20:00:35 +0000 (13:00 -0700)]
nandwrite: merge `mtd_write_oob' and `mtd_write' calls

Now that `mtd_write' can write to both OOB and data regions, we need to
perform our `mtd_write' call only once.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agolibmtd: support MEMWRITE ioctl
Brian Norris [Wed, 31 Aug 2011 20:00:34 +0000 (13:00 -0700)]
libmtd: support MEMWRITE ioctl

`mtd_write()' now will first attempt to use MEMWRITE. Then, if that
doesn't exist, it will attempt to fall back to old methods for writing
OOB and/or page data.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agolibmtd: modify `mtd_write' to cover OOB writes
Brian Norris [Wed, 31 Aug 2011 20:00:33 +0000 (13:00 -0700)]
libmtd: modify `mtd_write' to cover OOB writes

To support the MEMWRITE ioctl, we will need a different sort of libmtd
interface for writing to flash. We will expand mtd_write to include more
functionality; for now, we just change the function definition and
description as we begin to add the actual functionality.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd-utils: update mtd-abi.h
Brian Norris [Fri, 9 Sep 2011 17:11:49 +0000 (10:11 -0700)]
mtd-utils: update mtd-abi.h

Kernel ABI header added a new ioctl, killed an old one, and exposed OOB
modes to user-space. Plus, it added a lot of documentation.

We have some trivial name changes for some MTD mode constants as well.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: consolidate buffer usage
Brian Norris [Wed, 31 Aug 2011 20:00:32 +0000 (13:00 -0700)]
nandwrite: consolidate buffer usage

Instead of using two different output buffers for OOB data, let's just
use the same one for all output. This adds an extra memcpy, but it
simplifies some future work, so it's worth it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: trivial variable move
Brian Norris [Wed, 31 Aug 2011 20:00:30 +0000 (13:00 -0700)]
nandwrite: trivial variable move

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandtest: print number of bits corrected during test
Ben Gardiner [Tue, 9 Aug 2011 20:57:28 +0000 (16:57 -0400)]
nandtest: print number of bits corrected during test

The nandtest program monitors the corrected ecc stat to determine if an
ECC correction has taken place during the last write-read. If so, it
prints "ECC corrected".

The mtd subsytem will store the number of bits corrected in the corrected
ecc stat so update the nandtest output to print also the number of bits
corrected when performing the test.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonanddump: kill usages of MEMSETOOBSEL ioctl
Brian Norris [Fri, 19 Aug 2011 17:07:56 +0000 (10:07 -0700)]
nanddump: kill usages of MEMSETOOBSEL ioctl

The ioctl MEMSETOOBSEL hasn't existed for a long time. Using it as a
backup to MTDFILEMODE is pointless, so just remove every time it is
used.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: refactor "old_oobinfo" code
Brian Norris [Fri, 19 Aug 2011 17:07:55 +0000 (10:07 -0700)]
nandwrite: refactor "old_oobinfo" code

Move variable within conditional and remove duplicated code.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: cleanup "oobinfochanged" leftovers
Brian Norris [Fri, 19 Aug 2011 17:07:54 +0000 (10:07 -0700)]
nandwrite: cleanup "oobinfochanged" leftovers

We don't really use oobinfochanged anymore, since all the calls to the
MEMSETOOBSEL ioctls are gone. The remaining usage of it is superfluous
now, as the only case where it is changed is under the "noecc" condition
and the only case where it is tested is under the "!noecc" condition.

We also no longer need the "restoreoob" label and can instead simply
close everything done with the single remaining label, "closeall". Note
that `close(-1)' is legal, although useless.

Finally, we move `old_oobinfo' into the only block of code in which it's
used now.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: kill -j, -y, and -f options
Brian Norris [Fri, 19 Aug 2011 17:07:53 +0000 (10:07 -0700)]
nandwrite: kill -j, -y, and -f options

The legacy -j (--jffs2) and -y (--yaffs) options haven't been
operational for a long time, since MEMSETOOBSEL was killed. I don't
think anybody will miss these options (correct me if I'm wrong). They
can be replaced by proper usage of MTD_OOB_AUTO modes.

The -f (--forcelegacy) option went hand in hand with -j and -y. Now that
-j and -y are gone, there's no use for -f. Kill it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: kill more MEMSETOOBSEL
Brian Norris [Fri, 19 Aug 2011 17:07:52 +0000 (10:07 -0700)]
nandwrite: kill more MEMSETOOBSEL

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: remove `autoplace' features
Brian Norris [Fri, 19 Aug 2011 17:07:51 +0000 (10:07 -0700)]
nandwrite: remove `autoplace' features

The `autoplace' option was meant to force an MTD_OOB_AUTO layout while
writing to flash. This option has not been properly supported for a very
long time, as the necessary ioctl, MEMSETOOBSEL, has been removed.
Apparently nobody uses this option. Kill it.

Other code depends on the availability of the `old_oobinfo' data, so we
move some code within a block that handles autoplacement if it's
*already* enabled. This, however, is inconsistent and should be cleaned
up shortly.

Note: this option may be re-implemented in the near future with the
addition of a new ioctl that allows on-the-fly chaning of MTD OOB modes.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agonandwrite: remove C99 comment style
Brian Norris [Fri, 19 Aug 2011 17:07:50 +0000 (10:07 -0700)]
nandwrite: remove C99 comment style

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd-utils: use __func__ instead of __FUNCTION__
Brian Norris [Fri, 19 Aug 2011 17:07:49 +0000 (10:07 -0700)]
mtd-utils: use __func__ instead of __FUNCTION__

__func__ is more portable

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd_debug: replace #defines with enum
Brian Norris [Fri, 19 Aug 2011 17:07:48 +0000 (10:07 -0700)]
mtd_debug: replace #defines with enum

enum provides a cleaner mechanism that creating single-purpose `#define`s.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd_debug: fixup style
Brian Norris [Fri, 19 Aug 2011 17:07:47 +0000 (10:07 -0700)]
mtd_debug: fixup style

Remove extraneous spaces.
Put braces on same line as "if", "for", "switch", etc. statements.
No parentheses around return values.
Use "errmsg_die" from common.h.
Replace "exit (1)" with "exit(EXIT_FAILURE)".

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomkfs.ubifs/ubinize: increase PEB size limit to 2MiB
Viktar Palstsiuk [Sat, 20 Aug 2011 04:07:37 +0000 (07:07 +0300)]
mkfs.ubifs/ubinize: increase PEB size limit to 2MiB

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years agoBumb version number
Artem Bityutskiy [Sat, 20 Aug 2011 03:47:50 +0000 (06:47 +0300)]
Bumb version number

We released mtd-utils 1.4.6 as a bug-fix release. Bump the version number
in Makefile.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
13 years ago nandwrite: invalid erase after page write failure
Fryar, Jeff [Thu, 11 Aug 2011 15:30:33 +0000 (16:30 +0100)]
 nandwrite: invalid erase after page write failure

mtd-utils nandwrite.c: After a page write failure, the calculation
of the block number to erase is incorrect.  The erase block size is
being passed as the erase block number in the call to mtd_erase().

Signed-off-by: Jeff Fryar <jeff.fryar@hp.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: consolidate help as display_help()
Brian Norris [Mon, 15 Aug 2011 20:17:05 +0000 (13:17 -0700)]
mtdinfo: consolidate help as display_help()

The help message for mtdinfo is unnecessarily disjointed. It is split
into three strings which reuse the PROGRAM_NAME string inefficiently and
don't have a consistent style.

This fixup should provide a cleaner look with aligned columns and
easier-to-read source code.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: fixup "example usage" help section
Brian Norris [Tue, 9 Aug 2011 21:36:45 +0000 (14:36 -0700)]
mtdinfo: fixup "example usage" help section

Line up columns better so that everything is more readable.

Remove "Example 1" since `mtdinfo' does not print information when not
given any arguments.

Remove "...UBI layout information" from description of Example 4, since
Example 4 (now 3) doesn't include the `-u' flag.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: restructure help message
Brian Norris [Tue, 9 Aug 2011 21:36:44 +0000 (14:36 -0700)]
mtdinfo: restructure help message

We weren't very consistent in how we listed our options in the mtdinfo
help string (listing short options, long options, or both). Plus, not all
options are inter-operable, so we should distinguish this somewhat.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: refactor code to remove "args.all" dependency
Brian Norris [Tue, 9 Aug 2011 21:36:43 +0000 (14:36 -0700)]
mtdinfo: refactor code to remove "args.all" dependency

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtdinfo: don't open NULL pointer when getting region_info with `-a'
Brian Norris [Tue, 9 Aug 2011 21:36:42 +0000 (14:36 -0700)]
mtdinfo: don't open NULL pointer when getting region_info with `-a'

This "fixes" a regression found in:
  commit 266061ebd5d72391f0a0e831b018e8fc7fea68a1
  mtdinfo: add regioninfo/eraseblock map display

On certain flash (NOR flash that have eraseblock region info),
`mtdinfo -a' tries to open the MTD node file, for use with the ioctl
MEMGETREGIONINFO; however, we didn't supply a device node path to
`mtdinfo -a', so it's using NULL, resulting in errors like:

  mtdinfo: error!: couldn't open MTD dev: (null)
           error 14 (Bad address)

For now, we can just skip dumping region_info with the `-a' flag. If we
find a better way to do this (e.g., export via sysfs, find device nodes
via automatic routines, etc.), then we can kill the workaround and this
FIXME should be removed.

The regression was first reported at:

  http://lists.infradead.org/pipermail/linux-mtd/2011-July/037232.html

The result of recent changes is that we cannot get region_info for devices
via the `--all' option. We add a note in the help message warning that
mtdinfo may find more info when given a device patch, e.g., /dev/mtdX.

Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agoMakefile: show nice message when checking version.h
Brian Norris [Thu, 7 Jul 2011 20:44:27 +0000 (13:44 -0700)]
Makefile: show nice message when checking version.h

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agoMakefile: fix "make clean" for cross-compile
Brian Norris [Thu, 7 Jul 2011 20:44:26 +0000 (13:44 -0700)]
Makefile: fix "make clean" for cross-compile

When cross-compiling (make CROSS=mipsel-linux-), I get this error:

rm -rf /home/norris/git/mtd-utils/mipsel-linux
find /home/norris/git/mtd-utils/mipsel-linux/ -xdev \
'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
-exec rm -f {} +
find: `/home/norris/git/mtd-utils/mipsel-linux/': No such file or directory
make: *** [clean] Error 1

Now, for cross-compiling, we've already deleted the $(BUILDDIR), so we
should check this before cleaning individual objects with "find."

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agoMakefile: fix "version.h" build for cross-compiling
Brian Norris [Thu, 7 Jul 2011 22:16:17 +0000 (15:16 -0700)]
Makefile: fix "version.h" build for cross-compiling

When using "make CROSS=mipsel-linux-", I get the following errors:

/bin/sh: /home/norris/git/mtd-utils/mipsel-linux/include/version.h.tmp: No such file or directory
make: *** [/home/norris/git/mtd-utils/mipsel-linux/include/version.h.tmp] Error 1

Fix (suggested by Mike Frysinger): create the directory if it doesn't
exist. Also, $(CC) needs to be able to find the generated header in
$(BUILDDIR)/include.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
14 years agomkfs.ubifs: fix a gcc warning
Artem Bityutskiy [Mon, 4 Jul 2011 06:53:04 +0000 (09:53 +0300)]
mkfs.ubifs: fix a gcc warning

This patch "fixes" the following gcc warning:

mkfs.ubifs/mkfs.ubifs.c: In function ‘main’:
mkfs.ubifs/ubifs.h:420:2: warning: ‘child_cnt’ may be used uninitialized in this function [-Wuninitialized]
mkfs.ubifs/mkfs.ubifs.c:1735:6: note: ‘child_cnt’ was declared here

by initializing the ‘child_cnt’ to zero.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomkfs.ubifs: remove root inode squash feature
Artem Bityutskiy [Mon, 4 Jul 2011 06:48:37 +0000 (09:48 +0300)]
mkfs.ubifs: remove root inode squash feature

Remove the -squash-rino-perm mkfs.ubifs option as this was planned. Remove
the corresponding record from the feature-removal-schedule.txt file.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agoflash_erase: fix incorrect help message
Brian Norris [Wed, 29 Jun 2011 18:14:18 +0000 (11:14 -0700)]
flash_erase: fix incorrect help message

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
14 years agomtdinfo: remove -m leftovers
Artem Bityutskiy [Wed, 29 Jun 2011 16:09:29 +0000 (09:09 -0700)]
mtdinfo: remove -m leftovers

We have removed the -m option, but did not remove args.mtdn which represents
the -m parameters. Kill args.mtdn as well.

Tweaked by Brian Norris.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 years agomtdinfo: kill -m option
Brian Norris [Mon, 27 Jun 2011 18:27:26 +0000 (11:27 -0700)]
mtdinfo: kill -m option

According to feature-removal-schedule, we shouldn't use `-m', since
it relies on a specific device-naming pattern.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>