aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-12-01nandtest: use seed argumentJan Weitzel
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>
2011-12-01nandtest: set oldstats.failedJan Weitzel
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>
2011-11-22Makefile: separate man page install and compression stepsMike Frysinger
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>
2011-11-22Makefile: fix install target with out-of-tree buildsMike Frysinger
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>
2011-11-191.4.8 releasev1.4.8Artem Bityutskiy
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>
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-11-18mtd-utils: add jffs2reader to .gitignoreBrian 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-10-14tests: checkfs: remove unused codeAndy Shevchenko
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>
2011-10-14mkfs_jffs2: fix typo for word unknownAndy Shevchenko
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>
2011-09-21jffs2reader: use major() and minor() helpersAndy Shevchenko
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>
2011-09-21jffs2reader: print ctime only by user's requestAndy Shevchenko
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>
2011-09-21jffs2reader: use const char * for path variablesAndy Shevchenko
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>
2011-09-21jffs2reader: get rid of linker errorAndy Shevchenko
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>
2011-09-21jffs2reader: introduce ADD_BYTES macroAndy Shevchenko
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>
2011-09-21jffs2reader: eliminate compiler errorsAndy Shevchenko
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>
2011-09-21jffs2reader: update the header inclusion blockAndy Shevchenko
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>
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-11nandwrite: use common.h "errmsg" functionsBrian Norris
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>
2011-09-11nandwrite: re-implement `--autoplace' optionBrian Norris
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>
2011-09-11nandwrite: kill `--raw' optionBrian Norris
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>
2011-09-11mtdutils: move OOB auto-layout into libmtd's mtd_writeBrian Norris
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>
2011-09-11nandwrite: merge `mtd_write_oob' and `mtd_write' callsBrian Norris
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>
2011-09-11libmtd: support MEMWRITE ioctlBrian Norris
`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>
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-09-11mtd-utils: update mtd-abi.hBrian Norris
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>
2011-09-11nandwrite: consolidate buffer usageBrian Norris
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>
2011-09-11nandwrite: trivial variable moveBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-08-25nandtest: print number of bits corrected during testBen Gardiner
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>
2011-08-23nanddump: kill usages of MEMSETOOBSEL ioctlBrian Norris
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>
2011-08-23nandwrite: refactor "old_oobinfo" codeBrian Norris
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>
2011-08-23nandwrite: cleanup "oobinfochanged" leftoversBrian Norris
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>
2011-08-23nandwrite: kill -j, -y, and -f optionsBrian Norris
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>
2011-08-23nandwrite: kill more MEMSETOOBSELBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-08-23nandwrite: remove `autoplace' featuresBrian Norris
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>
2011-08-23nandwrite: remove C99 comment styleBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-08-23mtd-utils: use __func__ instead of __FUNCTION__Brian Norris
__func__ is more portable Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-08-23mtd_debug: replace #defines with enumBrian Norris
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>
2011-08-23mtd_debug: fixup styleBrian Norris
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>
2011-08-20mkfs.ubifs/ubinize: increase PEB size limit to 2MiBViktar Palstsiuk
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
2011-08-20Bumb version numberArtem Bityutskiy
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>
2011-08-19 nandwrite: invalid erase after page write failureFryar, Jeff
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>
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-07-20Makefile: show nice message when checking version.hBrian 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-07-20Makefile: fix "make clean" for cross-compileBrian Norris
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>
2011-07-20Makefile: fix "version.h" build for cross-compilingBrian Norris
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>