[U-Boot] [PATCH 2/2] change the way of build little endian board

add CONFIG_CPU_LITTLE_ENDIAN to little endian board config. use -dumpmachine to check if the cross compile.
Signed-off-by: Xiangfu Liu xiangfu@openmobilefree.net Acked-by: Shinya Kuribayashi skuribay@pobox.com
--- Makefile | 1 + arch/mips/config.mk | 27 +++++++++++++++++++++++++-- arch/mips/cpu/config.mk | 8 -------- include/configs/pb1x00.h | 2 ++ 4 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index 451ccdd..47b5622 100644 --- a/Makefile +++ b/Makefile @@ -2306,6 +2306,7 @@ dbau1550_config : unconfig dbau1550_el_config : unconfig @mkdir -p $(obj)include @echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h + @echo "#define CONFIG_CPU_LITTLE_ENDIAN" >>$(obj)include/config.h @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
gth2_config : unconfig diff --git a/arch/mips/config.mk b/arch/mips/config.mk index aa06761..f5d9ac5 100644 --- a/arch/mips/config.mk +++ b/arch/mips/config.mk @@ -23,8 +23,6 @@
CROSS_COMPILE ?= mips_4KC-
-STANDALONE_LOAD_ADDR = 0x80200000 -T mips.lds - PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
# @@ -50,3 +48,28 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__ PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic PLATFORM_CPPFLAGS += -msoft-float PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib + +# +# We explicitly add the endianness specifier if needed, this allows +# to compile kernels with a toolchain for the other endianness. We +# carefully avoid to add it redundantly because gcc 3.3/3.4 complains +# when fed the toolchain default! +# +# Certain gcc versions upto gcc 4.1.1 (probably 4.2-subversion as of +# 2006-10-10 don't properly change the predefined symbols if -EB / -EL +# are used, so we kludge that here. A bug has been filed at +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413. +# +UNDEF_ALL += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ +UNDEF_ALL += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ +PREDEF_BE += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ +PREDEF_LE += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ +ifdef CONFIG_CPU_LITTLE_ENDIAN +PLATFORM_CPPFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(UNDEF_ALL) $(PREDEF_LE)) +PLATFORM_LDFLAGS += -EL +else +PLATFORM_CPPFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(UNDEF_ALL) $(PREDEF_BE)) +PLATFORM_LDFLAGS += -EB +endif + +STANDALONE_LOAD_ADDR = 0x80200000 -T mips.lds $(PLATFORM_LDFLAGS) diff --git a/arch/mips/cpu/config.mk b/arch/mips/cpu/config.mk index a173c54..098d6c7 100644 --- a/arch/mips/cpu/config.mk +++ b/arch/mips/cpu/config.mk @@ -28,12 +28,4 @@ else \ echo "-march=4kc -mtune=4kc"; \ fi)
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) -ENDIANNESS = -EL -else -ENDIANNESS = -EB -endif - -MIPSFLAGS += $(ENDIANNESS) - PLATFORM_CPPFLAGS += $(MIPSFLAGS) diff --git a/include/configs/pb1x00.h b/include/configs/pb1x00.h index 5ad745e..49ca07c 100644 --- a/include/configs/pb1x00.h +++ b/include/configs/pb1x00.h @@ -28,6 +28,8 @@ #ifndef __CONFIG_H #define __CONFIG_H
+#define CONFIG_CPU_LITTLE_ENDIAN + #define CONFIG_MIPS32 1 /* MIPS32 CPU core */ #define CONFIG_PB1X00 1 #define CONFIG_SOC_AU1X00 1 /* alchemy series cpu */

On Mon, Aug 9, 2010 at 11:13 AM, xiangfu@openmobilefree.net wrote:
add CONFIG_CPU_LITTLE_ENDIAN to little endian board config. use -dumpmachine to check if the cross compile.
Makefile | 1 + arch/mips/config.mk | 27 +++++++++++++++++++++++++-- arch/mips/cpu/config.mk | 8 -------- include/configs/pb1x00.h | 2 ++
since this is a mips-specific issue, please prefix your summaries accordingly. so the subject should be something like: mips: change the way of build little endian board
that way non-mips people can easily ignore this e-mail -mike

On 08/10/2010 01:10 AM, Mike Frysinger wrote:
On Mon, Aug 9, 2010 at 11:13 AM,xiangfu@openmobilefree.net wrote:
add CONFIG_CPU_LITTLE_ENDIAN to little endian board config. use -dumpmachine to check if the cross compile.
Makefile | 1 + arch/mips/config.mk | 27 +++++++++++++++++++++++++-- arch/mips/cpu/config.mk | 8 -------- include/configs/pb1x00.h | 2 ++
since this is a mips-specific issue, please prefix your summaries accordingly. so the subject should be something like: mips: change the way of build little endian board
that way non-mips people can easily ignore this e-mail -mike
Hi Mike
thanks for the advice. I will do that next time.
participants (3)
-
Mike Frysinger
-
Xiangfu Liu
-
xiangfu@openmobilefree.net