[PATCH] spl: spl_legacy: Fix spl_end address

Fabio Estevam festevam at gmail.com
Fri Jun 30 16:23:11 CEST 2023


From: Fabio Estevam <festevam at denx.de>

Currently, spl_end points to the __bss_end address, which
is an external RAM address instead of the end of the SPL text
section in the internal RAM.

This causes boot failures on imx6-colibri, for example:

```
Trying to boot from MMC1
SPL: Image overlaps SPL
resetting ...
```
Fix this problem by assigning spl_end to the _image_binary_end, as this
symbol properly represents the end of the SPL text section.

>From u-boot-spl.map:

.end
 *(.__end)
                0x00000000009121a4                _image_binary_end = .

Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks")
Reported-by: Francesco Dolcini <francesco.dolcini at toradex.com>
Signed-off-by: Fabio Estevam <festevam at denx.de>
---
Tom,

As 2023.07 is coming in a few days, maybe it is safer to revert 77aed22b48ab
in master and then squash 77aed22b48ab + this fix to next.

77aed22b48ab has been applied to 2023.07-rc5, which is too late in the cycle.

 common/spl/spl_legacy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index d34bc5492e8d..095443c63d8d 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -19,7 +19,7 @@
 static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size)
 {
 	uintptr_t spl_start = (uintptr_t)_start;
-	uintptr_t spl_end = (uintptr_t)__bss_end;
+	uintptr_t spl_end = (uintptr_t)_image_binary_end;
 	uintptr_t end = start + size;
 
 	if ((start >= spl_start && start < spl_end) ||
-- 
2.34.1



More information about the U-Boot mailing list