aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2010-10-25mtd-utils: nanddump: add 64-bit support, utilize libmtdBrian Norris
Adds support for 64-bit offsets (i.e., devices larger than 4GB). Utilizes the "unsigned long long" data type as the standard type for 64-bit offsets throughout. Reformats a few printf statements to avoid casting and to properly handle "long long." Calls to ioctls are mostly replaced by libmtd interfaces (which should choose the proper ioctls for us); however, a few remain and probably should be handled with more robust interfaces, as some of these ioctls are considered "legacy." Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-25mtd-utils: nanddump/nandwrite: style, signed-ness, printing fixupsBrian Norris
There were some signed/unsigned integer comparisons. Their types were changed for safety. Also, "strtol" was improperly used for unsigned data types. Nanddump's pretty print options needed a slight reformat to prepare for printing offsets that are more than 32 bits (8 hex characters) wide. This prevents overlap of output and ensures that at least one space is printed between hex and ascii printouts. Perhaps this could use some better alignment in the future. Other fixes: * Corrected several simple spacing issues * Changed indentation of some global variable declarations in order to prepare for the next patch, which makes those declarations longer * Used macro for PRETTY_ROW_SIZE instead of constant 16 * Reformatted, edited a multi-line comment * Removed some unnecessary casts Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2010-10-18nanddump: warn when the start address is not page alignedBaruch Siach
nanddump should be consistent with nandwrite, which does not accept non page aligned start addresses. Thus, non page aligned dumps are useless. To ease migration only warn for now. Add the plan of making this an error to feature-removal-schedule.txt. Tweaked by Artem. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-17mtd-utils: nanddump/nandwrite: Style fixupsBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-17mtd-utils: flash_erase: Fix output of offsetsBrian Norris
Need to use unsigned arithmetic and a 64-bit cast in order to calculate and output the correct offset for eraseblocks at large offsets. Signed integer arithmetic does not produce the correct result "uint64_t" result, so for offsets over 2GB we get messages like: Erasing 512 Kibyte @ ffffffff83180000 -- 4308642136 % complete. Note that this error was not affecting proper erasure; it just produced incorrect status messages. Also, we should not add an extra eraseblock for the final status message; this gives misleading output when, for example, the following statement is executed: $ flash_erase /dev/mtd0 0 1 Erasing 512 Kibyte @ 80000 -- 100 % complete We aren't erasing at offset 0x80000; it should display offset 0. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-17mtd-utils: nandwrite: Large page+oob supportBrian Norris
Dynamic allocation of the oob buffer provides the necessary support for removing the oob size check. Now, new unknown OOB sizes can be handled correctly (for example, 8KB page + 448B OOB). Included common.h for the use of xmalloc. Memory freeing should occur on "restoreoob" as well as on "closeall." [Conflicts resolved by Artem] Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-17mtd-utils: nanddump: Dynamic buffer, increase pagesize/oobsizeBrian Norris
The buffers used for dumping page and OOB data needed dynamic allocation to help eliminate burdens for updating (i.e., every time there's a new OOB size we don't have to increase the sizes). Also, there is no need to check flash chips for "standard sizes." With recent changes to the printing codebase, we should be able to handle arbitrary sizes with no problem. More exit operations are now necessary on program failure, so "goto closeall" is used more liberally. Also, common.h is included for the use of xmalloc. [conflicts fixed by Artem] Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-16nanddump: always check the first erase blockBaruch Siach
Check the first block even when start_addr is not eraseblock aligned. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-16Add --squash-rino-perm removal planArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-12nanddump: fix initialization of bad blocks oob data bufferBaruch Siach
When dumping oob data of a bad block, initialize oobbuf with 0xff, instead of readbuf. This avoids bogus oob data on output. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-04jffs2reader: convert to common.h helpersMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-02libmtd: make malloc failures fatalMike Frysinger
This converts libmtd to the common xalloc helpers and in doing so, makes memory allocation failures fatal rather than returning an error to the caller. I think this is acceptable behavior. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-02sumtool/libfec: convert "()" to "(void)" in func defsMike Frysinger
Since these functions take no parameters, declare them as such. The subtle difference here is that gcc allows (without warning) people to accidentally call funcs declared with "()" with arguments. Using void makes sure that gcc will reject such typos at compile time. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-02sumtool: convert to common.h helpersMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-02mkfs.jffs2: convert to xalloc.h helpersMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01libmtd: unify some error messagesMike Frysinger
By using the same error message string, we only need one copy of it in memory at runtime. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: xalloc: simplify/unify error messagesMike Frysinger
I'm not sure that if we actually are out of memory that declaring the failing allocation size is useful in the output. So use the same simple string in every error message to cut down on size (there will only be one copy of this at runtime). Size is a much more common concern than handling OOM issues which most likely aren't the fault of mtd-utils in the first place. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: dont redefine MIN()Mike Frysinger
Some C library headers will define MIN(), so add an #ifndef check. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mkfs.jffs2: convert to common.h helpersMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01libmtd: fix "fount" typoMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: sys_errmsg: optimize indentationMike Frysinger
Rather than do a for loop and output 1 space at a time, let the printf code take care of indenting the string based on the constant length. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: introduce xzalloc() helperMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-10-01mtd-utils: enable garbage collection of unused function/data sectionsMike Frysinger
On my default build, this cumulatively shaves off ~100KiB of unused code and data from the mtd-utils programs. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-30mkfs.jffs2: use new xasprintf() helperMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-30mtd-utils: add xasprintf() helperMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-30mtd-utils: new memory wrappersMike Frysinger
The mkfs.jffs2 program has local wrappers for memory related functions that are useful beyond mkfs.jffs2, so break them out into a common header. Signed-off-by: Mike Frysinger <vapier@gentoo.org> 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-28mtd-utils: Use $(CURDIR) in place of $(PWD)Kevin Cernekee
$(PWD) comes from the shell and may cause unexpected side effects when using "make -C". $(CURDIR) is defined internally by GNU make. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-27mtd-utils: unify flash_erase and flash_eraseallMike Frysinger
These have overlapping functionality, and while flash_eraseall supports newer 64bit ioctls, flash_erase does not. So rather than graft support onto flash_erase, merge the functionality of two into flash_erase so we only have to support one util from now on. A simple wrapper is provided to ease old flash_eraseall users into the new combined flash_erase util. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-27mtd-utils: new strtoX helpersMike Frysinger
Simply usage of converting strings to numbers by adding some wrappers around the standard strtoX functions. These helpers simplify the api of these functions a bit by providing an optional "error" pointer and automatic error message. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-27mtd-utils: common.h: clean up PROGRAM_NAME usageMike Frysinger
Make PROGRAM_NAME required in order to include common.h so we can rely on it existing. Further, stop embedding PROGRAM_NAME in every error message so that we can save string space with it being declare only once. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-27recv_image: fix __USE_GNU hackMike Frysinger
The __USE_GNU define is an internal define that source code should never be touching. So switch it to the proper exported _BSD_SOURCE define. Signed-off-by: Mike Frysinger <vapier@gentoo.org> 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-27compr_rtime: fix unused warningMike Frysinger
The rtime logic causes gcc to emit an unused warning about srclen, so mark it with an unused attribute to shut it up. 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-25nandwrite: Remove redundant 'autoplace' checkShinya Kuribayashi
We're already in 'if (autoplace) { }' block at ths moment. Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-25mtd-utils: new bareverbose() helperMike Frysinger
Add a new helper that lets people do simple verbose output without any implicit strings added around it. Good for progress bars and such. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-25libmtd: add lock/unlock helpersMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24mkfs.ubifs: use common ARRAY_SIZEMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24mtd-utils: punt duplicate normsg_cont defineMike Frysinger
Looks like someone copied & pasted it twice by accident. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24mtd-utils: convert to common.h/minMike Frysinger
Kill off duplicated min() defines and convert to the common.h one. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24libmtd: unify erase block argument checkingMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24nandwrite: add --skipbad to write bad blocksMike Frysinger
Sometimes dumping bad blocks is useful, like when the block isn't actually bad but the OOB layout isn't what the kernel is expecting or is otherwise screwed up. The --skipbad option allows just that. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-24mkfs.ubifs: Fix --squash-rino-perm / --nosquash-rino-permKevin Cernekee
This addresses a couple of issues: 1) Code was only allowing these options if --root was NOT specified (the opposite of the documented usage) 2) -q / -Q short options did not work 3) Spacing fixes in the error/warning strings Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-23libfec: fix up pointer warnings in fec magic computationMike Frysinger
The current fec code casts a pointer to an int which causes warnings on 64bit systems. So create a macro for the duplicate/complicated magic computation, and add an unsigned long cast in it to fix the original problem. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-23mtd-utils: compr: drop unused model argumentMike Frysinger
The jffs2 compression framework provides a "model" argument when compressing and decompressing, but the caller always passes in NULL and the callees never use it. So punt this useless overhead. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-23compr_zlib: mark local functions as staticMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-23ftl_check: drop unused verbose flagMike Frysinger
The verbose flag isn't actually checked anywhere, so punt it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-23mtd-utils: clean up zlib.h usage a bitMike Frysinger
Hide zlib's crc32 in compr_zlib.c and mkfs.ubifs/compr.c. jffs2reader.c and mkfs.jffs2.c don't actually use zlib, so punt the include from the file. mkfs.jffs2.c is implicitly using crc32 from zlib.h instead of the local mtd_crc32, so fix the local usage. otherwise we get warnings about undefined crc32 because the file was redirecting the prototype. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-23rbtree: avoid redefining offsetofMike Frysinger
Newer versions of gcc will define & export offsetof, so we don't want to unconditionally define it. Otherwise we hit: In file included from mkfs.jffs2.c:76:0: rbtree.h:134:0: warning: "offsetof" redefined /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/include/stddef.h:411:0: note: this is the location of the previous definition Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>