[PATCH] fastboot: Re-implement erase according to spec

Eugeniu Rosca erosca at de.adit-jv.com
Wed Jan 15 16:40:26 CET 2020


Hi Sam,

On Wed, Jan 15, 2020 at 04:59:13PM +0200, Sam Protsenko wrote:
> The main point of my patch is to fix the erasing of partitions smaller
> than group erase size (512 KiB on BeagleBoard X15). For example, it's
> impossible to erase 'misc' partition (128 KiB), as such an operation
> would erase 512 KiB, so alignment code leads to no-op.

At this point the discussion is no longer specific to fastboot, as your
points also apply to erasing MMC partitions in general.

I think clarifying below might be helpful (some questions might have
obvious answers):
 - Is it legitimate to have partitions smaller than erase group size?
 - Is it legitimate to have partitions not aligned to erase group size?
 - How does U-Boot 'mmc' command and Linux behave when erasing a
   partition smaller or not aligned to erase group size?

> Also, I
> wouldn't jump into conclusions about fastboot spec. Relying on 0xFF
> can be useful e.g. for testing purposes.
> 
> All that said, I'm positive that this issue should be fixed. The only
> way I see to avoid performance degradation is to:
>   - use actual MMC erase operation when erasing partition >= group erase size
>   - use MMC write operation when erasing partition < group erase size

Fair enough.

> 
> But that leaves unhandled the case when partition is bigger than group
> erase size, but not a multiple o group erase size (so the remainder
> won't be erased). Of course we can do MMC write op for the not aligned
> remainder, but how would we know if MMC controller fills with 0x00 of
> with 0xFF on MMC erase op? So all those options considered, I decided
> to go with just MMC write operation for "fastboot erase".

I think we should check how Linux behaves in similar use-cases and
possibly inspire from there (ideally by backporting the necessary
patches).

> 
> I will try to come up with v2 soon, but I don't see any ideal/elegant
> solution here. So if you have any ideas, please share.

Just shared my thoughts. Looking forward to seeing the v2.

-- 
Best Regards,
Eugeniu


More information about the U-Boot mailing list