[U-Boot] [PATCH v2 1/1] configs: rk3288: Tinker Board SPL file must fit into 32 KiB

Tom Rini trini at konsulko.com
Sat Feb 16 23:18:22 UTC 2019


On Sat, Feb 16, 2019 at 11:51:54PM +0100, Heinrich Schuchardt wrote:
> On 2/16/19 11:11 PM, Tom Rini wrote:
> > On Wed, Feb 13, 2019 at 10:38:09PM +0100, Heinrich Schuchardt wrote:
> >> The SPL image for the Tinker Board has to fit into 32 KiB. This includes
> >> 4 KiB for the device tree and 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 at gmx.de>
> >> ---
> >> v2
> >> 	Instead of using CONFIG_SPL_MAX_SIZE with an estimate of the FDT
> >> 	size introduce a new test in scripts/Makefile.spl.
> > [snip]
> >> +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
> > 
> > OK, but now we have 3 copies of this logic.  Can we not define a
> > function and pass the limit in to it?  Then we'd have a few things like:
> > ifneq ($(CONFIG_xxx_MAX_SIZE),0)
> > xxx_SIZE_CHECK = ... call func with $@ and size
> > else
> > xxx_SIZE_CHECK =
> > endif
> > 
> > Or do we need something else to avoid duplicating this in so many
> > places?
> > 
> 
> I found BOARD_SIZE_CHECK in Makefile and in arch/arm/mach-imx/Makefile.
> It is unclear to me why the copy in arch/arm/mach-imx/Makefile exists at
> all. Isn't that Makefile included by the main Makefile?

Yes, the logic got copied to two places, and then updated somewhat
recently.  I want to prevent it from becoming three places.

> You once mentioned that there are other boards with the same problem as
> the Tinker Board. Which are these?

Well, Simon has been talking about SoCFPA.  And as we get into migrating
a number of platforms over to SPL+SPL_OF_CONTROL a lot more platforms
are going to hit this too.  Heck, I wonder if the failure I saw on
am335x_evm a few hours ago was this one.  And a quick ls -lk says it's
quite close and I'd have to actually check the real values.  So it's
real important to me that we be able to plug "everyone" in here as the
existing CONFIG_SPL_MAX_SIZE isn't catching nearly so much as we don't
have a link error here but rather a final value overflow and that's
what's been the point of these checks all along.  Thanks!

-- 
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/20190216/a79524b1/attachment.sig>


More information about the U-Boot mailing list