[PATCH] cmd: sf: Support unaligned flash updates with 'sf update'

Simon Glass sjg at chromium.org
Fri Oct 1 07:03:47 CEST 2021

Hi Frieder,

On Thu, 30 Sept 2021 at 10:20, Frieder Schrempf <frieder at fris.de> wrote:
> From: Frieder Schrempf <frieder.schrempf at kontron.de>
> Currently 'sf update' supports only offsets that are aligned to the
> erase block size of the serial flash. Unaligned offsets result in
> something like:
> => sf update ${kernel_addr_r} 0x400 ${filesize}
> device 0 offset 0x400, size 0x11f758
> SPI flash failed in erase step

<insert motivation for patch here>

> In order to support unaligned updates, we simply read the first full
> block and check only the requested part of the block for changes. If
> necessary, the block is erased, the first (unchanged) part of the block
> is written back together with the second part of the block (updated data).
> Signed-off-by: Frieder Schrempf <frieder.schrempf at kontron.de>
> ---
>  cmd/sf.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)


More information about the U-Boot mailing list