[U-Boot] [PATCH] check u-boot SPL size to avoid producing non-working images

Marek Vasut
2016-05-28T11:55:30Z

On 05/28/2016 10:55 AM, Pavel Machek 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).
>
> Signed-off-by: Pavel Machek <pavel@denx.de>

Please use CONFIG_SPL_MAX_*

> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 6d2017d..504f0d2 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -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 $@
>
>

--
Best regards,
Marek Vasut