fegraw
Posts: 1
Joined: Tue Apr 30, 2013 2:23 pm

Hard Float Setting for Building Linux Kernel

Tue Apr 30, 2013 3:30 pm

Hi,

I'm trying to use buildroot (2013.02) to build a custom system for my RPi.
But I've meet some problem while building the kernel.
It shows the following error messages:
WRAP arch/arm/include/generated/asm/sections.h
WRAP arch/arm/include/generated/asm/siginfo.h
WRAP arch/arm/include/generated/asm/sizes.h
HOSTCC scripts/kallsyms
HOSTCC scripts/pnmtologo
HOSTCC scripts/genksyms/genksyms.o
CC scripts/mod/empty.o
arm-bcm2708hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and -mfloat-abi=hard may not be used together
make[3]: *** [scripts/mod/empty.o] Error 1
make[2]: *** [scripts/mod] Error 2
make[2]: *** Waiting for unfinished jobs....
SHIPPED scripts/genksyms/lex.lex.c
SHIPPED scripts/genksyms/keywords.hash.c
SHIPPED scripts/genksyms/parse.tab.h
SHIPPED scripts/genksyms/parse.tab.c
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
HOSTCC scripts/genksyms/lex.lex.o
HOSTCC scripts/genksyms/parse.tab.o
Generating include/generated/mach-types.h
CC kernel/bounds.s
arm-bcm2708hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and -mfloat-abi=hard may not be used together
make[2]: *** [kernel/bounds.s] Error 1
make[1]: *** [prepare0] Error 2
make[1]: *** Waiting for unfinished jobs....
HOSTLD scripts/genksyms/genksyms
make[1]: *** [scripts] Error 2


It seems that it is caused by the Makefile which is located at rpi-3.6.y/arch/arm/Makefile:
KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float

As mentioned above, these two settings use "-msoft-float" which conflicts my build root setting:
BR2_TARGET_OPTIMIZATION="-O3 -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s"

Besides, I've found a patch on Internet:
http://svn.stmlabs.com/svn/raspbmc/patc ... rdfp.patch

So, does it mean that if I remove the "-mfloat-abi=hard" for compiler option, then my system won't be able to utilize the hard float, right?
And if removing the "-msoft-float" is a solution, then why this patch doesn't show up in the RPi linux source tree/patch?

The toolchain is fetched from RPi github:
https://github.com/raspberrypi/tools/tr ... ux-gnueabi

The kernel sources is rpi-3.6.y:
https://github.com/raspberrypi/linux

Thanks in advance!

phiren
Posts: 5
Joined: Tue Jun 26, 2012 1:14 pm

Re: Hard Float Setting for Building Linux Kernel

Tue Apr 01, 2014 11:21 pm

I ran across this problem, myself.

You probably don't care by now, but I'm replying so that anyone else who stumbles across this doesn't have to research it themselves.

The linux kernel doesn't use any floating point code internally, so removing the -mfloat-soft flags from the makefiles will have no-effect on compilation. That flag is there so that if anyone was to add code to the kernel which used floating point, it would fail with a linker error, rather than silently trashing userspace's floating point registers.

The more correct answer is to build/use a multilib toolchain.

Return to “Other”