[PATCH] fastboot: Re-implement erase according to spec
Faiz Abbas
faiz_abbas at ti.com
Fri Jan 10 14:40:18 CET 2020
Hi,
On 10/01/20 12:17 am, Sam Protsenko wrote:
> Fastboot specification [1] requires MMC to be filled with 0xFF's on
> "fastboot erase" command:
>
> erase:%s Erase the indicated partition (clear to 0xFFs)
>
> Current "fastboot erase" implementation uses actual MMC erase operation
> blk_derase(), which can fill MMC either with 0x00 or 0xFF, depending on
> used MMC controller; from [2]:
>
> The content of an explicitly erased memory range shall be '0' or '1'
> depending on different memory technology.
>
> For example, on BeagleBoard X15 it fills memory with '0'.
>
> Furthermore, the minimal amount of memory blk_derase() can erase is
> "erase group size", and it's usually 512 KiB or more. So if we try to
> erase some partition which is smaller than 512 KiB, "fastboot erase"
> won't work at all, due to alignment. It's good practice to align all
> partitions to "erase group size" boundary, but it's not a strict
> requirement, so we just can't use blk_derase() due to this restriction.
>
> In order to provide the consistent way to erase partitions, adhere to
> the fastboot spec, and fix erasing of small partitions, let's use
> regular MMC write operation and fill the partition with 0xFF.
>
> [1] https://android.googlesource.com/platform/system/core/+/refs/tags/android-10.0.0_r25/fastboot/README.md#command-reference
> [2] https://www.jedec.org/system/files/docs/JESD84-A441.pdf
>
> Signed-off-by: Sam Protsenko <semen.protsenko at linaro.org>
> ---Reviewed-by: Faiz Abbas <faiz_abbas at ti.com>
Thanks,
Faiz
More information about the U-Boot
mailing list