[BUG] emmc `env erase` erase unrelated data

Francesco Dolcini francesco.dolcini at toradex.com
Mon Nov 29 16:38:34 CET 2021


Hello Tom,

On Mon, Nov 29, 2021 at 10:25:30AM -0500, Tom Rini wrote:
> On Mon, Nov 29, 2021 at 02:21:23PM +0100, Francesco Dolcini wrote:
> > I noticed an issue with env erase command when environment is stored in a
> > emmc device, in case start/end are not aligned to the emmc erase groups
> > size additional data is erased with just a warning.
...
> > I do not think that this is the correct behavior, I think that in case
> > the env is not aligned to the erase block size the erase should either
> > fail or fall back to just writing 0xff. Not sure if just changing
> > `mmc_berase()` is going to affect any other use case in which is valid
> > to have a non-aligned start/size and just erase around it after a
> > warning.
> 
> Largely intentional behavior.  Perhaps the help text at least should be
> updated to note that environment size for MMC needs to be a multiple of
> erase block size?  And further that when using redundant environment
> it's strongly encouraged to make sure each environment is on its own
> erase block.

I'm not really convinced, but let's move forward from this point.

Are you aware of any other issues in case the emmc environment is not a
multiple/aligned to the erase size? I believe that the rest of the code
just read/write to it, so once it is aligned to the read/write block
size (512 bytes, usually) there should be no problem.

Francesco



More information about the U-Boot mailing list