Skip to contentSkip to conversation

check u-boot SPL size to avoid producing non-working images

PATCH Superseded Pavel Machek 3 participants 4 messages May 28, 2016 – May 30, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check u-boot SPL size to avoid producing non-working images

Debugging SPL is hard, and if SPL is too big, it tends to crash in mysterious ways.

(I'm not sure what the exact threshold is, 49762 bytes works, 52426 bytes does not, so 50000 should be good value).

scripts/Makefile.spl +1 -0
index 6d2017d..504f0d2 100644
@@ -237,6 +237,7 @@ endif
 
 MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage
 $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
+	@if test `stat -c%s $(obj)/$(SPL_BIN).bin` -gt 50000; then echo `stat -c%s $(obj)/$(SPL_BIN).bin` is too big, it probably will not work; exit 1; fi
 	$(call if_changed,mkimage)
 
 quiet_cmd_mksunxiboot = MKSUNXI $@
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

PATCH 1/1 check u-boot SPL size to avoid producing non-working images

Quoted 7 lines · Pavel Machek

Debugging SPL is hard, and if SPL is too big, it tends to crash in mysterious ways.

(I'm not sure what the exact threshold is, 49762 bytes works, 52426 bytes does not, so 50000 should be good value).

Please use CONFIG_SPL_MAX_*

Quoted 14 lines
scripts/Makefile.spl +1 -0
index 6d2017d..504f0d2 100644
@@ -237,6 +237,7 @@ endif
 
 MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage
 $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
+	@if test `stat -c%s $(obj)/$(SPL_BIN).bin` -gt 50000; then echo `stat -c%s $(obj)/$(SPL_BIN).bin` is too big, it probably will not work; exit 1; fi
 	$(call if_changed,mkimage)
 
 quiet_cmd_mksunxiboot = MKSUNXI $@
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH v2 1/1 check u-boot SPL size to avoid producing non-working images

Debugging SPL is hard, and if SPL is too big, it tends to crash in mysterious ways.

(I'm not sure what the exact threshold is, 49762 bytes works, 52426 bytes does not, so 50000 should be good value).

---

Quoted 1 line

Please use CONFIG_SPL_MAX_*

Ok, that's simple enough. It computes the size different way, thus the different number.

include/configs/socfpga_common.h +1 -1
index f657766..c82da96 100644
@@ -323,7 +332,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 #define CONFIG_SPL_FRAMEWORK
 #define CONFIG_SPL_RAM_DEVICE
 #define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_INIT_RAM_ADDR
-#define CONFIG_SPL_MAX_SIZE		(64 * 1024)
+#define CONFIG_SPL_MAX_SIZE		(48 * 1024)
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_SYS_MALLOC_SIMPLE
 #endif
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw

PATCH v2 1/1 check u-boot SPL size to avoid producing non-working images

Dear Pavel,

Quoted 5 lines · In message <20160528194124.GA27144@amd> you wrote:

Debugging SPL is hard, and if SPL is too big, it tends to crash in mysterious ways.

(I'm not sure what the exact threshold is, 49762 bytes works, 52426 bytes does not, so 50000 should be good value).

Can you please make clear in the subject (or at least in the commit message) that this change is only related to SoCFPGA systems? Thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
Beware of the Turing Tar-pit in  which  everything  is  possible  but
nothing of interest is easy.