Age | Commit message (Collapse) | Author |
|
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>
|
|
This patch enhances the flash_unlock utility to be able to do
unlocking for specified blocks range.
This patch also fixes calculation of 'length' as in previous patch.
Say there are 240 blocks present in the device. Then:
offset starts from: 0x0
and full size of device: 0x1E00000
doing: 240 * 0x20000 gives -> 0x1E00000
But last block address should be 0x1DE0000 (which spans for 0x20000
bytes, adding up to size of 0x1E00000)
Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch fixes the 'length' calculation.
Making it:
+ mtdLockInfo.length = (num_sectors - 1) * mtdInfo.erasesize;
Rather:
- mtdLockInfo.length = num_sectors * mtdInfo.erasesize;
Say there are 240 blocks present in the device. Then:
offset starts from: 0x0
and full size of device: 0x1E00000
doing: 240 * 0x20000 gives -> 0x1E00000
But last block address should be 0x1DE0000 (which spans for 0x20000
bytes, adding upto size of 0x1E00000)
Signed-off-by: Vimal Singh <vimalsingh@ti.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 patch adds support for passing the location of the lzo
library and headers.
Also BUILDDIR must be referenced to find the libubi.a archive.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
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: Jehan Bing <jehan@orb.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
$ 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>
|
|
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>
|
|
Update the ubi-media.h file in order to add UBI sequence number
support.
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>
|
|
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>
|