summaryrefslogtreecommitdiff
path: root/ubi-utils/src
AgeCommit message (Collapse)Author
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>
2009-12-09ubiformat: check that min IO size is power of 2Artem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-11-26ubiformat: fix --erase-counter handlingArtem Bityutskiy
The --erase-counter option did not work and this was reproted by Darwin Rambo <drambo@broadcom.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-10-05ubi-utils: add ubirsvol tool to resize UBI volumesArnaud Mouiche
This is nearly a copy/paste from ubirmvol. Signed-off-by: Arnaud Mouiche <arnaud.mouiche@thomson.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-09-28ubinize/ubiformat: improve random number seedingArtem Bityutskiy
Add current time to the PID to improve the pseudo-random number generator seeding. Also, use 'rand()' instead of 'random()', because 'srand()' is for 'rand()'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-09-28ubiformat/ubinize: Don't randomize 0xFFFFFFFF sequence numberMichael Roth
args.image_seq is of type uint32_t and was initialized to -1 which becomes 0xFFFFFFFF in this case. Later the value -1 was used as a flag that args.image_seq should be replaced with a randomized value. With the option --image-seq (-Q) a user could provide any sequence number at will. But when the user provided sequence number was 0xFFFFFFFF this was understood effectivly as -1 and got overridden by a randomized sequence number. So this patch change the programm flow to respect the principle of least surprise and never use a randomized sequence number when the user provide one at own will. Signed-off-by: Michael Roth <mroth@nessie.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-09-28ubiformat/ubinize: fix more 64-bit image sequence number confusionMichael Roth
The sequence number is only 32 bit as the strtoul() function. Signed-off-by: Michael Roth <mroth@nessie.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-24ubiformat: add image sequence supportArtem Bityutskiy
Similarly to ubinize, add image sequence number support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-24ubinize: fix 64-bit image sequence number confusionArtem Bityutskiy
UBI image sequence number which we store in EC headers is 32 bits, not 64-bits. I was confused when noticed that the 'image_seq' variable had type 'unsigned long long'. Turn it into a 'uint32_t' type. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-24ubiformat: fix typo in the help outputArtem Bityutskiy
The UBI image sequence number is a 64-bit integer, not 32-bit integer. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-08-24mkfs.ubifs: do not forget to torture PEBArtem Bityutskiy
We added PEB torturing for the case when we fail during flashing an image, but forgot to add it for the case when we are formating the flash. Add the forgottent torturing call. 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: 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-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-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>