UBI: ignore/overwrite old data/PEBs after flashing

Richard Weinberger richard.weinberger at gmail.com
Thu Oct 16 02:10:58 PDT 2014


On Thu, Oct 16, 2014 at 7:34 AM, Rafał Miłecki <zajec5 at gmail.com> wrote:
> 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?

I'm confused. Do you always use the same UBI sequence number?
If you flash only 20MiB why do you create a much larger MTD partition?

> --
> Rafał
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



-- 
Thanks,
//richard



More information about the linux-mtd mailing list