[U-Boot] [PATCH v2 16/56] spl: allow a separate TEXT_BASE, LDSCRIPT and MAX_SIZE for TPL

Tom Rini trini at konsulko.com
Wed Jul 26 19:53:38 UTC 2017


On Wed, Jul 26, 2017 at 12:40:20PM +0200, Philipp Tomsich wrote:

> For the bringup of the RK3368, we need to support TPL and SPL running
> from different addresses... which requires both stages to use a
> distinct TEXT_BASE.
> 
> This commit adds support for having a separate LDSCRIPT for TPL (which
> is expected to make use of the TPL_MAX_SIZE define) and for having a
> the option of defining TPL_TEXT_BASE and having the TPL stage linked
> against this address.
> 
> Note that the handling of the TEXT_BASE is designed to not interfere
> with the previous assumption that SPL_TEXT_BASE should be used for TPL
> as well, unless TPL_TEXT_BASE is defined.  For this reason, the test
> in Makefile.spl uses the following (seemingly redundant checks):
>  1. looks for $(SPL_TPL_)TEXT_BASE
>  2. looks for SPL_TEXT_BASE (even when building in TPL)
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
> ---
> 
> Changes in v2: None
> 
>  scripts/Makefile.spl         | 10 ++++++++--
>  scripts/config_whitelist.txt |  3 +++
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 3e35cd6..4a9a58f 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -103,9 +103,9 @@ u-boot-spl-platdata := $(obj)/dts/dt-platdata.o
>  endif
>  
>  # Linker Script
> -ifdef CONFIG_SPL_LDSCRIPT
> +ifdef CONFIG_$(SPL_TPL_)LDSCRIPT
>  # need to strip off double quotes
> -LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_SPL_LDSCRIPT:"%"=%))
> +LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_$(SPL_TPL_)LDSCRIPT:"%"=%))
>  endif
>  
>  ifeq ($(wildcard $(LDSCRIPT)),)
> @@ -293,9 +293,15 @@ LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
>  # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
>  LDFLAGS_$(SPL_BIN) += $(call ld-option, --no-dynamic-linker)
>  
> +# First try the best-match (i.e. SPL_TEXT_BASE for SPL, TPL_TEXT_BASE for TPL)
> +ifneq ($(CONFIG_$(SPL_TPL_)TEXT_BASE),)
> +LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_$(SPL_TPL_)TEXT_BASE)
> +else
> +# And then fall back to just testing for SPL_TEXT_BASE, even if in TPL mode
>  ifneq ($(CONFIG_SPL_TEXT_BASE),)
>  LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
>  endif
> +endif
>  
>  MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage
>  $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
> diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
> index 34aadc5..d8d00f5 100644
> --- a/scripts/config_whitelist.txt
> +++ b/scripts/config_whitelist.txt
> @@ -4996,8 +4996,11 @@ CONFIG_TI_KSNAV
>  CONFIG_TI_SPI_MMAP
>  CONFIG_TMU_TIMER
>  CONFIG_TPL_DRIVERS_MISC_SUPPORT
> +CONFIG_TPL_LDSCRIPT
> +CONFIG_TPL_MAX_SIZE
>  CONFIG_TPL_PAD_TO
>  CONFIG_TPL_STACK
> +CONFIG_TPL_TEXT_BASE
>  CONFIG_TPM_TIS_BASE_ADDRESS
>  CONFIG_TPS6586X_POWER
>  CONFIG_TQM834X

I'm not super happy about adding to the whitelist.  I know some of these
aren't easy to migrate to Kconfig, but can we add the new ones at least
in Kconfig?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170726/ead89fef/attachment.sig>


More information about the U-Boot mailing list