aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
AgeCommit message (Collapse)Author
2009-07-26ubiformat: torture eraseblocks on write errorsArtem Bityutskiy
When fail to write to PEBs, and the error is EIO, torture the PEB before marking it as bad. Basically, the code is copied from the kernel UBI. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-03ubi-utils: fix compilation errors when using CPPFLAGSMike Frysinger
The CPPFLAGS in the env changes how make initializes/appends CPPFLAGS in sub-makes. This causes the old ubi utils to find the newer headers at ubi-utils/include/ before the ubi-utils/old-utils/inc/. Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-30ubiformat: allow zero erase counterArtem Bityutskiy
This patch fixes the following issue: $ ubiformat /dev/mtd2 -e 0 ubiformat: error!: bad erase counter value: "0" Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-08libubi: fix wrong size calculation with sizes > 4GiBDetlef Bardtholdt
This fixes the handling of total_bytes, avail_bytes and rsvd_bytes. The result of the multiplication must be 64 Bit. Signed-off-by: Detlef Bardtholdt <bardtholdt.detlef@ng-litef.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-06-05ubiformat: add a TODO entryArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-02libmts: recognize pre-MTD-sysfs kernels betterArtem Bityutskiy
Not-so-old linux kernel like 2.6.29 do already have "/sys/class/mtd/mtdX" directories, while very old kernels do not. But in 2.6.29 these directories do not contain any information. Anyway, the logic in libmtd which checked whether the system supports sysfs was broken, because it assumed that old systems do not even have "/sys/class/mtd/" directory. Fix this problem by checking for "/sys/class/mtd/mtdX/name". If this is present - the system really has sysfs support. This patch also adds an extra print to libmtd. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-11ubi-utils: fix memory corruptionsArtem Bityutskiy
This patch contains changes similar to the ones in the previous patch. Also, it changes all invocations of memset and makes sure the argument is 0, not '\0', because memset expects int, not char. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-11libubi: fix multiple memory corruptionsCorentin Chary
The memset is obviously wrong, and valgrind tells use there are some uninitialised bytes used after read() Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-11libubi: add ubi_is_mapped() functionCorentin Chary
Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-11ubi-utils: add sysfs interface support and new toolArtem Bityutskiy
This large commit makes several things. 1. Switches libmtd to use the new sysfs interface 2. Implements new handy 'mtdinfo' utility 3. Does minore amendmends in libubi and some ubi-tools. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libubi: add ubi_leb_unmap interfaceArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libubi: add ubi_set_property interfaceArtem Bityutskiy
This is needed for io_paral test.
2009-05-08libmtd: make type_str to be an arrayArtem Bityutskiy
This is a prepearation to the coming sysfs interface support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: rename num fieldArtem Bityutskiy
This is a preparation for the coming sysfs support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: rename rdonly fieldArtem Bityutskiy
This is a preparation for the coming sysfs support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libmtd: rename allows_bb fieldArtem Bityutskiy
This is a preparation for the coming sysfs support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08mtd-utils: minor amendments in crc32.hArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libubigen: add missing includeArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08libubi: do not use udevsettleArtem Bityutskiy
Not sure why, but udevsettle does not work when threads are used. In the io_paral test I experience the problem when udevsettle opens UBI volumes and prevents tests to open them (EBUSY is returned). Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-07ubiformat: fix build errorArtem Bityutskiy
src/ubiformat.c: In function ‘main’: src/ubiformat.c:741: error: too many arguments to function ‘libubi_open’
2009-05-07ubi-utils: remove debugging leftoversArtem Bityutskiy
Remove -g -O0 which I accidentally introduce. Sorry for that. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-22libubi: improve errors handlingArtem Bityutskiy
Improve comments about what is returned if UBI device or node does not exist. Better check for ENODEV error code. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-22libubi: improve libubi_open interfaceArtem Bityutskiy
Remove the not very nice @required parameter, and add a possibility to distinguish between real errors and a situation when UBI is not present. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-20libmtd: rename mtd_infoArtem Bityutskiy
Rename 'struct mtd_info' to 'struct mtd_dev_info' to reflect the fact that it provides information about a specific MTD device. Also, this is more consistent with libubi. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-20libmtd: rename mtd_get_infoArtem Bityutskiy
Rename 'mtd_get_info()' into 'mtd_get_dev_info()' to be consistent to libubi. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-20ubi-utils: rename ubi_node_typeArtem Bityutskiy
Re-name the 'ubi_node_type()' function to a more meaningful name: 'ubi_probe_node()'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-20ubinfo: handle -d correctlyArtem Bityutskiy
Fix ubinfo utility and make it handle -d parameter correctly. Without this patch it simple refuses working with -d. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18ubiformat: increase version to 1.2Artem Bityutskiy
The previous patch fixed a nasty bug, so it is nice to increase program version to reflect that. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18ubiformat: fix segfault and messagesArtem Bityutskiy
ubiformat segfaults like this: ubiformat: mtd0 (NAND), size 134217728 bytes (128.0 MiB), 16384 eraseblocks of 16384 bytes (16.0 KiB), min. I/O size 512 bytes libscan: scanning eraseblock 8191 -- 100 % complete ubiformat: 8190 eraseblocks have valid erase counter, mean value is 9 ubiformat: 2 eraseblocks are supposedly empty ubiformat: warning!: VID header and data offsets on flash are 512 and 1024, which is different to calculated offsets 256 and 512 ubiformat: use new offsets 512 and 1024? (yes/no) no Segmentation fault The reason is that volume table size is calculated for 256/512 layout, and when user chooses 512/1024 - it is not re-calculated which leads to segfault in 'ubigen_write_layout_vol()'. This patch also fixes the message - in the above output new offsets are 256/512, not 512/1024. Also, this patch adds explicit printing of the selected positions. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libmtd: amend interfaceArtem Bityutskiy
Remove the fd field from the mtd information data structure, because libmtd does not really know the device node file name, and serves only as a place to save the descriptor. The callers should find a better place. This patch improves code readability and prepares for further changes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: remove unnecessary header filesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: amend included header filesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: remove useless variableArtem Bityutskiy
We know that sysfs is always at /sys, so we do not have to store it in lib->sysfs. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: remove incorrect commentArtem Bityutskiy
sysfs if guaranteed to be in /sys. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: spelling fixesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libmtd: move comments to headersArtem Bityutskiy
Just for the sake of being consistent with libubi, move the comments for API functions to the header file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-31ubi-utils: tweak vpath handlingMike Frysinger
Building out of tree currently fails with ubi-utils because make gets confused and can't figure out the vpathed .c files. Using VPATH rather than vpath seems to work around it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-03-30libubigen: don't define large array on stacksonic zhang
On nommu arch, local stack size is very limited and can't be enlarged on demand. So, don't define large array on local stack. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
2009-03-27libmtd: fix mtd_is_bad return codeRoger Quadros
Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-26ubiformat: mark faulty blocks as badRoger Quadros
Few minor amendments by Artem. And increase the utility version number. Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-17ubi-utils: re-arrange directory layoutArtem Bityutskiy
Move new-utils to ubi-utils and old ones to ubi-utils/old-utils. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-26Add generated binaries to gitignoreMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: add ubirename utilityRichard Titmuss
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: update ubi-header.hArtem Bityutskiy
Take the latest version from the kernel, where it was renamed to ubi-media.h. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-11I have here a mtd part which is 3 GiB with a flash page size of 256KiB.linux-mtd-owner@lists.infradead.org
The 2GiB limit is at erase block 8192. In mtd_is_bad() the computation for the MEMGETBADBLOCK ioctl() looks like the following: | seek = eb * mtd->eb_size; with both eb and mtd->eb_size being a signed int results in seek being a signed result. The _FILE_OFFSET_BITS=64 define is required to switch off_t from 32bit to 64bit an 32bit systems. This is required in order to keep using lseek() as lseek64 on 32bit system. Without this change lseek() in mtd_read() is called with a 32bit value with most significat bit set and the kernel performs a sign extension for the 64bit value which is used in the mtd layer. The last change also changes the size of the parameter which is passed to the MEMGETBADBLOCK ioctl() from 32 to 64bit. The counter part in kernel is also defined as loff_t which is of type __kernel_loff_t and this is "long long". So this must have been broken for a while unless I missed something. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-20ubiupdatevol: fix -t parameterSebastian Andrzej Siewior
The execution of |./ubiupdatevol /dev/ubi0 -t will fail because 'argv[optind + 1]' is undefined and the later executed 'strcmp(args.img, "-")' will segfault. So I can hack around and supply a dummy image or fix it that way. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-16ubi-utils: fix compilation warningsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-16ubiformat: nicify error messagesArtem Bityutskiy
In case of error, ubiformat prints error messages at the same line as the previous messages. Fix this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-15ubi-utils: minor printing fixArtem Bityutskiy
Add missing whitespace in ubimkvol help output Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-13ubi-utils: fix warning in fprintf() codeMike Frysinger
When building with gcc security warnings enabled, the ubimirror.c code triggers this warning: ./src/ubimirror.c: In function 'main': ./src/ubimirror.c:206: error: format not a string literal and no format arguments Since the buffer in question should be a straight string anyways, avoid ugly printf exploits by outputting the string indirectly: printf("%s", buffer) Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>