[U-Boot] [RFC PATCH 3/4] Add new folder and build system for SPL

Aneesh V
2011-07-08T11:32:57Z

Dear Wolfgang,

On Friday 08 July 2011 02:47 PM, Wolfgang Denk wrote:
> Dear Daniel Schwierzeck,
>
> In message<1309883182-12854-4-git-send-email-daniel.schwierzeck@googlemail.com> you wrote:
> ...

Let's consider an out-of-tree build. Then,
$(OBJTREE) is BUILD_DIR here.

>> +# create 'spl/obj' within OBJTREE for spl
>> +OBJTREE := $(OBJTREE)/spl/obj
>> +LNDIR := $(OBJTREE)
>> +
>> +include $(TOPDIR)/config.mk

Here:
$(OBJTREE) => BUILD_DIR/spl/obj
$(obj) => BUILD_DIR/spl/obj/spl

>> +# We want the final binaries in this directory
>> +obj := $(obj)../
First of all, this was really intended to be:

+obj := $(obj)../../

(The original implementation was a mistake!)

So, here:
$(obj) => BUILD_DIR/spl/

I was trying to make an exception for the the spl directory, so that
the final images are in BUILD_DIR/spl/

>> +START = $(OBJTREE)/$(CPUDIR)/start.o
>
> I don't really like these "../" parts. Can we please try to omit
> these? We can use $(TOPDIR) and/or $(OBJTREE) instead to express the
> path names, can't we?

Please note that even if we use $(OBJTREE), to achieve the above, we
will need:

+obj := $(OBJTREE)/../

Please note that $(OBJTREE) needs to be updated before including
config.mk while $(obj) needs to be updated after it.

The solution I see to this problem is to have BUILD_DIR/spl/ as the
OBJTREE instead of BUILD_DIR/spl/obj. But this will create problems for
in-tree builds if TOPDIR/spl also had folders for source files like
nand, one-nand etc. In that case you will have something like this:

spl/
nand/ - source files
spl/nand/ - object files for the above directory
one-nand/ - source files
spl/one-nand/ - object files for the above directory
arch/... - object files
u-boot-spl - final elf target
u-boot-spl.bin - final binary image

I used BUILD_DIR/spl/obj as OBJTREE to avoid this problem.

If we could keep nand-boot.c etc in the regular source tree we can have
something like this:
spl/
arch/... - object files
drivers/... - object files
u-boot-spl - final elf target
u-boot-spl.bin - final binary image

Indeed this seems to be more logical for me. All source files for SPL
remain in the regular source tree and just use BUILD_DIR/spl as a
remote build directory.

best regards,
Aneesh