[U-Boot] [PATCH] pico-imx7d: Increase the CONFIG_ENV_OFFSET size

The environment size has grown in such a way that it corrupts the main U-Boot image after a "saveenv" causing a U-Boot hang.
Fix this problem by increasing the CONFIG_ENV_OFFSET size.
Signed-off-by: Fabio Estevam festevam@gmail.com --- include/configs/pico-imx7d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 2bc42a0..120111d 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -134,7 +134,7 @@ /* FLASH and environment organization */ #define CONFIG_ENV_SIZE SZ_8K
-#define CONFIG_ENV_OFFSET (8 * SZ_64K) +#define CONFIG_ENV_OFFSET (12 * SZ_64K) #define CONFIG_SYS_FSL_USDHC_NUM 2
#define CONFIG_SYS_MMC_ENV_DEV 0

On 30/11/18 10:48, Fabio Estevam wrote:
The environment size has grown
Environment ? You mean code, I suppose. Size is stil 8kb.
in such a way that it corrupts the main U-Boot image after a "saveenv" causing a U-Boot hang.
Fix this problem by increasing the CONFIG_ENV_OFFSET size.
Signed-off-by: Fabio Estevam festevam@gmail.com
include/configs/pico-imx7d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 2bc42a0..120111d 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -134,7 +134,7 @@ /* FLASH and environment organization */ #define CONFIG_ENV_SIZE SZ_8K
-#define CONFIG_ENV_OFFSET (8 * SZ_64K) +#define CONFIG_ENV_OFFSET (12 * SZ_64K) #define CONFIG_SYS_FSL_USDHC_NUM 2
#define CONFIG_SYS_MMC_ENV_DEV 0
Regards, Stefano

Hi Stefano,
On Fri, Nov 30, 2018 at 7:59 AM Stefano Babic sbabic@denx.de wrote:
On 30/11/18 10:48, Fabio Estevam wrote:
The environment size has grown
Environment ? You mean code, I suppose. Size is stil 8kb.
Yes, it is the U-Boot image that has grown and overlaps with the environment region.
I have reworded the commit log in v2.
Thanks

Dear Fabio,
In message 1543571315-6376-1-git-send-email-festevam@gmail.com you wrote:
The environment size has grown in such a way that it corrupts the main U-Boot image after a "saveenv" causing a U-Boot hang.
Fix this problem by increasing the CONFIG_ENV_OFFSET size.
Sorry, I can't understand this change.
/* FLASH and environment organization */ #define CONFIG_ENV_SIZE SZ_8K
-#define CONFIG_ENV_OFFSET (8 * SZ_64K) +#define CONFIG_ENV_OFFSET (12 * SZ_64K)
The size written to flash should never exceed CONFIG_ENV_SIZE; if it does, then there is some serious bug in the code, which I tend to doubt.
And when the environment grows, it would make it necessary to raise CONFIG_ENV_SIZE first - changing the CONFIG_ENV_OFFSET has nothing to do with this per se.
Can you please explain which phenomenon you see, and hos this change is supposed to work?
Best regards,
Wolfgang Denk

Hi Wolfgang,
On 30/11/18 14:05, Wolfgang Denk wrote:
Dear Fabio,
In message 1543571315-6376-1-git-send-email-festevam@gmail.com you wrote:
The environment size has grown in such a way that it corrupts the main U-Boot image after a "saveenv" causing a U-Boot hang.
Fix this problem by increasing the CONFIG_ENV_OFFSET size.
Sorry, I can't understand this change.
/* FLASH and environment organization */ #define CONFIG_ENV_SIZE SZ_8K
-#define CONFIG_ENV_OFFSET (8 * SZ_64K) +#define CONFIG_ENV_OFFSET (12 * SZ_64K)
The size written to flash should never exceed CONFIG_ENV_SIZE; if it does, then there is some serious bug in the code, which I tend to doubt.
And when the environment grows,
This was V1. It is not the size of the environment, it is U-Boot that grows and has overflow into the environment, leading to corruption by the first saveenv.
Nevertheless, the initial offset (0x80000) was quite optimistic with current bootloader size - u-boot binary for i.MX is often > 512KB.
it would make it necessary to raise CONFIG_ENV_SIZE first
No.
- changing the CONFIG_ENV_OFFSET has nothing
to do with this per se.
Can you please explain which phenomenon you see, and hos this change is supposed to work?
Best regards, Stefano
participants (3)
-
Fabio Estevam
-
Stefano Babic
-
Wolfgang Denk