aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2009-08-11nandwrite: unified reading from standard input and from file - part 3Jehan Bing
Nandwrite tries to use lseek() when failing to write on a page. lseek() will fail when used on the standard input so nandwrite fails. This code replaces lseek with a buffer. When the data is read, it is put in a buffer (filebuf). This buffer is reset at each block boundary. So a "seek" just means reading from the beginning of the buffer. writebuf and oobreadbuf are now just pointers to locations in filebuf. Signed-off-by: Jehan Bing <jehan@orb.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-11nandwrite: unified reading from standard input and from file - part2Jehan Bing
Use the same code structure when reading the OOB than when reading the regular data. Signed-off-by: Jehan Bing <jehan@orb.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-11nandwrite: unified reading from standard input and from file - part 1Jehan Bing
Use same code path for reading data (not the OOB) from either the standard input or a regular file. Signed-off-by: Jehan Bing <jehan@orb.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-11mkfs.ubifs: correct devtable increment handlingDaniel Neukomm
With the device table one can add /dev entries to the root file system image. The device table file contains among others the fields minor, start, increment and count. If there is an entry with minor=0 start=0 increment=32 and count=4 the mkfs.ubifs makes 128 device entries, with minor numbers from 0 to 127. The correct version makes 4 entries with minor number 0,32,64,96. /dev/mtd c 640 0 0 90 0 0 2 7 This gives 14 devices /dev/mtdXX instead of 7 devices. Due to this error mtd_debug info /dev/mtd3 delivers the information of /dev/mtd1 instead of. Signed-off-by: Daniel Neukomm <Neukomm@vtxmail.ch> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-09jffs2dump: rewrite --help output to be more suitable for help2manTimo Juhani Lindfors
$ help2man /usr/sbin/jffs2dump | man /dev/stdin currently creates badly formatted output like -b --bigendian image is big endian -l --littleendian image is little endian -c --content dump image contents -e fname --endianconvert=fname convert image endianness, output to file fname -r --recalc- This patch modifies the --help output for jffs2dump to be more suitable for help2man and thus makes it possible to easily create manual pages that stay up-to-date. Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-30ubiformat: clean up help output a littleArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubinize: add sequence number supportArtem Bityutskiy
UBI now supports the image sequence number feature which prevents UBI from mistakingly accepting half-written images, if the image was written on top of an older image. Support this feature in ubinize and make it pick a random number for the UBI image sequence number. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubi-utils: update ubi-media.hArtem Bityutskiy
Update the ubi-media.h file in order to add UBI sequence number support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubi-utils: remove depricated -d optionArtem Bityutskiy
It's already about 2 years since the "-d" option was declared deprecated. UBI utils have printed a warning about this. Now it is time to kill this option completely. The affected utilities are ubimkvol, ubirmvol and ubiupdatevol. Their versions are also increased. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26common: remove depricated KB,MB,GB supportArtem Bityutskiy
KiB, MiB and GiB should be used instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubiformat: version 1.4Artem Bityutskiy
Increase ubiformat version to reflect the fact that now we torture PEBs before marking them as bad. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubiformat: make badblocks output less confusingArtem Bityutskiy
When ubiformat prints something like ubiformat: bad eraseblocks: 1400 it looks like there are 1400 bad eraseblock, although there is only one with number 1400. Fix this but turning the print into ubiformat: 1 bad eraseblock found, numbers: 1400 Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubiformat: nicify error outputArtem Bityutskiy
Do not print extra newline if write fails, because mtd_write prints a message and adds newline. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-07-26ubiformat: minor printing clean-upArtem Bityutskiy
When a PEB is marked as bad while we are formatting, ubiformat prints 99% done at the end. Make it print 100% done instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
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-09nandwrite: fix error handlingJehan Bing
Artem Bityutskiy wrote: > Yes, write and erase failure mean that the erasblock is bad. But I think > marking a block as bad straight away is just dangerous. Who knows may be > this is a small glitch in a bus, or a software bug, or some-one > corrupted driver's memory, or whatever. This is why UBI is doing > eraseblock torturing before marking it as bad. And it is very careful > about error codes - only EIO code is considered as a reason to mark an > eraseblock as bad. Fixed broken behavior in case of write failure. More specifically: - Only try to mark a block bad if the errors are EIO. Other errors will abort the tool. - Also abort the tool if the marking fails instead of ignoring it. Signed-off-by: Jehan Bing <jehan@orb.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-09nandwrite: return error if failure when reading from standard inputJehan Bing
Fix nandwrite to return EXIT_FAILURE in case of error when using the standard input instead of a file for input. Signed-off-by: Jehan Bing <jehan@orb.com> 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-08nandwrite: amend loop conditionJehan Bing
If the file contains only a few bytes in the last page and the --oob option is selected, the loop may exit early (readlen < meminfo.oobsize). Most of the time it will still work though because the code tries to read the whole OOB in one chunk. Signed-off-by: Jehan Bing <jehan@orb.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-05ubiformat: add a TODO entryArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-05mkfs.ubifs: inclreas version to 1.3Artem Bityutskiy
... because of the previous serious bug-fix. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-06-05mkfs.ubifs: fix brown paper-bag bugArtem 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-27mkfs.ubifs: use libubi to format UBI volumeCorentin Chary
libubi is now used to format directly UBI volume. Typing mkfs.ubifs /dev/ubi0_0 is now possible. dtypes should be ok as they are taken from UBIFS code. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-25mkfs.ubifs: remove duplicated codeCorentin Chary
ino->uid = cpu_to_le32(st->st_uid); ino->gid = cpu_to_le32(st->st_gid); was present twice. Signed-off-by: Corentin Chary <corentincj@iksaif.net> 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-11mkfs.ubifs: fix -U option handlingKevin Cernekee
The long form (--squash-uids) is correct, but the short form (-U) is not. Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com> 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-11ubi-tests: add .gitignore fileArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-05-08ubi-tests: improve io_paral testArtem Bityutskiy
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-08ubi-tests: various changesArtem Bityutskiy
Mostly improvments in io_paral. 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-07ubi-tests: make tests compile againArtem Bityutskiy
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>