[U-Boot] [RFC PATCH 1/4] Adapt config.mk for usage in spl/Makefile

Aneesh V
2011-07-06T08:07:40Z

Hi Daniel,

On Tuesday 05 July 2011 09:56 PM, Daniel Schwierzeck wrote:
> [aneesh at ti.com:
> 1. Changed the definition of OBJTREE and the way 'obj' is defined.
> 2. Defined a flag to identify regular U-Boot build
> 3. Taking care of autoconf.mk etc for SPL due to changed OBJTREE
> ]
>
> [daniel.schwierzeck at googlemail.com:
> 1. reverted changes on implicite make rules
> 2. readded definition of -DCONFIG_UBOOT_SPL_BUILD in CPPFLAGS
> ]
>
> Signed-off-by: Aneesh V<aneesh@ti.com>
> Signed-off-by: Daniel Schwierzeck<daniel.schwierzeck@googlemail.com>
> ---
> config.mk | 28 ++++++++++++++++++++++++++++
> 1 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/config.mk b/config.mk
> index 2eb7fa2..a16e761 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -116,8 +116,14 @@ RANLIB = $(CROSS_COMPILE)RANLIB
> #########################################################################
>
> # Load generated board configuration
> +ifdef CONFIG_UBOOT_SPL_BUILD
> +# OBJTREE points to /spl/obj inside the original OBJTREE for SPL
> +sinclude $(OBJTREE)/../../include/autoconf.mk
> +sinclude $(OBJTREE)/../../include/config.mk
> +else
> sinclude $(OBJTREE)/include/autoconf.mk
> sinclude $(OBJTREE)/include/config.mk
> +endif
>
> # Some architecture config.mk files need to know what CPUDIR is set to,
> # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
> @@ -164,13 +170,30 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),)
> CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
> endif
>
> +ifneq ($(CONFIG_SPL_TEXT_BASE),)

Is 'ifdef' more readable?

> +CPPFLAGS += -DCONFIG_SPL_TEXT_BASE=$(CONFIG_SPL_TEXT_BASE)
> +endif
> +
> +# Allow compiling of C and ASM code parts in different way.
> +# Serves also as a replacement for CONFIG_PRELOADER.
> +ifneq ($(CONFIG_UBOOT_SPL_BUILD),)
> +CPPFLAGS += -DCONFIG_UBOOT_SPL_BUILD
> +endif

I think we need to consolidate the CONFIG flags. There are quite a few
in use already.

CONFIG_PRELOADER
CONFIG_ONENAND_IPL
CONFIG_NAND_SPL

I wonder if CONFIG_ONENAND_IPL and CONFIG_NAND_SPL are used today to
distinguish the respective boots specifically or whether they could be
replaced by CONFIG_PRELOADER.

BTW, why do you want to replace CONFIG_PRELOADER with a new flag?

> +
> +CONFIG_NORMAL_UBOOT = $(if $(CONFIG_UBOOT_SPL_BUILD),,y)
> +
> ifneq ($(RESET_VECTOR_ADDRESS),)
> CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS)
> endif
>
[snip..]

> +LDFLAGS_u-boot-spl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
> +ifneq ($(CONFIG_SPL_TEXT_BASE),)
> +LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE)
> +endif
> +

Do we need this here or can this be in spl/Makefile ?

best regards,
Aneesh