Age | Commit message (Collapse) | Author |
|
A previous commit moved the code using this var into a diff func.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We are going to add some more code which prints eraseblocks map, so we need to
make 'print_dev_info()' a bit smaller to keep the code readable.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Usage/version information should go to stdout when it is expected behavior
(i.e. the user requested it explicitly). This info should go to stderr
only when the usage info is being shown as a result of incorrect options.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
... because mtd device node name do not have to follow the "/dev/mtd%d"
pattern.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Commit 924862c864da0b62cf93ba7abf2dc78a7e6ac48f broke ubimkvol parrameters
parsing by initializing the 'error' parameter of 'simple_strtoul()' to 1
instead of 0. This patch fixes the issue.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Instead of using strtol and Co directly, use our share simple_strtoX()
helpers. This is just a cleanup.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Shrink the data size a little by declaring addresses of constant strings
instead of pointers to it.
Also slip in static & const on long_options missing them.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make sure all the utils define PROGRAM_NAME and do so at the start of
the file so that sub-headers may assume it exists.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Reformat the help text of ubiattach and ubidetach to display nicely on
80 column terminals, also fix a couple of bits that did not make sense.
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Modify ubiattach and ubidetach to default to /dev/ubi_ctrl if not supplied
rather than requiring the user to type it in every time.
Also bump version from 1.0 to 1.1
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Because of namespace collisions mkfs.ubifs uses crc32() implementation from
/lib/libz.so.1, which generates incompatible CRC and later on the kernel reports
many CRC errors.
Fix this by re-naming mtd-utils' crc32 function to mtd_crc32.
Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch is base on Kevin Cernekee's patch posted to the MTD mailing
list. It adds MEMERASE64 support to the 'mtd_erase()' call. Now it
first tries to use MEMERASE64, and if that is not supported, falls
back to the old MEMERASE ioctl.
This patch also introduces an 'offs64_ioctl' flag to the libmtd
descriptor. However, we cannot initialize it in 'libmtd_open()',
because we need an MTD device node, which we do not have in
'libmtd_open()'. Thus, we firs mark this flag as "uninitialized",
and at the first invocation of 'mtd_erase()' we initialize it.
This also means that we have to pass the limbtd descriptor to
'mtd_erase()', to save the flag value. This, in turn, requires
tweaking 'mtd_erase()' users.
This is not very nice, but good enough so far.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Now include/common.h contains things that really everyone can use.
And all the stuff specific to ubi-utils is in ubi-utils/include/ubiutils-common.h
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Source files for libmtd, crc32, and fec are scattered throughout the
tree. Move them to a central location so they can be built into a
common "libmtd.a" library used by all mtd-utils programs.
This patch only renames/deletes files and does not change the content.
Also modify the build system and source code so that libmtd.a can be built
from a "common" location (lib/). Statically link all utilities at the top
level with libmtd.a . Minor changes to mkfs.ubifs to allow using the common
crc32 implementation.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
... to make it clear that this is EC header, not VID header.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Consistently use 'mtd_dev_node' to name variables consining
MTD device node path.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
ubi-tests need it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
To be consistent with other ubi libraries, move header comments
to the .h file.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
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>
|
|
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>
|