Commit e0d5d9f8887e5f80f6df4ff20bb1816a7edefd39

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent ced0715d4a

Makefile: move some flags to spl/Makefile

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 <yamada.m@jp.panasonic.com>

Showing 2 changed files with 14 additions and 19 deletions Side-by-side Diff

... ... @@ -95,20 +95,6 @@
95 95 OBJCFLAGS += --gap-fill=0xff
96 96  
97 97 CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
98   -
99   -# Enable garbage collection of un-used sections for SPL
100   -ifeq ($(CONFIG_SPL_BUILD),y)
101   -CPPFLAGS += -ffunction-sections -fdata-sections
102   -LDFLAGS_FINAL += --gc-sections
103   -endif
104   -
105   -ifeq ($(CONFIG_SPL_BUILD),y)
106   -CPPFLAGS += -DCONFIG_SPL_BUILD
107   -ifeq ($(CONFIG_TPL_BUILD),y)
108   -CPPFLAGS += -DCONFIG_TPL_BUILD
109   -endif
110   -endif
111   -
112 98 CPPFLAGS += $(UBOOTINCLUDE)
113 99 CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
114 100  
... ... @@ -128,11 +114,6 @@
128 114  
129 115 LDFLAGS += $(PLATFORM_LDFLAGS)
130 116 LDFLAGS_FINAL += -Bstatic
131   -
132   -LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
133   -ifneq ($(CONFIG_SPL_TEXT_BASE),)
134   -LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
135   -endif
136 117  
137 118 #########################################################################
138 119  
... ... @@ -19,7 +19,16 @@
19 19 CONFIG_SPL_BUILD := y
20 20 export CONFIG_SPL_BUILD
21 21  
  22 +KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
22 23 ifeq ($(CONFIG_TPL_BUILD),y)
  24 +KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
  25 +endif
  26 +
  27 +# Enable garbage collection of un-used sections for SPL
  28 +KBUILD_CFLAGS += -ffunction-sections -fdata-sections
  29 +LDFLAGS_FINAL += --gc-sections
  30 +
  31 +ifeq ($(CONFIG_TPL_BUILD),y)
23 32 export CONFIG_TPL_BUILD
24 33 SPL_BIN := u-boot-tpl
25 34 else
... ... @@ -172,6 +181,11 @@
172 181  
173 182 $(obj)$(SPL_BIN).bin: $(obj)$(SPL_BIN)
174 183 $(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@
  184 +
  185 +LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
  186 +ifneq ($(CONFIG_SPL_TEXT_BASE),)
  187 +LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
  188 +endif
175 189  
176 190 GEN_UBOOT = \
177 191 cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \