Age | Commit message (Collapse) | Author |
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
|
|
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>
|
|
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>
|
|
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>
|
|
More utilities now use the common VERSION system.
For utils that printed a very simple message, we use the new
common_print_version() "function."
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
|
|
The ubi-utils/src/ subdir is tossed as it just complicates things for no
real gain. The dictionary.h header is relocated to the ubi-utils/include/
since other headers in there need it.
The top level clean is replaced with a `find -delete` on objects, so it
might prune more than necessary, but many projects now do this sort of
thing and no one complained there.
A "mkdep" helper generates the actual rule, and the variables are used
with "foreach" to expand these automatically.
The tests subdir is updated only to reflect the ubi-utils source move.
Otherwise, it is left untouched as making that non-recursive isn't really
worth the effort.
While we're gutting things, also through in kbuild style output while
building to make things more legible.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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 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>
|
|
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>
|
|
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>
|
|
Instead of using strtol and Co directly, use our share simple_strtoX()
helpers. This is just a cleanup.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The utilities are unmaintained for long time, and many of them
do not even work, just compile, and no on complains about this.
This suggests they are unused and we can now safely kill them.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Shrink the data size a little by declaring addresses of constant strings
instead of pointers to it.
Also slip in static & const on long_options missing them.
Signed-off-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>
|
|
Considering this is marked as "old" which is synonymous with "dead",
having the dir cause build failures because of warnings makes no
sense. So drop the -Werror usage.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Reformat the help text of ubiattach and ubidetach to display nicely on
80 column terminals, also fix a couple of bits that did not make sense.
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Modify ubiattach and ubidetach to default to /dev/ubi_ctrl if not supplied
rather than requiring the user to type it in every time.
Also bump version from 1.0 to 1.1
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Because of namespace collisions mkfs.ubifs uses crc32() implementation from
/lib/libz.so.1, which generates incompatible CRC and later on the kernel reports
many CRC errors.
Fix this by re-naming mtd-utils' crc32 function to mtd_crc32.
Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch is base on Kevin Cernekee's patch posted to the MTD mailing
list. It adds MEMERASE64 support to the 'mtd_erase()' call. Now it
first tries to use MEMERASE64, and if that is not supported, falls
back to the old MEMERASE ioctl.
This patch also introduces an 'offs64_ioctl' flag to the libmtd
descriptor. However, we cannot initialize it in 'libmtd_open()',
because we need an MTD device node, which we do not have in
'libmtd_open()'. Thus, we firs mark this flag as "uninitialized",
and at the first invocation of 'mtd_erase()' we initialize it.
This also means that we have to pass the limbtd descriptor to
'mtd_erase()', to save the flag value. This, in turn, requires
tweaking 'mtd_erase()' users.
This is not very nice, but good enough so far.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Now include/common.h contains things that really everyone can use.
And all the stuff specific to ubi-utils is in ubi-utils/include/ubiutils-common.h
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Source files for libmtd, crc32, and fec are scattered throughout the
tree. Move them to a central location so they can be built into a
common "libmtd.a" library used by all mtd-utils programs.
This patch only renames/deletes files and does not change the content.
Also modify the build system and source code so that libmtd.a can be built
from a "common" location (lib/). Statically link all utilities at the top
level with libmtd.a . Minor changes to mkfs.ubifs to allow using the common
crc32 implementation.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
... to make it clear that this is EC header, not VID header.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Consistently use 'mtd_dev_node' to name variables consining
MTD device node path.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Let's consistently use 'mtd_num' name for MTD device number. At the
moment some code uses 'mtd_num', other 'dev_num'. Harmonize that.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
ubi-tests need it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
To be consistent with other ubi libraries, move header comments
to the .h file.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Stop creating 128KiB and larger arrays on stack - allocate RAM
using malloc() instead.
This patch also teaches libubigen to always set errno.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Add another helper interface which can be used to write an image
to an mtd device.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Add an 'mtd_num' field to the UBI device information structure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Remove the 'dev_major' and 'dev_minor' fields from the volume
information structure, because these fields should be provided
by the device information structure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Now there is a new option '-p' (or '--dev-path') that can be used to pass path
to a MTD device node.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
struct ubi_attach_request now has additional field 'dev' that can contain path
to the MTD device node in the filesystem. Also there are two new functions that
are able to handle path to the MTD device node:
ubi_attach() - attach MTD device by number or by path
ubi_detach() - detach MTD device by path
ubi_attach() works like ubi_attach_mtd() when it is passed empty req->dev,
otherwise it looks up correct MTD device number based on the given device node
path.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Jon Ringle <jon@ringle.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We fixed the sequence numbers bug, which is quite serious.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This commit fixes a stupid an nasty bug. When we flash an UBI image,
we do not change its sequence numbers. But when we format the rest
of the PEBs (beyond the flashed image), we use a random (or specified
via cmdline) sequence number. As a result, we have a broken flash
format and UBI refuses it, because half of it has one sequence number,
another half has a different one.
What we have to do instead, we have to substitute image's sequence
number with ours.
Reported-by: Jeff Angielski <jeff@theptrgroup.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tested-by: Jeff Angielski <jeff@theptrgroup.com>
|
|
For some reasons sequence number was set to 0 in some case, which
is wrong.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The --erase-counter option did not work and this was reproted by
Darwin Rambo <drambo@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|