UBI: ignore/overwrite old data/PEBs after flashing

Rafał Miłecki zajec5 at gmail.com
Wed Oct 15 22:34:27 PDT 2014


Hi,

I need some help with flashing UBI images.

I work with Broadcom ARM SoCs that use a CFE bootloader. In most cases
it doesn't provide a way to clear flash content before flashing the
firmware. It means that if I have 120 MiB of space for the firmware
and I flash 20 MiB firmware, the rest of flash (100 MiB) won't be
cleared. My partitioner driver will create 2 MiB partition for kernel
and 118 MiB partition for UBI.

So the result is that UBI partition contains 18 MiB of prebuilt
(ubinize-d) image and 100 MiB of rubbish. This will lead to problems
like:
UBI warning: scan_peb: valid VID header but corrupted EC header at PEB 17

UBI will find some old PEBs, try to use them, this may even lead to
situation where the data from previous install will be still
available!


Of course, I'm aware I should not upgrade my images this way all the
time. Normally I would simply use
$ ubiformat /dev/mtd0 -f ubi.img
, but I'm trying to handle some corner cases. Sometimes the firmware
may be broken and user may not be able to boot. In such case I need to
be able to re-flash the firmware using bootloader (and sacrifice the
wearing info).


Is there some way to tell UBI to ignore & overwrite all flash data
(including PEBs) that are placed after the flashed (ubinize-d) image?
Could we add some magic PEB that will tell UBI that all the flash
content after that single PEB is rubbish?

-- 
Rafał



More information about the linux-mtd mailing list