* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
@ 2019-10-21 14:22 Fabio Estevam
2019-10-21 16:43 ` Pierre-Jean Texier
2019-11-26 22:38 ` Fabio Estevam
0 siblings, 2 replies; 7+ messages in thread
From: Fabio Estevam @ 2019-10-21 14:22 UTC (permalink / raw)
To: u-boot
U-Boot binary has grown in such a way that it goes beyond the reserved
area for the environment variables.
Running "saveenv" followed by a "reset" 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.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
include/configs/warp7.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 73541fe176..d103567cf4 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -132,7 +132,18 @@
/* environment organization */
#define CONFIG_ENV_SIZE SZ_8K
-#define CONFIG_ENV_OFFSET (8 * SZ_64K)
+/* Environment starts at 768k = 768 * 1024 = 786432 */
+#define CONFIG_ENV_OFFSET 786432
+/*
+ * Detect overlap between U-Boot image and environment area in build-time
+ *
+ * CONFIG_BOARD_SIZE_LIMIT = CONFIG_ENV_OFFSET - u-boot-dtb.imx offset
+ * CONFIG_BOARD_SIZE_LIMIT = 768k - 1k = 767k = 785408
+ *
+ * Currently CONFIG_BOARD_SIZE_LIMIT does not handle expressions, so
+ * write the direct value here
+ */
+#define CONFIG_BOARD_SIZE_LIMIT 785408
#define CONFIG_SYS_FSL_USDHC_NUM 1
#define CONFIG_SYS_MMC_ENV_DEV 0
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
2019-10-21 14:22 [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment Fabio Estevam
@ 2019-10-21 16:43 ` Pierre-Jean Texier
2019-10-21 16:50 ` Fabio Estevam
2019-11-26 22:38 ` Fabio Estevam
1 sibling, 1 reply; 7+ messages in thread
From: Pierre-Jean Texier @ 2019-10-21 16:43 UTC (permalink / raw)
To: u-boot
Hello Fabio,
Le 21/10/2019 à 16:22, Fabio Estevam a écrit :
> U-Boot binary has grown in such a way that it goes beyond the reserved
> area for the environment variables.
>
> Running "saveenv" followed by a "reset" causes U-Boot to hang because
> of this overlap.
On top-of master 32ded50 ("spl: mmc: make eMMC HW boot
partition configuration optional ")
I am not able to reproduce the described behavior.
See above:
---------
=> env set foo bar
=> env save
Saving Environment to MMC... Writing to MMC(0)... OK
=> reset
resetting ...
U-Boot 2019.10-00750-g32ded50 (Oct 21 2019 - 17:42:20 +0200)
CPU: Freescale i.MX7S rev1.2 800 MHz (running at 792 MHz)
CPU: Extended Commercial temperature grade (-20C to 105C) at 41C
Reset cause: POR
Model: Warp i.MX7 Board
Board: WARP7 in secure mode OPTEE DRAM 0x9d000000-0xa0000000
DRAM: 464 MiB
MMC: FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... OK
In: serial at 30860000
Out: serial at 30860000
Err: serial at 30860000
SEC0: RNG instantiated
Net: usb_ether
Warning: usb_ether (eth0) using random MAC address - 4a:fd:63:75:a8:29
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0(part 0) is current device
switch to partitions #0, OK
mmc0(part 0) is current device
8417416 bytes read in 125 ms (64.2 MiB/s)
Booting from mmc ...
29058 bytes read in 11 ms (2.5 MiB/s)
Kernel image @ 0x80800000 [ 0x000000 - 0x807088 ]
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
Using Device Tree in place at 83000000, end 8300a181
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
Did you change anything in your configuration?
Thanks !
Pierre-Jean
>
> 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.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> include/configs/warp7.h | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/include/configs/warp7.h b/include/configs/warp7.h
> index 73541fe176..d103567cf4 100644
> --- a/include/configs/warp7.h
> +++ b/include/configs/warp7.h
> @@ -132,7 +132,18 @@
> /* environment organization */
> #define CONFIG_ENV_SIZE SZ_8K
>
> -#define CONFIG_ENV_OFFSET (8 * SZ_64K)
> +/* Environment starts at 768k = 768 * 1024 = 786432 */
> +#define CONFIG_ENV_OFFSET 786432
> +/*
> + * Detect overlap between U-Boot image and environment area in build-time
> + *
> + * CONFIG_BOARD_SIZE_LIMIT = CONFIG_ENV_OFFSET - u-boot-dtb.imx offset
> + * CONFIG_BOARD_SIZE_LIMIT = 768k - 1k = 767k = 785408
> + *
> + * Currently CONFIG_BOARD_SIZE_LIMIT does not handle expressions, so
> + * write the direct value here
> + */
> +#define CONFIG_BOARD_SIZE_LIMIT 785408
> #define CONFIG_SYS_FSL_USDHC_NUM 1
>
> #define CONFIG_SYS_MMC_ENV_DEV 0
>
--
Pierre-Jean Texier
Embedded Linux Engineer
https://koncepto.io
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
2019-10-21 16:43 ` Pierre-Jean Texier
@ 2019-10-21 16:50 ` Fabio Estevam
2019-10-21 17:12 ` Pierre-Jean Texier
0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2019-10-21 16:50 UTC (permalink / raw)
To: u-boot
Hi Pierre-Jean,
On Mon, Oct 21, 2019 at 1:43 PM Pierre-Jean Texier <pjtexier@koncepto.io> wrote:
> On top-of master 32ded50 ("spl: mmc: make eMMC HW boot
> partition configuration optional ")
> I am not able to reproduce the described behavior.
I used u-boot-imx tree and this is what I get:
ls -al u-boot-dtb.imx
-rw-r--r-- 1 fabio fabio 547840 out 21 13:45 u-boot-dtb.imx
Original CONFIG_ENV_OFFSET is:
#define CONFIG_ENV_OFFSET (8 * SZ_64K)
CONFIG_ENV_OFFSET = 8 * 64 * 1024 = 524288
So the u-boot-dtb.imx is overlapping the env region.
Maybe your compiler is producing a smaller binary and you are not
getting the issue.
Anyway, it is safer to increase CONFIG_ENV_OFFSET and use
CONFIG_BOARD_SIZE_LIMIT to detect such problem in build-time.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
2019-10-21 16:50 ` Fabio Estevam
@ 2019-10-21 17:12 ` Pierre-Jean Texier
2019-10-21 17:32 ` Joris Offouga
0 siblings, 1 reply; 7+ messages in thread
From: Pierre-Jean Texier @ 2019-10-21 17:12 UTC (permalink / raw)
To: u-boot
Fabio,
Le 21/10/2019 à 18:50, Fabio Estevam a écrit :
> Hi Pierre-Jean,
>
> On Mon, Oct 21, 2019 at 1:43 PM Pierre-Jean Texier <pjtexier@koncepto.io> wrote:
>
>> On top-of master 32ded50 ("spl: mmc: make eMMC HW boot
>> partition configuration optional ")
>> I am not able to reproduce the described behavior.
>
> I used u-boot-imx tree and this is what I get:
>
> ls -al u-boot-dtb.imx
> -rw-r--r-- 1 fabio fabio 547840 out 21 13:45 u-boot-dtb.imx
Same for me, but I can't reproduce this issue :/
>
> Original CONFIG_ENV_OFFSET is:
> #define CONFIG_ENV_OFFSET (8 * SZ_64K)
>
> CONFIG_ENV_OFFSET = 8 * 64 * 1024 = 524288
>
> So the u-boot-dtb.imx is overlapping the env region.
Indeed.
>
> Maybe your compiler is producing a smaller binary and you are not
> getting the issue.
>
> Anyway, it is safer to increase CONFIG_ENV_OFFSET and use
> CONFIG_BOARD_SIZE_LIMIT to detect such problem in build-time.
>
You're right, I agree with that ;)
So,
Acked-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Tested-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Thanks !
Regards
--
Pierre-Jean Texier
Embedded Linux Engineer
https://koncepto.io
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
2019-10-21 17:12 ` Pierre-Jean Texier
@ 2019-10-21 17:32 ` Joris Offouga
0 siblings, 0 replies; 7+ messages in thread
From: Joris Offouga @ 2019-10-21 17:32 UTC (permalink / raw)
To: u-boot
Hi Fabio, Pierre-Jean
Le 21/10/2019 à 19:12, Pierre-Jean Texier a écrit :
> Fabio,
>
> Le 21/10/2019 à 18:50, Fabio Estevam a écrit :
>> Hi Pierre-Jean,
>>
>> On Mon, Oct 21, 2019 at 1:43 PM Pierre-Jean Texier
>> <pjtexier@koncepto.io> wrote:
>>
>>> On top-of master 32ded50 ("spl: mmc: make eMMC HW boot
>>> partition configuration optional ")
>>> I am not able to reproduce the described behavior.
>>
>> I used u-boot-imx tree and this is what I get:
>>
>> ls -al u-boot-dtb.imx
>> -rw-r--r-- 1 fabio fabio 547840 out 21 13:45 u-boot-dtb.imx
>
> Same for me, but I can't reproduce this issue :/
Same for me
>
>>
>> Original CONFIG_ENV_OFFSET is:
>> #define CONFIG_ENV_OFFSET (8 * SZ_64K)
>>
>> CONFIG_ENV_OFFSET = 8 * 64 * 1024 = 524288
>>
>> So the u-boot-dtb.imx is overlapping the env region.
>
> Indeed.
>
>>
>> Maybe your compiler is producing a smaller binary and you are not
>> getting the issue.
>>
>> Anyway, it is safer to increase CONFIG_ENV_OFFSET and use
>> CONFIG_BOARD_SIZE_LIMIT to detect such problem in build-time.
>>
>
> You're right, I agree with that ;)
I agree with you ;)
>
> So,
>
> Acked-by: Pierre-Jean Texier <pjtexier@koncepto.io>
> Tested-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Acked-by: Joris Offouga <offougajoris@gmail.com>
Tested-by: Joris Offouga <offougajoris@gmail.com>
Best regards,
Joris
>
> Thanks !
>
> Regards
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
2019-10-21 14:22 [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment Fabio Estevam
2019-10-21 16:43 ` Pierre-Jean Texier
@ 2019-11-26 22:38 ` Fabio Estevam
2019-11-27 19:41 ` Stefano Babic
1 sibling, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2019-11-26 22:38 UTC (permalink / raw)
To: u-boot
Hi Stefano,
On Mon, Oct 21, 2019 at 11:23 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> U-Boot binary has grown in such a way that it goes beyond the reserved
> area for the environment variables.
>
> Running "saveenv" followed by a "reset" 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.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
Can we get this one for 2020.01?
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment
2019-11-26 22:38 ` Fabio Estevam
@ 2019-11-27 19:41 ` Stefano Babic
0 siblings, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2019-11-27 19:41 UTC (permalink / raw)
To: u-boot
On 26/11/19 23:38, Fabio Estevam wrote:
> Hi Stefano,
>
> On Mon, Oct 21, 2019 at 11:23 AM Fabio Estevam <festevam@gmail.com> wrote:
>>
>> U-Boot binary has grown in such a way that it goes beyond the reserved
>> area for the environment variables.
>>
>> Running "saveenv" followed by a "reset" 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.
>>
>> Signed-off-by: Fabio Estevam <festevam@gmail.com>
>
> Can we get this one for 2020.01?
>
I'll pick up it.
Stefano
> Thanks
>
--
=====================================================================
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
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-27 19:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 14:22 [U-Boot] [PATCH] warp7: Fix U-Boot corruption after saving the environment Fabio Estevam
2019-10-21 16:43 ` Pierre-Jean Texier
2019-10-21 16:50 ` Fabio Estevam
2019-10-21 17:12 ` Pierre-Jean Texier
2019-10-21 17:32 ` Joris Offouga
2019-11-26 22:38 ` Fabio Estevam
2019-11-27 19:41 ` Stefano Babic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.