Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
... because of the previous serious bug-fix.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This is needed for io_paral test.
|
|
This is a prepearation to the coming sysfs interface support.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This is a preparation for the coming sysfs support.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This is a preparation for the coming sysfs support.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This is a preparation for the coming sysfs support.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Mostly improvments in io_paral.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
src/ubiformat.c: In function ‘main’:
src/ubiformat.c:741: error: too many arguments to function ‘libubi_open’
|
|
Remove -g -O0 which I accidentally introduce. Sorry
for that.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Rename 'mtd_get_info()' into 'mtd_get_dev_info()' to be consistent
to libubi.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Re-name the 'ubi_node_type()' function to a more meaningful name:
'ubi_probe_node()'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
sysfs if guaranteed to be in /sys.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|