[U-Boot] [PATCH v4] pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Wolfgang Denk
wd at denx.de
Fri Nov 30 15:33:12 UTC 2018
Dear Fabio,
In message <1543589533-4257-1-git-send-email-festevam at gmail.com> you wrote:
> 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.
>
> Also, in order to prevent this same problem in the future, use
> CONFIG_BOARD_SIZE_LIMIT, which will detect the overlap in build-time.
>
> CONFIG_BOARD_SIZE_LIMIT does not accept math expressions, so declare
> CONFIG_ENV_OFFSET with its direct value instead.
This is IMHO the wrong approach. Why not fix this problem?
> + * CONFIG_BOARD_SIZE_LIMIT = CONFIG_ENV_OFFSET - u-boot.img offset
> + * CONFIG_BOARD_SIZE_LIMIT = 768k - 69k = 699k = 715776
> + *
> + * Currently CONFIG_BOARD_SIZE_LIMIT does not handle expressions, so
> + * write the direct value here
> + */
> +#define CONFIG_BOARD_SIZE_LIMIT 715776
This looks ugly. I mean, have a look at the Makefile - we're
calling AWK anyway, so why not make this evaluating expressions
(and getting rid of a few unnneeded commands)?
Can you please try somthing like this (only minimally tested):
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 53d9e5f42b..a7f02f9996 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -60,15 +60,13 @@ endif
ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
BOARD_SIZE_CHECK = \
- @actual=`wc -c $@ | awk '{print $$1}'`; \
- limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
- if test $$actual -gt $$limit; then \
- echo "$@ exceeds file size limit:" >&2 ; \
- echo " limit: $$limit bytes" >&2 ; \
- echo " actual: $$actual bytes" >&2 ; \
- echo " excess: $$((actual - limit)) bytes" >&2; \
- exit 1; \
- fi
+ @wc -c $@ | \
+ awk '{ if ($$1 > $(CONFIG_BOARD_SIZE_LIMIT)) { \
+ printf "%s exceeds file size limit:\n", $$2; \
+ printf " limit: %d bytes\n", $(CONFIG_BOARD_SIZE_LIMIT); \
+ printf " actual: %d bytes\n", $$1; \
+ printf " excess: %d bytes\n", $$1 - $(CONFIG_BOARD_SIZE_LIMIT); \
+ exit 1; } }' >&2;
else
BOARD_SIZE_CHECK =
endif
If it works for you, then please feel free to include it in your
patch v3.
Thanks!
Best regards,
Wolfgang Denk
--
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
There is is no reason for any individual to have a computer in their
home. -- Ken Olsen (President of Digital Equipment Corporation),
Convention of the World Future Society, in Boston, 1977
More information about the U-Boot
mailing list