Skip to content

Commit

Permalink
Makefile: move some flags to spl/Makefile
Browse files Browse the repository at this point in the history
Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y authored and trini committed Feb 19, 2014
1 parent ced0715 commit e0d5d9f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
19 changes: 0 additions & 19 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,6 @@ RELFLAGS= $(PLATFORM_RELFLAGS)
OBJCFLAGS += --gap-fill=0xff

CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)

# Enable garbage collection of un-used sections for SPL
ifeq ($(CONFIG_SPL_BUILD),y)
CPPFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections
endif

ifeq ($(CONFIG_SPL_BUILD),y)
CPPFLAGS += -DCONFIG_SPL_BUILD
ifeq ($(CONFIG_TPL_BUILD),y)
CPPFLAGS += -DCONFIG_TPL_BUILD
endif
endif

CPPFLAGS += $(UBOOTINCLUDE)
CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)

Expand All @@ -129,11 +115,6 @@ AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
LDFLAGS += $(PLATFORM_LDFLAGS)
LDFLAGS_FINAL += -Bstatic

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

#########################################################################

export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
14 changes: 14 additions & 0 deletions spl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ include $(srctree)/scripts/Kbuild.include
CONFIG_SPL_BUILD := y
export CONFIG_SPL_BUILD

KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
ifeq ($(CONFIG_TPL_BUILD),y)
KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
endif

# Enable garbage collection of un-used sections for SPL
KBUILD_CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections

ifeq ($(CONFIG_TPL_BUILD),y)
export CONFIG_TPL_BUILD
SPL_BIN := u-boot-tpl
Expand Down Expand Up @@ -173,6 +182,11 @@ endif
$(obj)$(SPL_BIN).bin: $(obj)$(SPL_BIN)
$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@

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

GEN_UBOOT = \
cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
Expand Down

0 comments on commit e0d5d9f

Please sign in to comment.