aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
AgeCommit message (Collapse)Author
2011-11-18Merge branch 'brian'v1.4.7Artem Bityutskiy
2011-11-18mtdinfo: provide info when used without argumentsBrian Norris
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>
2011-09-19ubiformat: handle write errors correctlyArtem Bityutskiy
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>
2011-09-11libmtd: modify `mtd_write' to cover OOB writesBrian Norris
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>
2011-08-20mkfs.ubifs/ubinize: increase PEB size limit to 2MiBViktar Palstsiuk
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
2011-08-16mtdinfo: consolidate help as display_help()Brian Norris
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>
2011-08-16mtdinfo: fixup "example usage" help sectionBrian Norris
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>
2011-08-16mtdinfo: restructure help messageBrian Norris
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>
2011-08-16mtdinfo: refactor code to remove "args.all" dependencyBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-08-16mtdinfo: don't open NULL pointer when getting region_info with `-a'Brian Norris
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>
2011-06-30mtdinfo: remove -m leftoversArtem Bityutskiy
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>
2011-06-29mtdinfo: kill -m optionBrian Norris
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>
2011-06-29mtd-utils: switch more utils to unified versioningBrian Norris
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>
2011-06-29mtd-utils: remove whitespace at end of linesBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-06-27rewrite build system to avoid recursionMike Frysinger
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>
2011-06-25mtd-utils: bump nanddump, mtdinfo version numbersBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-06-09mtdinfo: add regioninfo/eraseblock map displayMike Frysinger
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>
2011-06-09mtdinfo: remove now unused ubigen infoMike Frysinger
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>
2011-06-08mtdinfo: separate out ubi information printingArtem Bityutskiy
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>
2011-06-08ubi-utils: send help/version info to stdoutMike Frysinger
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>
2011-06-07mtdinfo: deprecate the -m optionArtem Bityutskiy
... because mtd device node name do not have to follow the "/dev/mtd%d" pattern. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-31ubi-utils: ubimkvol: fix parameters parsing regressionArtem Bityutskiy
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>
2011-04-09mtd-utils: switch ubi and ubifs tools to use common strtoX funcsArtem Bityutskiy
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>
2010-09-28ubi-utils: remove old ubi-utilsArtem Bityutskiy
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>
2010-09-27ubi-utils: tweak const strings declsMike Frysinger
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>
2010-09-27mtd-utils: standardize PROGRAM_NAMEMike Frysinger
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>
2010-09-12ubi-utils: drop -Werror in old utilsMike Frysinger
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>
2010-09-02ubi-utils: reformat help text to fit in 80 columnsJon Povey
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>
2010-09-02ubi-utils: provide default value for /dev/ubi_ctrlJon Povey
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>
2010-09-01rename crc32 to mtd_crc32Artem Bityutskiy
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>
2010-07-26libmtd: support MEMERASE64Artem Bityutskiy
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>
2010-07-17libs: remove ubiutils-specific stuff from common.hArtem Bityutskiy
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>
2010-07-13mtd-utils: move libmtd source files to lib/ subdirectoryKevin Cernekee
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>
2010-06-16libscan: rename hdr to echArtem Bityutskiy
... to make it clear that this is EC header, not VID header. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-06-15ubi-utils: harmonize mtd device node variablesArtem Bityutskiy
Consistently use 'mtd_dev_node' to name variables consining MTD device node path. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-06-15ubi-utils: harmonize libmtd interface a bitArtem Bityutskiy
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>
2010-06-14libubigen: make init_vid_hdr externally visibleArtem Bityutskiy
ubi-tests need it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-06-14libubigen: move header commentsArtem Bityutskiy
To be consistent with other ubi libraries, move header comments to the .h file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-06-14libubigen: do not create huge arrays on stackArtem Bityutskiy
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>
2010-06-14libmtd: add mtd_write_imgArtem Bityutskiy
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>
2010-06-14libubi: provide mtd number in UBI device informationArtem Bityutskiy
Add an 'mtd_num' field to the UBI device information structure. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-06-14libubi: remove few fields from volume infoArtem Bityutskiy
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>
2010-04-08ubiattach/ubidetach: add support to attach/detach by pathMika Westerberg
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>
2010-04-08libubi: add support to attach/detach by MTD device pathMika Westerberg
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>
2010-04-08ubinfo: document the new -N optionArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-04-08ubinfo: add -N option to get info by name of ubi volumeJon Ringle
Signed-off-by: Jon Ringle <jon@ringle.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-01-15ubiformat: boost version to 1.5v1.3.1Artem Bityutskiy
We fixed the sequence numbers bug, which is quite serious. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-01-15ubiformat: be consistent with sequence numbersArtem Bityutskiy
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>
2010-01-15ubiformat: always initialize seq numberArtem Bityutskiy
For some reasons sequence number was set to 0 in some case, which is wrong. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-12-09ubiformat: fix error messagev1.3.0Artem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>