[U-Boot] [PATCH 1/2 V2] mips: add endianness support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat May 23 17:19:46 CEST 2009


On 00:24 Sun 24 May     , Shinya Kuribayashi wrote:
> Hi,
>
> Jean-Christophe PLAGNIOL-VILLARD wrote:
>> curently we need to specify the endian of each board in the LDS
>>
>> in order to unify all of them add full endianness support
>>
>> by default the mips platforms will be compiled as big-endian
>> to compile it as little-endian define CONFIG_CPU_LITTLE_ENDIAN
>>
>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
>> ---
>>  Makefile                   |    2 ++
>>  board/dbau1x00/u-boot.lds  |    5 +----
>>  board/gth2/u-boot.lds      |    5 +----
>>  board/incaip/u-boot.lds    |    5 +----
>>  board/pb1x00/u-boot.lds    |    5 +----
>>  board/purple/u-boot.lds    |    5 +----
>>  board/qemu-mips/u-boot.lds |    5 +----
>>  board/tb0229/u-boot.lds    |    3 +--
>>  cpu/mips/config.mk         |    9 ---------
>>  examples/Makefile          |    1 +
>>  examples/mips.lds          |    5 +----
>>  mips_config.mk             |   25 +++++++++++++++++++++++++
>>  12 files changed, 36 insertions(+), 39 deletions(-)
>
> [snip]
>
>> diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk
>> index a173c54..928b7d8 100644
>> --- a/cpu/mips/config.mk
>> +++ b/cpu/mips/config.mk
>> @@ -28,12 +28,3 @@ else \
>>  	echo "-march=4kc -mtune=4kc"; \
>>  fi)
>>  -ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
>> -ENDIANNESS = -EL
>> -else
>> -ENDIANNESS = -EB
>> -endif
>> -
>> -MIPSFLAGS += $(ENDIANNESS)
>
> This is ok, but
>
>> -
>> -PLATFORM_CPPFLAGS += $(MIPSFLAGS)
>
> I think this wrongly removes -march=4kc -mtune=4kc.
I miss this
>
>> diff --git a/mips_config.mk b/mips_config.mk
>> index 05eb05d..423e216 100644
>> --- a/mips_config.mk
>> +++ b/mips_config.mk
>> @@ -46,3 +46,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
>
> Thanks for resubmitting, but there's one thing I'm warried about.
> when I gave it a try last time, with almost the same patch you did,
> I had a GNU make problem.  I'll look closely into it, so please
> wait for some time.
which one?

Best Regards,
J.


More information about the U-Boot mailing list