Skip to contentSkip to conversation

pico-imx7d: Increase the CONFIG_ENV_OFFSET size

PATCH Superseded Fabio Estevam 3 participants 5 messages Nov 30, 2018 Arm i.MX and Layerscape

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 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.

---
 include/configs/pico-imx7d.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/pico-imx7d.h +1 -1
index 2bc42a0..120111d 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size

Quoted 1 line · Fabio Estevam

The environment size has grown

Environment ? You mean code, I suppose. Size is stil 8kb.

Quoted 16 lines

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.

---
 include/configs/pico-imx7d.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/pico-imx7d.h +0 -0
index 2bc42a0..120111d 100644

include/configs/pico-imx7d.h line 140

Quoted 8 lines
include/configs/pico-imx7d.h +1 -1
@@ -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

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author reviewer
#2 lore raw

PATCH 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size

Hi Stefano,

Quoted 5 lines · Stefano Babic
Quoted 1 line · Fabio Estevam

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

#3 lore raw

PATCH 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size

In reply to Fabio Estevam

Dear Fabio,

Quoted 4 lines · In message <[email protected]> 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.

include/configs/pico-imx7d.h line 137

Quoted 5 lines

/* FLASH and environment organization */
#define CONFIG_ENV_SIZE SZ_8K

include/configs/pico-imx7d.h +1 -1
-#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

Signature · 8 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every revolutionary idea - in science, politics, art, or  whatever  -
evokes three stages of reaction in a hearer:
  1. It is completely impossible - don't waste my time.
  2. It is possible, but it is not worth doing.
  3. I said it was a good idea all along.
#4 lore raw

PATCH 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size

Hi Wolfgang,

Quoted 13 lines · Wolfgang Denk

Dear Fabio,

Quoted 4 lines · In message <[email protected]> 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.

Quoted 3 lines

/* FLASH and environment organization */
#define CONFIG_ENV_SIZE SZ_8K

Quoted 8 lines

include/configs/pico-imx7d.h line 137

Quoted 2 lines
include/configs/pico-imx7d.h +1 -1
-#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.

Quoted 2 lines

it would make it necessary to raise
CONFIG_ENV_SIZE first

No.

Quoted 5 lines

- 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

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================