summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--arch/blackfin/config.mk1
-rw-r--r--arch/sparc/config.mk2
-rw-r--r--config.mk28
-rw-r--r--examples/standalone/Makefile5
-rw-r--r--scripts/Makefile.build10
-rw-r--r--scripts/Makefile.lib7
-rw-r--r--spl/Makefile15
8 files changed, 44 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 4e61ae9..c03a1b4 100644
--- a/Makefile
+++ b/Makefile
@@ -358,13 +358,13 @@ UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
-export ARCH CPU BOARD VENDOR SOC
+export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
export MAKE AWK
export DTC CHECK CHECKFLAGS
-export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
+export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS KBUILD_AFLAGS
# When compiling out-of-tree modules, put MODVERDIR in the module
@@ -567,7 +567,8 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS += $(NOSTDINC_FLAGS)
# FIX ME
-cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
+cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
+ $(NOSTDINC_FLAGS)
c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
#########################################################################
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index adc9712..fcaa44f 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -43,6 +43,7 @@ CREATE_LDR_ENV =
endif
SYM_PREFIX = _
+export SYM_PREFIX
LDR_FLAGS-y :=
LDR_FLAGS-$(CONFIG_BFIN_BOOTROM_USES_EVT1) += -J
diff --git a/arch/sparc/config.mk b/arch/sparc/config.mk
index 6dbf20f..be59f58 100644
--- a/arch/sparc/config.mk
+++ b/arch/sparc/config.mk
@@ -9,6 +9,8 @@ ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := sparc-elf-
endif
+gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
+
CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \
-T $(srctree)/examples/standalone/sparc.lds
diff --git a/config.mk b/config.mk
index af25c11..4657577 100644
--- a/config.mk
+++ b/config.mk
@@ -6,11 +6,18 @@
#
#########################################################################
-# clean the slate ...
-PLATFORM_RELFLAGS =
-PLATFORM_CPPFLAGS =
-PLATFORM_LDFLAGS =
-
+# This file is included from ./Makefile and spl/Makefile.
+# Clean the state to avoid the same flags added twice.
+#
+# (Tegra needs different flags for SPL.
+# That's the reason why this file must be included from spl/Makefile too.
+# If we did not have Tegra SoCs, build system would be much simpler...)
+PLATFORM_RELFLAGS :=
+PLATFORM_CPPFLAGS :=
+PLATFORM_LDFLAGS :=
+LDFLAGS :=
+LDFLAGS_FINAL :=
+OBJCOPYFLAGS :=
#########################################################################
# Some architecture config.mk files need to know what CPUDIR is set to,
@@ -41,12 +48,17 @@ endif
#########################################################################
-RELFLAGS= $(PLATFORM_RELFLAGS)
+RELFLAGS := $(PLATFORM_RELFLAGS)
OBJCOPYFLAGS += --gap-fill=0xff
-CPPFLAGS = $(RELFLAGS)
-CPPFLAGS += -pipe $(PLATFORM_CPPFLAGS)
+PLATFORM_CPPFLAGS += $(RELFLAGS)
+PLATFORM_CPPFLAGS += -pipe
LDFLAGS += $(PLATFORM_LDFLAGS)
LDFLAGS_FINAL += -Bstatic
+
+export PLATFORM_CPPFLAGS
+export RELFLAGS
+export LDFLAGS_FINAL
+export CONFIG_STANDALONE_LOAD_ADDR
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 5b227cd..7e0e5b7 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -44,9 +44,8 @@ gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
# relocatable executable. The relocation data is not needed, and
# also causes the entry point of the standalone application to be
# inconsistent.
-ifeq ($(ARCH),powerpc)
-# FIX ME
-CPPFLAGS := $(filter-out $(RELFLAGS), $(CPPFLAGS))
+ifeq ($(CONFIG_PPC),y)
+PLATFORM_CPPFLAGS := $(filter-out $(RELFLAGS),$(PLATFORM_CPPFLAGS))
endif
# We don't want gcc reordering functions if possible. This ensures that an
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 59361f4..36346fd 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -55,11 +55,6 @@ endif
include scripts/Kbuild.include
-# Added for U-Boot
-# We must include config.mk after Kbuild.include
-# so that some config.mk can use cc-option.
-include config.mk
-
# For backward compatibility check that these variables do not change
save-cflags := $(CFLAGS)
@@ -68,6 +63,11 @@ kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
include $(kbuild-file)
+# Added for U-Boot
+asflags-y += $(PLATFORM_CPPFLAGS)
+ccflags-y += $(PLATFORM_CPPFLAGS)
+cppflags-y += $(PLATFORM_CPPFLAGS)
+
# If the save-* variables changed error out
ifeq ($(KBUILD_NOPEDANTIC),)
ifneq ("$(save-cflags)","$(CFLAGS)")
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 02b17b1..d568fde 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -101,13 +101,12 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
modname_flags = $(if $(filter 1,$(words $(modname))),\
-D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
-# U-Boot also uses $(CPPFLAGS)
-orig_c_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
+orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
$(ccflags-y) $(CFLAGS_$(basetarget).o)
_c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
-_a_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
+_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
$(asflags-y) $(AFLAGS_$(basetarget).o)
-_cpp_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
+_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
#
# Enable gcov profiling flags for a file, directory or for all files depending
diff --git a/spl/Makefile b/spl/Makefile
index e1a0601..bb3d349 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -29,10 +29,6 @@ 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
@@ -50,8 +46,14 @@ endif
include $(TOPDIR)/config.mk
+# Enable garbage collection of un-used sections for SPL
+KBUILD_CFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS_FINAL += --gc-sections
+
# FIX ME
-c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
+cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
+ $(NOSTDINC_FLAGS)
+c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
quiet_cmd_autoconf = GEN $@
@@ -228,9 +230,6 @@ PHONY += $(u-boot-spl-dirs)
$(u-boot-spl-dirs):
$(Q)$(MAKE) $(build)=$@
-# FIX ME
-cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
-
quiet_cmd_cpp_lds = LDS $@
cmd_cpp_lds = $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ \
-x assembler-with-cpp -P -o $@ $<