From: Faiz Abbas Date: Fri, 10 Jan 2020 19:10:18 +0530 Subject: [PATCH] fastboot: Re-implement erase according to spec In-Reply-To: <20200109184715.21574-1-semen.protsenko@linaro.org> References: <20200109184715.21574-1-semen.protsenko@linaro.org> Message-ID: <79d4a448-80ec-e8e5-833f-fb4a28a1cd8c@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > ---Reviewed-by: Faiz Abbas Thanks, Faiz