2019-07-16 |
ubiformat: Fix wrong error tests
...
Several tests in ubiformat test for a positive error code where a
negative error code is returned from the called functions. This
is because the original code used tested against errno which is a
positive value.
One place still tests against errno, but the test should be against
the return value from the last function call. Fix that aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 16 Jul 2019
|
ubiformat: handle write errors correctly
...
This is a barebox adoption of mtd-utils commit
d9cbf6a ("ubiformat: handle write errors correctly"):
| ubiformat: handle write errors correctly
|
| This issue was reported and analyzed by
| Anton Olofsson <anol.martinsson@gmail.com>:
|
| when ubiformat encounters a write error while flashing the UBI image (which may
| come from a file of from stdout), it correctly marks the faulty eraseblock as
| bad and skips it. However, it also incorrectly drops the data buffer which was
| supposed to be written, and reads next block of data.
|
| This patch fixes this issue - in case of a write error, we preserve the current
| data and write it to the next eraseblock, instead of dropping it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 16 Jul 2019
|
mtd: peb: Do not mark as bad in mtd_peb_torture()
...
Both the Kernel and mtd-utils have peb torture functions and both
do not mark the block as bad automatically. Instead, the caller
must mark the block as bad when -EIO is returned from the torture
function. Do the same in barebox. This is necessary as the UBI code
otherwise may mark a block as bad twice: Once indirectly in
mtd_peb_torture() and then directly afterwards.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 16 Jul 2019
|
2019-07-15 |
ubiformat: improve generation of UBI image sequence
...
The UBI ec_hdr has an image_seq field. During attaching UBI expects
that its value is the same for all eraseblocks. The value should be
changed with every ubiformat and is used to detect half written images.
In barebox we use a pseudo random number generated with rand() for this
value. The ubiformat command calls srand(get_time_ns()) to initialize
the pseudo random numbber generator. This is done in the option parser,
so when ubiformat() is called directly (from fastboot for example) the
pseudo random number generator is not initialized and we get the same
values after every barebox restart.
This patch moves the pseudo random number generator initialization
to the place where the numbers are generated. Also use random32()
rather than rand() to generate 32bit values rather than 15bit values
(0 - RAND_MAX).
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 Jul 2019
|
2019-01-28 |
usb: fastboot: ubiformat: Fix bad block handling
...
When fastboot handles UBI images in sparse file format then bad blocks
of the underlying mtd device are not skipped. This patch fixes this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 28 Jan 2019
|
2018-11-14 |
ubiformat: print messages after checking a block is not bad
...
ubiformat prints its "flashing eraseblock x" and "formatting eraseblock
x" messages before having checked that a block is actually good. This
is misleading, so first check if a block is good and only if it is
print a message.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 14 Nov 2018
|
2018-02-09 |
ubiformat: Allow to ubiformat with a buffer given
...
So far ubiformat can only handle files. Make it possible to pass
a buffer into ubiformat.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 9 Feb 2018
|
2018-01-22 |
Merge branch 'for-next/misc'
Sascha Hauer
committed
on 22 Jan 2018
|
2018-01-11 |
ubiformat: Add ubiformat write function
...
The ubiformat C API expects an image file as argument. With upcoming
Android fastboot sparse image support we can no longer provide a
complete image anymore. With this patch we can write an image in
multiple chunks after we've formatted a MTD device with ubiformat.
ubiformat_write will skip the EC header in both the MTD device we
write to and also the image we read from, so we can flash an image
on a MTD device containing EC headers already.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 11 Jan 2018
|
ubiformat: Lower message printing frequency
...
During scanning and formatting printing the messages on a serial line
has significant overhead up to the point where it takes longer to print
the messages than it takes to do the work. Lower the message printing
frequency to improve performance.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 11 Jan 2018
|
2016-04-26 |
ubiformat: use default values for ubi_ver and image_seq
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 26 Apr 2016
|
commands: ubiformat: move code to common/
...
This is the final step to separate the ubiformat code from the
command. With this the ubiformat code gains a C API.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 26 Apr 2016
|