[U-Boot] commit 9a9d66f5ef break U-Boot Env
Horatiu Vultur
horatiu.vultur at microchip.com
Fri Jan 18 09:18:17 UTC 2019
Hi Heiko,
The 01/18/2019 09:34, Heiko Schocher wrote:
> Hello Horatiu,
>
> just tried current mainline U-Boot on imx6ull based board with
> Env in SPI NOR. Your commit "9a9d66f5eff0"
>
> env: add spi_flash_read_env function
>
> breaks reading Env from SPI NOR in my case...
>
> If I interprete your patch correct, you only read until the 2 0x0
> in the env ... but for the env crc, the hole CONFIG_ENV_SIZE
> must be read ... else missing for crc calculation ...
>
> Hmm... following patch fixes for me the issue:
>
> hs at threadripper:git [master] $ git diff env/sf.c
> diff --git a/env/sf.c b/env/sf.c
> index b3dec82c35..dc4b56d4a4 100644
> --- a/env/sf.c
> +++ b/env/sf.c
> @@ -98,7 +104,7 @@ static int spi_flash_read_env(struct spi_flash *flash, u32 offset, size_t len,
> u32 addr = 0;
> u32 page_size = flash->page_size;
>
> - memset(buf, 0x0, len);
> + memset(buf, 0xff, len);
> for (int i = 0; i < len / page_size; ++i) {
> int ret = spi_flash_read(flash, offset, page_size,
> &((char *)buf)[addr]);
>
> But if I make a bigger ENV_SIZE this may break again...
That's correct, the buf should be initialized to 0xff.
But I don't see why increasing the ENV_SIZE would break it again. Can
you explain it why? Thank you.
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
--
/Horatiu
More information about the U-Boot
mailing list