pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Fabio Estevam
reviewerPATCH v2 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size
U-Boot binary has grown in such a way that it goes beyond the reserved area for the environment variables.
Running "saveenv" causes U-Boot to hang because of this overlap.
Fix this problem by increasing the CONFIG_ENV_OFFSET size.
---
Changes since v1:
- Reword the commit log (Stefano)
include/configs/pico-imx7d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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
Signature · 1 line
2.7.4
PATCH v2 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Hi Fabio,
Quoted 20 lines · Fabio Estevam
U-Boot binary has grown in such a way that it goes beyond the reserved area for the environment variables.
Running "saveenv" causes U-Boot to hang because of this overlap.
Fix this problem by increasing the
CONFIG_ENV_OFFSETsize.Signed-off-by Fabio Estevam <[email protected]>---
Changes since v1:
- Reword the commit log (Stefano)include/configs/pico-imx7d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/configs/pico-imx7d.h +0
-0
include/configs/pico-imx7d.h line 137
Quoted 5 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)
I find this hard to read: (12 * SZ_64K). Wouldn't (768 * SZ_1K) be better?
And I found using CONFIG_BOARD_SIZE_LIMIT quite handy, as it detects such increased image growths beyond its limit upon build time. Perhaps you could add this as well? This should do it for this board:
#define CONFIG_BOARD_SIZE_LIMIT CONFIG_ENV_OFFSET
Thanks,
Stefan
Fabio Estevam
reviewerPATCH v2 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Hi Stefan,
Quoted 5 lines · Stefan Roese
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)I find this hard to read: (12 *
SZ_64K). Wouldn't (768 *SZ_1K) be better?
Yes, this is a good idea, but it does not work in conjunction with your suggestion below.
Quoted 5 lines
And I found using
CONFIG_BOARD_SIZE_LIMITquite handy, as it detects such increased image growths beyond its limit upon build time. Perhaps you could add this as well? This should do it for this board:#define
CONFIG_BOARD_SIZE_LIMITCONFIG_ENV_OFFSET
Thanks for this suggestion.
I was not aware of CONFIG_BOARD_SIZE_LIMIT, which is very helpful!
The only issue I see with this approach is that it does not accept expressions like (768 * SZ_1K):
SYM u-boot.sym/bin/sh: 1: printf: (768 * SZ_1K): expected numeric value u-boot-nodtb.bin exceeds file size limit:
limit: 0 bytes
actual: 482952 bytes
excess: 482952 bytes
Makefile:1040: recipe for target 'u-boot-nodtb.bin' failed
So I will hardcode CONFIG_ENV_OFFSET and use CONFIG_BOARD_SIZE_LIMIT:
#define CONFIG_ENV_OFFSET 786432
/* Detect overlap between U-Boot image and environment area in build-time */ #define CONFIG_BOARD_SIZE_LIMIT CONFIG_ENV_OFFSET
IMHO it is better to get an error in build time when U-Boot and env area overlaps than providing a pretty CONFIG_ENV_OFFSET format :-)
Thanks!
PATCH v2 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Hi Fabio,
Quoted 15 lines · Fabio Estevam
Quoted 5 lines · Stefan Roese
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)I find this hard to read: (12 *
SZ_64K). Wouldn't (768 *SZ_1K) be better?Yes, this is a good idea, but it does not work in conjunction with your suggestion below.
Quoted 4 lines
And I found using
CONFIG_BOARD_SIZE_LIMITquite handy, as it detects such increased image growths beyond its limit upon build time. Perhaps you could add this as well? This should do it for this board:
Quoted 5 lines
Quoted 1 line
#define
CONFIG_BOARD_SIZE_LIMITCONFIG_ENV_OFFSETThanks for this suggestion.
I was not aware of
CONFIG_BOARD_SIZE_LIMIT, which is very helpful!
Yes, I also only found out about this a few months ago. Always something new to learn... ;)
Quoted 11 lines
The only issue I see with this approach is that it does not accept expressions like (768 *
SZ_1K):SYM u-boot.sym
/bin/sh: 1: printf: (768 *SZ_1K): expected numeric value u-boot-nodtb.bin exceeds file size limit:limit: 0 bytes actual: 482952 bytes excess: 482952 bytesMakefile:1040: recipe for target 'u-boot-nodtb.bin' failed
Quoted 8 lines
So I will hardcode
CONFIG_ENV_OFFSETand useCONFIG_BOARD_SIZE_LIMIT:#define
CONFIG_ENV_OFFSET786432
/* Detect overlap between U-Boot image and environment area in build-time */ #defineCONFIG_BOARD_SIZE_LIMITCONFIG_ENV_OFFSETIMHO it is better to get an error in build time when U-Boot and env area overlaps than providing a pretty
CONFIG_ENV_OFFSETformat :-)
I agree. I'm using hex values like this 0x80000, which look better to my eyes (personal taste). Perhaps the Makefile logic handling BOARD_LIMIT_SIZE can be improved to support other expressions as well.
Thanks,
Stefan
PATCH v2 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size
In reply to Fabio EstevamDear Fabio,
Quoted 3 lines · In message <CAOMZO5B3Dbub=XVMLKgDUQhkS7to8YsJeqsBmJE56y+itA2aMg@mail.gmail.com>…
Quoted 3 lines
I find this hard to read: (12 *
SZ_64K). Wouldn't (768 *SZ_1K) be better?
...
Quoted 2 lines
The only issue I see with this approach is that it does not accept expressions like (768 *
SZ_1K):
This is why I always prefer to use expressions that are both readable and computable, like (768 << 10).
Quoted 1 line
#define
CONFIG_ENV_OFFSET786432
Would
#define CONFIG_ENV_OFFSET (768 << 10)
or@least
#define CONFIG_ENV_OFFSET (768 * 1024)
work?
Quoted 2 lines
/* Detect overlap between U-Boot image and environment area in build-time */ #define
CONFIG_BOARD_SIZE_LIMITCONFIG_ENV_OFFSET
Note this is only correct if the U-Boot image gets written at offset zero - is this the case?
Quoted 2 lines
IMHO it is better to get an error in build time when U-Boot and env area overlaps than providing a pretty
CONFIG_ENV_OFFSETformat :-)
Agreed!
[Please ignore my previous message - working through the list sequentially is not optimal...]
Best regards,
Wolfgang Denk
Signature · 6 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
"My name is Linus Torvalds, you messed with my kernel, prepare to die"
- Linus Torvalds in
<[email protected]>Fabio Estevam
reviewerPATCH v2 1/1 pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Hi Wolfgang,
Quoted 7 lines · Wolfgang Denk
This is why I always prefer to use expressions that are both readable and computable, like (768 << 10).
Quoted 1 line
#define
CONFIG_ENV_OFFSET786432Would
Quoted 7 lines
#define
CONFIG_ENV_OFFSET(768 << 10)or at least
#define
CONFIG_ENV_OFFSET(768 * 1024)work?
CONFIG_BOARD_SIZE_LIMIT does not accept such definitions and it fails like this:
/bin/sh: 1: printf: (768 << 10): expected numeric value u-boot-nodtb.bin exceeds file size limit:
limit: 0 bytes
actual: 482952 bytes
excess: 482952 bytes
That is the reason I used #define CONFIG_ENV_OFFSET 786432
Quoted 5 lines
Quoted 2 lines
/* Detect overlap between U-Boot image and environment area in build-time */ #define
CONFIG_BOARD_SIZE_LIMITCONFIG_ENV_OFFSETNote this is only correct if the U-Boot image gets written at offset zero - is this the case?
That is a good point!
In this case SPL is flashed at offset 1k and u-boot.img is flashed at offset 69k.
So I guess I should hardcode CONFIG_BOARD_SIZE_LIMIT to 768k - 69k = 699k = 715776.
#define CONFIG_ENV_OFFSET 715776
/* Detect overlap between U-Boot image and environment area in build-time */ #define CONFIG_BOARD_SIZE_LIMIT CONFIG_ENV_OFFSET