summaryrefslogtreecommitdiff
path: root/config.mk
diff options
context:
space:
mode:
authorDaniel Schwierzeck <daniel.schwierzeck@googlemail.com>2011-07-18 06:09:15 +0000
committerWolfgang Denk <wd@denx.de>2011-07-26 14:42:40 +0200
commitc8f9c302c26ba0e3a398ebe8005dc2a8b489cc2b (patch)
tree4bcad686d3408ed6c54665c1645521948c36e5b6 /config.mk
parent6a11cf48a569d747bcf374a8da88393dc209a347 (diff)
downloadu-boot-c8f9c302c26ba0e3a398ebe8005dc2a8b489cc2b.tar.gz
u-boot-c8f9c302c26ba0e3a398ebe8005dc2a8b489cc2b.tar.bz2
u-boot-c8f9c302c26ba0e3a398ebe8005dc2a8b489cc2b.zip
Extend build-system for SPL framework
Signed-off-by: Aneesh V <aneesh@ti.com> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Diffstat (limited to 'config.mk')
-rw-r--r--config.mk34
1 files changed, 33 insertions, 1 deletions
diff --git a/config.mk b/config.mk
index 2eb7fa22e1..ed44d03ad3 100644
--- a/config.mk
+++ b/config.mk
@@ -23,19 +23,31 @@
#########################################################################
-ifneq ($(OBJTREE),$(SRCTREE))
ifeq ($(CURDIR),$(SRCTREE))
dir :=
else
dir := $(subst $(SRCTREE)/,,$(CURDIR))
endif
+ifneq ($(OBJTREE),$(SRCTREE))
+# Create object files for SPL in a separate directory
+ifeq ($(CONFIG_SPL_BUILD),y)
+obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
+else
obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/)
+endif
src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/)
$(shell mkdir -p $(obj))
else
+# Create object files for SPL in a separate directory
+ifeq ($(CONFIG_SPL_BUILD),y)
+obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
+
+$(shell mkdir -p $(obj))
+else
obj :=
+endif
src :=
endif
@@ -160,10 +172,25 @@ gccincdir := $(shell $(CC) -print-file-name=include)
CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
-D__KERNEL__
+
+# Enable garbage collection of un-used sections for SPL
+ifeq ($(CONFIG_SPL_BUILD),y)
+CPPFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS_FINAL += --gc-sections
+endif
+
ifneq ($(CONFIG_SYS_TEXT_BASE),)
CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
endif
+ifneq ($(CONFIG_SPL_TEXT_BASE),)
+CPPFLAGS += -DCONFIG_SPL_TEXT_BASE=$(CONFIG_SPL_TEXT_BASE)
+endif
+
+ifeq ($(CONFIG_SPL_BUILD),y)
+CPPFLAGS += -DCONFIG_SPL_BUILD
+endif
+
ifneq ($(RESET_VECTOR_ADDRESS),)
CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS)
endif
@@ -206,6 +233,11 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),)
LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
endif
+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
+
# Location of a usable BFD library, where we define "usable" as
# "built for ${HOST}, supports ${TARGET}". Sensible values are
# - When cross-compiling: the root of the cross-environment