Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
Add an 'mtd_num' field to the UBI device information structure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Jon Ringle <jon@ringle.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We fixed the sequence numbers bug, which is quite serious.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
For some reasons sequence number was set to 0 in some case, which
is wrong.
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Similarly to ubinize, add image sequence number support.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
The UBI image sequence number is a 64-bit integer, not 32-bit integer.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
KiB, MiB and GiB should be used instead.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|