* [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB
@ 2019-02-14 6:25 Heinrich Schuchardt
2019-02-14 9:20 ` Simon Goldschmidt
0 siblings, 1 reply; 6+ messages in thread
From: Heinrich Schuchardt @ 2019-02-14 6:25 UTC (permalink / raw)
To: u-boot
The SPL image for the Tinker Board has to fit into 32 KiB. This includes
up to 2 KiB for the file header.
A new configuration variable CONFIG_SPL_WITH_DTB_SIZE_LIMIT is introduced
to define the board specific limit.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v3
The maximum size should of the image should be 30 KiB. Allowing
2 KiB for the header. This is 30720 and not 32700 bytes.
v2
Instead of using CONFIG_SPL_MAX_SIZE with an estimate of the FDT
size introduce a new test in scripts/Makefile.spl.
---
Kconfig | 8 ++++++++
configs/tinker-rk3288_defconfig | 1 +
scripts/Makefile.spl | 16 ++++++++++++++++
3 files changed, 25 insertions(+)
diff --git a/Kconfig b/Kconfig
index 512c7beb89..7cce53da74 100644
--- a/Kconfig
+++ b/Kconfig
@@ -172,6 +172,14 @@ config TPL_SYS_MALLOC_F_LEN
particular needs this to operate, so that it can allocate the
initial serial device and any others that are needed.
+config SPL_WITH_DTB_SIZE_LIMIT
+ int "Maximum size of SPL image including device tree"
+ depends on SPL
+ default 0
+ help
+ Specifies the maximum length of the U-Boot SPL image including the
+ device tree. If this value is zero, it is ignored.
+
menuconfig EXPERT
bool "Configure standard U-Boot features (expert users)"
default y
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
index fdcab28185..cc5e59bcf1 100644
--- a/configs/tinker-rk3288_defconfig
+++ b/configs/tinker-rk3288_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x00000000
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_ROCKCHIP_RK3288=y
+CONFIG_SPL_WITH_DTB_SIZE_LIMIT=30720
CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
CONFIG_TARGET_TINKER_RK3288=y
CONFIG_DEBUG_UART_BASE=0xff690000
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 9d5921606e..afc329a410 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -254,11 +254,27 @@ FINAL_DTB_CONTAINER = $(obj)/$(SPL_BIN).multidtb.fit
endif
+ifneq ($(CONFIG_SPL_WITH_DTB_SIZE_LIMIT),0)
+SPL_WITH_DTB_SIZE_CHECK = \
+ @actual=`wc -c $@ | awk '{print $$1}'`; \
+ limit=`printf "%d" $(CONFIG_SPL_WITH_DTB_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
+else
+SPL_WITH_DTB_SIZE_CHECK =
+endif
+
ifeq ($(CONFIG_$(SPL_TPL_)OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_$(SPL_TPL_)OF_PLATDATA),yy)
$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \
$(if $(CONFIG_SPL_SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \
$(FINAL_DTB_CONTAINER) FORCE
$(call if_changed,cat)
+ $(SPL_WITH_DTB_SIZE_CHECK)
$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE
$(call if_changed,copy)
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB
2019-02-14 6:25 [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB Heinrich Schuchardt
@ 2019-02-14 9:20 ` Simon Goldschmidt
2019-02-27 10:15 ` Simon Goldschmidt
0 siblings, 1 reply; 6+ messages in thread
From: Simon Goldschmidt @ 2019-02-14 9:20 UTC (permalink / raw)
To: u-boot
On Thu, Feb 14, 2019 at 7:26 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> The SPL image for the Tinker Board has to fit into 32 KiB. This includes
> up to 2 KiB for the file header.
>
> A new configuration variable CONFIG_SPL_WITH_DTB_SIZE_LIMIT is introduced
> to define the board specific limit.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> v3
> The maximum size should of the image should be 30 KiB. Allowing
> 2 KiB for the header. This is 30720 and not 32700 bytes.
> v2
> Instead of using CONFIG_SPL_MAX_SIZE with an estimate of the FDT
> size introduce a new test in scripts/Makefile.spl.
> ---
> Kconfig | 8 ++++++++
> configs/tinker-rk3288_defconfig | 1 +
> scripts/Makefile.spl | 16 ++++++++++++++++
> 3 files changed, 25 insertions(+)
>
> diff --git a/Kconfig b/Kconfig
> index 512c7beb89..7cce53da74 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -172,6 +172,14 @@ config TPL_SYS_MALLOC_F_LEN
> particular needs this to operate, so that it can allocate the
> initial serial device and any others that are needed.
>
> +config SPL_WITH_DTB_SIZE_LIMIT
> + int "Maximum size of SPL image including device tree"
> + depends on SPL
> + default 0
> + help
> + Specifies the maximum length of the U-Boot SPL image including the
> + device tree. If this value is zero, it is ignored.
> +
> menuconfig EXPERT
> bool "Configure standard U-Boot features (expert users)"
> default y
> diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
> index fdcab28185..cc5e59bcf1 100644
> --- a/configs/tinker-rk3288_defconfig
> +++ b/configs/tinker-rk3288_defconfig
> @@ -3,6 +3,7 @@ CONFIG_ARCH_ROCKCHIP=y
> CONFIG_SYS_TEXT_BASE=0x00000000
> CONFIG_SYS_MALLOC_F_LEN=0x2000
> CONFIG_ROCKCHIP_RK3288=y
> +CONFIG_SPL_WITH_DTB_SIZE_LIMIT=30720
> CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
> CONFIG_TARGET_TINKER_RK3288=y
> CONFIG_DEBUG_UART_BASE=0xff690000
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 9d5921606e..afc329a410 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -254,11 +254,27 @@ FINAL_DTB_CONTAINER = $(obj)/$(SPL_BIN).multidtb.fit
> endif
>
>
> +ifneq ($(CONFIG_SPL_WITH_DTB_SIZE_LIMIT),0)
> +SPL_WITH_DTB_SIZE_CHECK = \
> + @actual=`wc -c $@ | awk '{print $$1}'`; \
> + limit=`printf "%d" $(CONFIG_SPL_WITH_DTB_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
> +else
> +SPL_WITH_DTB_SIZE_CHECK =
> +endif
> +
> ifeq ($(CONFIG_$(SPL_TPL_)OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_$(SPL_TPL_)OF_PLATDATA),yy)
> $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \
> $(if $(CONFIG_SPL_SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \
> $(FINAL_DTB_CONTAINER) FORCE
> $(call if_changed,cat)
> + $(SPL_WITH_DTB_SIZE_CHECK)
>
> $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE
> $(call if_changed,copy)
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB
2019-02-14 9:20 ` Simon Goldschmidt
@ 2019-02-27 10:15 ` Simon Goldschmidt
2019-02-27 18:55 ` Tom Rini
0 siblings, 1 reply; 6+ messages in thread
From: Simon Goldschmidt @ 2019-02-27 10:15 UTC (permalink / raw)
To: u-boot
Tom,
On Thu, Feb 14, 2019 at 10:20 AM Simon Goldschmidt
<simon.k.r.goldschmidt@gmail.com> wrote:
>
> On Thu, Feb 14, 2019 at 7:26 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > The SPL image for the Tinker Board has to fit into 32 KiB. This includes
> > up to 2 KiB for the file header.
> >
> > A new configuration variable CONFIG_SPL_WITH_DTB_SIZE_LIMIT is introduced
> > to define the board specific limit.
> >
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Is this planned for v2019.04? I know we're in rc phase, but this patch
adds a new config
option so shouldn't interfere with boards not using it.
Plus if we have this SPL size check in v2019.04, it would probably
enable more board
maintainers testing/fixing the SPL size check after the release.
Regards,
Simon
>
> > ---
> > v3
> > The maximum size should of the image should be 30 KiB. Allowing
> > 2 KiB for the header. This is 30720 and not 32700 bytes.
> > v2
> > Instead of using CONFIG_SPL_MAX_SIZE with an estimate of the FDT
> > size introduce a new test in scripts/Makefile.spl.
> > ---
> > Kconfig | 8 ++++++++
> > configs/tinker-rk3288_defconfig | 1 +
> > scripts/Makefile.spl | 16 ++++++++++++++++
> > 3 files changed, 25 insertions(+)
> >
> > diff --git a/Kconfig b/Kconfig
> > index 512c7beb89..7cce53da74 100644
> > --- a/Kconfig
> > +++ b/Kconfig
> > @@ -172,6 +172,14 @@ config TPL_SYS_MALLOC_F_LEN
> > particular needs this to operate, so that it can allocate the
> > initial serial device and any others that are needed.
> >
> > +config SPL_WITH_DTB_SIZE_LIMIT
> > + int "Maximum size of SPL image including device tree"
> > + depends on SPL
> > + default 0
> > + help
> > + Specifies the maximum length of the U-Boot SPL image including the
> > + device tree. If this value is zero, it is ignored.
> > +
> > menuconfig EXPERT
> > bool "Configure standard U-Boot features (expert users)"
> > default y
> > diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
> > index fdcab28185..cc5e59bcf1 100644
> > --- a/configs/tinker-rk3288_defconfig
> > +++ b/configs/tinker-rk3288_defconfig
> > @@ -3,6 +3,7 @@ CONFIG_ARCH_ROCKCHIP=y
> > CONFIG_SYS_TEXT_BASE=0x00000000
> > CONFIG_SYS_MALLOC_F_LEN=0x2000
> > CONFIG_ROCKCHIP_RK3288=y
> > +CONFIG_SPL_WITH_DTB_SIZE_LIMIT=30720
> > CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
> > CONFIG_TARGET_TINKER_RK3288=y
> > CONFIG_DEBUG_UART_BASE=0xff690000
> > diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> > index 9d5921606e..afc329a410 100644
> > --- a/scripts/Makefile.spl
> > +++ b/scripts/Makefile.spl
> > @@ -254,11 +254,27 @@ FINAL_DTB_CONTAINER = $(obj)/$(SPL_BIN).multidtb.fit
> > endif
> >
> >
> > +ifneq ($(CONFIG_SPL_WITH_DTB_SIZE_LIMIT),0)
> > +SPL_WITH_DTB_SIZE_CHECK = \
> > + @actual=`wc -c $@ | awk '{print $$1}'`; \
> > + limit=`printf "%d" $(CONFIG_SPL_WITH_DTB_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
> > +else
> > +SPL_WITH_DTB_SIZE_CHECK =
> > +endif
> > +
> > ifeq ($(CONFIG_$(SPL_TPL_)OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_$(SPL_TPL_)OF_PLATDATA),yy)
> > $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \
> > $(if $(CONFIG_SPL_SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \
> > $(FINAL_DTB_CONTAINER) FORCE
> > $(call if_changed,cat)
> > + $(SPL_WITH_DTB_SIZE_CHECK)
> >
> > $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE
> > $(call if_changed,copy)
> > --
> > 2.20.1
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB
2019-02-27 10:15 ` Simon Goldschmidt
@ 2019-02-27 18:55 ` Tom Rini
2019-02-28 18:14 ` Simon Goldschmidt
0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2019-02-27 18:55 UTC (permalink / raw)
To: u-boot
On Wed, Feb 27, 2019 at 11:15:23AM +0100, Simon Goldschmidt wrote:
> Tom,
>
> On Thu, Feb 14, 2019 at 10:20 AM Simon Goldschmidt
> <simon.k.r.goldschmidt@gmail.com> wrote:
> >
> > On Thu, Feb 14, 2019 at 7:26 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > >
> > > The SPL image for the Tinker Board has to fit into 32 KiB. This includes
> > > up to 2 KiB for the file header.
> > >
> > > A new configuration variable CONFIG_SPL_WITH_DTB_SIZE_LIMIT is introduced
> > > to define the board specific limit.
> > >
> > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> >
> > Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
>
> Is this planned for v2019.04? I know we're in rc phase, but this patch
> adds a new config
> option so shouldn't interfere with boards not using it.
>
> Plus if we have this SPL size check in v2019.04, it would probably
> enable more board
> maintainers testing/fixing the SPL size check after the release.
I really want to get the generic version of this in, yes.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190227/df736eff/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB
2019-02-27 18:55 ` Tom Rini
@ 2019-02-28 18:14 ` Simon Goldschmidt
2019-02-28 18:51 ` Tom Rini
0 siblings, 1 reply; 6+ messages in thread
From: Simon Goldschmidt @ 2019-02-28 18:14 UTC (permalink / raw)
To: u-boot
Am 27.02.2019 um 19:55 schrieb Tom Rini:
> On Wed, Feb 27, 2019 at 11:15:23AM +0100, Simon Goldschmidt wrote:
>> Tom,
>>
>> On Thu, Feb 14, 2019 at 10:20 AM Simon Goldschmidt
>> <simon.k.r.goldschmidt@gmail.com> wrote:
>>>
>>> On Thu, Feb 14, 2019 at 7:26 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>>>
>>>> The SPL image for the Tinker Board has to fit into 32 KiB. This includes
>>>> up to 2 KiB for the file header.
>>>>
>>>> A new configuration variable CONFIG_SPL_WITH_DTB_SIZE_LIMIT is introduced
>>>> to define the board specific limit.
>>>>
>>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>>
>>> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
>>
>> Is this planned for v2019.04? I know we're in rc phase, but this patch
>> adds a new config
>> option so shouldn't interfere with boards not using it.
>>
>> Plus if we have this SPL size check in v2019.04, it would probably
>> enable more board
>> maintainers testing/fixing the SPL size check after the release.
>
> I really want to get the generic version of this in, yes.
Which generic version? Was there some kind of generic follow-up patch I
missed?
I would like to implement a real & working SPL size check for socfpga
(including pre-reloc malloc, gd and stack) which builds on this.
Regards,
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB
2019-02-28 18:14 ` Simon Goldschmidt
@ 2019-02-28 18:51 ` Tom Rini
0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2019-02-28 18:51 UTC (permalink / raw)
To: u-boot
On Thu, Feb 28, 2019 at 07:14:08PM +0100, Simon Goldschmidt wrote:
> Am 27.02.2019 um 19:55 schrieb Tom Rini:
> >On Wed, Feb 27, 2019 at 11:15:23AM +0100, Simon Goldschmidt wrote:
> >>Tom,
> >>
> >>On Thu, Feb 14, 2019 at 10:20 AM Simon Goldschmidt
> >><simon.k.r.goldschmidt@gmail.com> wrote:
> >>>
> >>>On Thu, Feb 14, 2019 at 7:26 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >>>>
> >>>>The SPL image for the Tinker Board has to fit into 32 KiB. This includes
> >>>>up to 2 KiB for the file header.
> >>>>
> >>>>A new configuration variable CONFIG_SPL_WITH_DTB_SIZE_LIMIT is introduced
> >>>>to define the board specific limit.
> >>>>
> >>>>Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> >>>
> >>>Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> >>
> >>Is this planned for v2019.04? I know we're in rc phase, but this patch
> >>adds a new config
> >>option so shouldn't interfere with boards not using it.
> >>
> >>Plus if we have this SPL size check in v2019.04, it would probably
> >>enable more board
> >>maintainers testing/fixing the SPL size check after the release.
> >
> >I really want to get the generic version of this in, yes.
>
> Which generic version? Was there some kind of generic follow-up patch I
> missed?
No, there wasn't I believe which is why nothing has been applied. I
don't want to add a 3rd copy of the BOARD_SIZE_CHECK logic, I want it to
be re-usable and then used by CONFIG_SPL_MAX_SIZE / CONFIG_TPL_MAX_SIZE
because as with the switch (compared to when these checks were first
introduced, pre-SPL-DM) we now have image content that's not caught by
the linker check, so we need to use those variables in the right place
now.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190228/2c1783a5/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-02-28 18:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14 6:25 [U-Boot] [PATCH v3 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB Heinrich Schuchardt
2019-02-14 9:20 ` Simon Goldschmidt
2019-02-27 10:15 ` Simon Goldschmidt
2019-02-27 18:55 ` Tom Rini
2019-02-28 18:14 ` Simon Goldschmidt
2019-02-28 18:51 ` Tom Rini
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.