diff mbox

[U-Boot,RFC,14/17] spl: introduce CONFIG_SPL_TARGET

Message ID 1348272087-29608-15-git-send-email-scottwood@freescale.com
State RFC
Headers show

Commit Message

Scott Wood Sept. 22, 2012, 12:01 a.m. UTC
Currently it seems that SPLs rely on the user to specify the final target
on the make command line.  This is a departure from traditional U-Boot practice
and results in a lack of build coverage in MAKEALL.

Now boards can specify CONFIG_SPL_TARGET to determine what gets built by default.
Eventually all SPL boards should specify CONFIG_SPL_TARGET, but for now default
to at least building the SPL code.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 Makefile |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Tom Rini Sept. 22, 2012, 12:12 a.m. UTC | #1
On Fri, Sep 21, 2012 at 07:01:24PM -0500, Scott Wood wrote:

> Currently it seems that SPLs rely on the user to specify the final target
> on the make command line.  This is a departure from traditional U-Boot practice
> and results in a lack of build coverage in MAKEALL.
> 
> Now boards can specify CONFIG_SPL_TARGET to determine what gets built by default.
> Eventually all SPL boards should specify CONFIG_SPL_TARGET, but for now default
> to at least building the SPL code.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Note that this is sometimes handled via config.mk fragments:
ifdef CONFIG_SPL_BUILD
ALL-y   += $(OBJTREE)/MLO
else
ALL-y   += $(obj)u-boot.img
endif

Or similar.  I don't know what's better.
Scott Wood Sept. 24, 2012, 6:54 p.m. UTC | #2
On 09/21/2012 07:12:38 PM, Tom Rini wrote:
> On Fri, Sep 21, 2012 at 07:01:24PM -0500, Scott Wood wrote:
> 
> > Currently it seems that SPLs rely on the user to specify the final  
> target
> > on the make command line.  This is a departure from traditional  
> U-Boot practice
> > and results in a lack of build coverage in MAKEALL.
> >
> > Now boards can specify CONFIG_SPL_TARGET to determine what gets  
> built by default.
> > Eventually all SPL boards should specify CONFIG_SPL_TARGET, but for  
> now default
> > to at least building the SPL code.
> >
> > Signed-off-by: Scott Wood <scottwood@freescale.com>
> 
> Note that this is sometimes handled via config.mk fragments:
> ifdef CONFIG_SPL_BUILD
> ALL-y   += $(OBJTREE)/MLO
> else
> ALL-y   += $(obj)u-boot.img
> endif
> 
> Or similar.  I don't know what's better.

Ah.  I was wondering if there were some magic that existing boards were  
using, but couldn't find it.

I think I'd prefer having a simple CONFIG_SPL_TARGET, and boards that  
need something more complicated can still provide a config.mk  
fragment.  What is the CONFIG_SPL_BUILD test for?  Is ALL-y really  
evaluated twice?

-Scott
Tom Rini Sept. 24, 2012, 7:03 p.m. UTC | #3
On Mon, Sep 24, 2012 at 01:54:05PM -0500, Scott Wood wrote:
> On 09/21/2012 07:12:38 PM, Tom Rini wrote:
> >On Fri, Sep 21, 2012 at 07:01:24PM -0500, Scott Wood wrote:
> >
> >> Currently it seems that SPLs rely on the user to specify the
> >final target
> >> on the make command line.  This is a departure from traditional
> >U-Boot practice
> >> and results in a lack of build coverage in MAKEALL.
> >>
> >> Now boards can specify CONFIG_SPL_TARGET to determine what gets
> >built by default.
> >> Eventually all SPL boards should specify CONFIG_SPL_TARGET, but
> >for now default
> >> to at least building the SPL code.
> >>
> >> Signed-off-by: Scott Wood <scottwood@freescale.com>
> >
> >Note that this is sometimes handled via config.mk fragments:
> >ifdef CONFIG_SPL_BUILD
> >ALL-y   += $(OBJTREE)/MLO
> >else
> >ALL-y   += $(obj)u-boot.img
> >endif
> >
> >Or similar.  I don't know what's better.
> 
> Ah.  I was wondering if there were some magic that existing boards
> were using, but couldn't find it.
> 
> I think I'd prefer having a simple CONFIG_SPL_TARGET, and boards
> that need something more complicated can still provide a config.mk
> fragment.  What is the CONFIG_SPL_BUILD test for?  Is ALL-y really
> evaluated twice?

I'm not sure.  And thinking about what Wolfgang said in the other thread
about SoC specific Makefile fragment for the custom rules, it might work
out easily enough to convert things like this.  And yes, unless I'm
missing something, we evaulate everything again for the SPL build (and
each side of that if/else only would make sense in that context).
diff mbox

Patch

diff --git a/Makefile b/Makefile
index dd879a5..8feb6e1 100644
--- a/Makefile
+++ b/Makefile
@@ -371,10 +371,21 @@  endif
 # Always append ALL so that arch config.mk's can add custom ones
 ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 
+# This default can be removed when all SPLs define CONFIG_SPL_TARGET.
+# Until then this ensures that at least the SPL gets built by MAKEALL.
+ifdef CONFIG_SPL
+	ifdef CONFIG_SPL_TARGET
+		# need to strip off double quotes
+		SPL_TARGET := $(subst ",,$(CONFIG_SPL_TARGET))
+	else
+		SPL_TARGET ?= spl/u-boot-spl.bin
+	endif
+endif
+
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
-ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
+ALL-$(CONFIG_SPL) += $(obj)$(SPL_TARGET)
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 
 all:		$(ALL-y) $(SUBDIR_EXAMPLES)