From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] pico-imx7d: Increase the CONFIG_ENV_OFFSET size
Date: Fri, 30 Nov 2018 16:33:12 +0100 [thread overview]
Message-ID: <20181130153312.08C74242267@gemini.denx.de> (raw)
In-Reply-To: <1543589533-4257-1-git-send-email-festevam@gmail.com>
Dear Fabio,
In message <1543589533-4257-1-git-send-email-festevam@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
next prev parent reply other threads:[~2018-11-30 15:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 14:52 [U-Boot] [PATCH v4] pico-imx7d: Increase the CONFIG_ENV_OFFSET size Fabio Estevam
2018-11-30 15:17 ` Otavio Salvador
2018-11-30 15:33 ` Wolfgang Denk [this message]
2018-11-30 16:28 ` Fabio Estevam
2018-12-03 15:52 ` Wolfgang Denk
2018-12-03 16:53 ` Fabio Estevam
2018-12-03 17:39 ` Otavio Salvador
2018-12-04 9:40 ` Wolfgang Denk
2018-12-04 9:37 ` Wolfgang Denk
2018-12-04 10:41 ` Fabio Estevam
2018-12-04 13:03 ` Wolfgang Denk
2018-12-04 13:18 ` Fabio Estevam
2018-12-04 13:35 ` Wolfgang Denk
2018-12-04 14:15 ` Fabio Estevam
2018-12-04 15:40 ` [U-Boot] [PATCH] Enable expression support for CONFIG_BOARD_SIZE_LIMIT Wolfgang Denk
2018-12-04 15:42 ` Otavio Salvador
2018-12-04 16:15 ` Fabio Estevam
2018-12-05 9:52 ` Wolfgang Denk
2018-12-06 13:04 ` Fabio Estevam
2018-12-06 14:23 ` Wolfgang Denk
2018-12-06 14:41 ` Fabio Estevam
2018-12-06 14:44 ` Andy Pont
2018-12-06 14:58 ` Fabio Estevam
2018-12-06 15:01 ` Fabio Estevam
2018-12-06 14:50 ` Philipp Tomsich
2018-12-06 15:06 ` Fabio Estevam
2018-12-06 15:17 ` Fabio Estevam
2018-12-07 15:21 ` Wolfgang Denk
2018-12-07 15:37 ` Fabio Estevam
2018-12-07 19:28 ` Wolfgang Denk
2018-12-07 19:27 ` [U-Boot] [PATCH v2] " Wolfgang Denk
2018-12-14 19:16 ` [U-Boot] [U-Boot, " Tom Rini
2019-03-06 20:54 ` Simon Goldschmidt
2019-03-08 17:17 ` Tom Rini
2019-03-08 17:28 ` Martin Husemann
2019-03-08 17:53 ` Philipp Tomsich
2019-03-08 18:16 ` Simon Goldschmidt
2019-03-08 19:55 ` Tom Rini
2019-03-15 10:13 ` Ismael Luceno Cortes
2018-12-17 14:13 ` [U-Boot] [PATCH v4] pico-imx7d: Increase the CONFIG_ENV_OFFSET size Fabio Estevam
2018-12-17 14:47 ` Stefano Babic
2018-12-17 14:50 ` Fabio Estevam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181130153312.08C74242267@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox