Discussion:
[OpenWrt-Devel] [hard floating point]
Alberich de megres
2013-02-17 13:26:23 UTC
Permalink
Hello,

I'm trying to compile openwrt for an ARM using an external toolchain with
hardfp.

When openwrt buildroot is compiling the kernel, at the oldconfig prepare
scripts i'm getting this error:

arm-hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and -mfloat-abi=hard
may not be used together

In the openwrt menuconfig,
In advanced (developers ) -> target options -> use softhp is disabled
with this flags (for both: TARGET_OPTIMIZATION,
DEFAULT_TARGET_OPTIMIZATION):
-O2 -pipe -mfloat-abi=hard -mfpu=vfp

Also I checked the kernel_menuconfig for FPU, which is enabled.

At some point the -mfloat-abi=soft compiler flags is added to the flags,
but I could not find where is it added. fgrep for mfloat-abi=soft or
msoft-float didn't show anything relevant.

Can anyone help me?

thanks!
Alberich
Florian Fainelli
2013-02-17 13:32:23 UTC
Permalink
Hello Alberich,
Post by Alberich de megres
Hello,
I'm trying to compile openwrt for an ARM using an external toolchain
with hardfp.
When openwrt buildroot is compiling the kernel, at the oldconfig prepare
arm-hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and
-mfloat-abi=hard may not be used together
In the openwrt menuconfig,
In advanced (developers ) -> target options -> use softhp is disabled
with this flags (for both: TARGET_OPTIMIZATION,
-O2 -pipe -mfloat-abi=hard -mfpu=vfp
Also I checked the kernel_menuconfig for FPU, which is enabled.
At some point the -mfloat-abi=soft compiler flags is added to the flags,
but I could not find where is it added. fgrep for mfloat-abi=soft or
msoft-float didn't show anything relevant.
Can anyone help me?
This is specifically passed to the GCC configure script here:
https://dev.openwrt.org/browser/trunk/toolchain/gcc/common.mk#L125

you can disable the use of software floating point for your binaries
from here: https://dev.openwrt.org/browser/trunk/Config.in#L670

software floating point is enabled by default for ARM little and big
endian toolchains. Alternatively you can set the "fpu" feature flag in
your target Makefile in target/linux/<target>/Makefile if you want to
disable software floating point for your specific target/platform.
--
Florian
Alberich de megres
2013-02-17 14:16:14 UTC
Permalink
This post might be inappropriate. Click to display it.
Alberich de megres
2013-02-18 09:21:08 UTC
Permalink
Hello Again,

And sorry to insist.
Editing the KBUILD_CFLAGS and KBUILD_AFLAGS from the
build_dir/linux-arm/linux/arch/arm/Makefile and removing the -msoft-float I
can bypass the error.

My I happiness did not last any longer.. as I'm getting this next error:
arm-hardfp-linux-gnueabi-ld: unrecognised emulation mode:
uclibc
Supported emulations: armelf_linux_eabi armelfb_linux_eabi

If I try to compile the same kernel tree (which is in a local git repo),
with the toolchain (based on glibc) I can do it with no problems (also
without the -mfloat-abi=soft and -mfloat-abi=hard error). Also using a demo
.c and manually passing the -muclibc to the gcc compiler I'm able to
compile it with any complains from the compiler.

When using an external toolchain, openwrt asked me for a file in
include/site/arm-hardfp-linux-gnueabi. I created one as a clone of the
arm-openwrt-linux-gnueabi.

I think I'm missing something. Can anyone helpme?

thanks!


On Sun, Feb 17, 2013 at 3:16 PM, Alberich de megres
Post by Alberich de megres
Hello Florian,
Thanks for your quick reply.
I had the fpu feature for my target Makefile, and Also I disabled the
SOFT_FLOAT.
Also, I did a quick hack into rules.mk to ensure msoft-float is never
activated,
ifeq ($(CONFIG_SOFT_FLOAT),y)
# SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
# TARGET_CFLAGS+= -msoft-float
SOFT_FLOAT_CONFIG_OPTION:=
else
SOFT_FLOAT_CONFIG_OPTION:=
endif
But i'm still getting the same error.
Maybe am I looking at the wrong place?
Thanks once again,
Alberich
Post by Florian Fainelli
Hello Alberich,
Hello,
Post by Alberich de megres
I'm trying to compile openwrt for an ARM using an external toolchain
with hardfp.
When openwrt buildroot is compiling the kernel, at the oldconfig prepare
arm-hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and
-mfloat-abi=hard may not be used together
In the openwrt menuconfig,
In advanced (developers ) -> target options -> use softhp is disabled
with this flags (for both: TARGET_OPTIMIZATION,
-O2 -pipe -mfloat-abi=hard -mfpu=vfp
Also I checked the kernel_menuconfig for FPU, which is enabled.
At some point the -mfloat-abi=soft compiler flags is added to the flags,
but I could not find where is it added. fgrep for mfloat-abi=soft or
msoft-float didn't show anything relevant.
Can anyone help me?
https://dev.openwrt.org/**browser/trunk/toolchain/gcc/**common.mk#L125<https://dev.openwrt.org/browser/trunk/toolchain/gcc/common.mk#L125>
you can disable the use of software floating point for your binaries from
here: https://dev.openwrt.org/**browser/trunk/Config.in#L670<https://dev.openwrt.org/browser/trunk/Config.in#L670>
software floating point is enabled by default for ARM little and big
endian toolchains. Alternatively you can set the "fpu" feature flag in your
target Makefile in target/linux/<target>/Makefile if you want to disable
software floating point for your specific target/platform.
--
Florian
Florian Fainelli
2013-02-18 09:46:16 UTC
Permalink
Hello,
Post by Alberich de megres
Hello Again,
And sorry to insist.
Editing the KBUILD_CFLAGS and KBUILD_AFLAGS from the
build_dir/linux-arm/linux/arch/arm/Makefile and removing the
-msoft-float I can bypass the error.
This does not sound right, the kernel must be compiled with software
floating point, I assume this is because we do not want the kernel to
trap itself by making it use hardware floating point and attempt to
emulate this. The real fix would be to filter out the floating-point
related CFLAGS that are being passed to the Linux kernel build system by
OpenWrt, I will reproduce your issue and fix this.
Post by Alberich de megres
arm-hardfp-linux-gnueabi-ld: unrecognised emulation mode: uclibc
Supported emulations: armelf_linux_eabi armelfb_linux_eabi
If I try to compile the same kernel tree (which is in a local git repo),
with the toolchain (based on glibc) I can do it with no problems (also
without the -mfloat-abi=soft and -mfloat-abi=hard error). Also using a
demo .c and manually passing the -muclibc to the gcc compiler I'm able
to compile it with any complains from the compiler.
An user-space application can select the floating point implementation
at will, this is not the case for the kernel so your example here just
works because your toolchain is properly configured and will not attempt
to override the kernel floating-point CFLAGS.
Post by Alberich de megres
When using an external toolchain, openwrt asked me for a file in
include/site/arm-hardfp-linux-gnueabi. I created one as a clone of the
arm-openwrt-linux-gnueabi.
I think I'm missing something. Can anyone helpme?
thanks!
On Sun, Feb 17, 2013 at 3:16 PM, Alberich de megres
Hello Florian,
Thanks for your quick reply.
I had the fpu feature for my target Makefile, and Also I disabled
the SOFT_FLOAT.
Also, I did a quick hack into rules.mk <http://rules.mk> to ensure
msoft-float is never activated,
ifeq ($(CONFIG_SOFT_FLOAT),y)
# SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
# TARGET_CFLAGS+= -msoft-float
SOFT_FLOAT_CONFIG_OPTION:=
else
SOFT_FLOAT_CONFIG_OPTION:=
endif
But i'm still getting the same error.
Maybe am I looking at the wrong place?
Thanks once again,
Alberich
On Sun, Feb 17, 2013 at 2:32 PM, Florian Fainelli
Hello Alberich,
Hello,
I'm trying to compile openwrt for an ARM using an external
toolchain
with hardfp.
When openwrt buildroot is compiling the kernel, at the
oldconfig prepare
arm-hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and
-mfloat-abi=hard may not be used together
In the openwrt menuconfig,
In advanced (developers ) -> target options -> use softhp is
disabled
with this flags (for both: TARGET_OPTIMIZATION,
-O2 -pipe -mfloat-abi=hard -mfpu=vfp
Also I checked the kernel_menuconfig for FPU, which is enabled.
At some point the -mfloat-abi=soft compiler flags is added
to the flags,
but I could not find where is it added. fgrep for
mfloat-abi=soft or
msoft-float didn't show anything relevant.
Can anyone help me?
https://dev.openwrt.org/__browser/trunk/toolchain/gcc/__common.mk#L125
<https://dev.openwrt.org/browser/trunk/toolchain/gcc/common.mk#L125>
you can disable the use of software floating point for your
https://dev.openwrt.org/__browser/trunk/Config.in#L670
<https://dev.openwrt.org/browser/trunk/Config.in#L670>
software floating point is enabled by default for ARM little and
big endian toolchains. Alternatively you can set the "fpu"
feature flag in your target Makefile in
target/linux/<target>/Makefile if you want to disable software
floating point for your specific target/platform.
--
Florian
Alberich de megres
2013-02-18 09:59:02 UTC
Permalink
Hello,

Thanks for the quick reply :)
Post by Alberich de megres
Hello,
Post by Alberich de megres
Hello Again,
And sorry to insist.
Editing the KBUILD_CFLAGS and KBUILD_AFLAGS from the
build_dir/linux-arm/linux/**arch/arm/Makefile and removing the
-msoft-float I can bypass the error.
This does not sound right, the kernel must be compiled with software
floating point, I assume this is because we do not want the kernel to trap
itself by making it use hardware floating point and attempt to emulate
this. The real fix would be to filter out the floating-point related CFLAGS
that are being passed to the Linux kernel build system by OpenWrt, I will
reproduce your issue and fix this.
in my target/linux/arm-hardfp/Makefile I'm using CLFAGS which contains
-mhard-soft and vfp.
Where this should be filtered? If you want I can give a try.
Post by Alberich de megres
Post by Alberich de megres
arm-hardfp-linux-gnueabi-ld: unrecognised emulation mode: uclibc
Supported emulations: armelf_linux_eabi armelfb_linux_eabi
If I try to compile the same kernel tree (which is in a local git repo),
with the toolchain (based on glibc) I can do it with no problems (also
without the -mfloat-abi=soft and -mfloat-abi=hard error). Also using a
demo .c and manually passing the -muclibc to the gcc compiler I'm able
to compile it with any complains from the compiler.
An user-space application can select the floating point implementation at
will, this is not the case for the kernel so your example here just works
because your toolchain is properly configured and will not attempt to
override the kernel floating-point CFLAGS.
Now I understand, thanks :)
Post by Alberich de megres
Post by Alberich de megres
When using an external toolchain, openwrt asked me for a file in
include/site/arm-hardfp-linux-**gnueabi. I created one as a clone of the
arm-openwrt-linux-gnueabi.
I think I'm missing something. Can anyone helpme?
thanks!
On Sun, Feb 17, 2013 at 3:16 PM, Alberich de megres
Hello Florian,
Thanks for your quick reply.
I had the fpu feature for my target Makefile, and Also I disabled
the SOFT_FLOAT.
Also, I did a quick hack into rules.mk <http://rules.mk> to ensure
msoft-float is never activated,
ifeq ($(CONFIG_SOFT_FLOAT),y)
# SOFT_FLOAT_CONFIG_OPTION:=--**with-float=soft
# TARGET_CFLAGS+= -msoft-float
SOFT_FLOAT_CONFIG_OPTION:=
else
SOFT_FLOAT_CONFIG_OPTION:=
endif
But i'm still getting the same error.
Maybe am I looking at the wrong place?
Thanks once again,
Alberich
On Sun, Feb 17, 2013 at 2:32 PM, Florian Fainelli
Hello Alberich,
Hello,
I'm trying to compile openwrt for an ARM using an external
toolchain
with hardfp.
When openwrt buildroot is compiling the kernel, at the
oldconfig prepare
arm-hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and
-mfloat-abi=hard may not be used together
In the openwrt menuconfig,
In advanced (developers ) -> target options -> use softhp is
disabled
with this flags (for both: TARGET_OPTIMIZATION,
-O2 -pipe -mfloat-abi=hard -mfpu=vfp
Also I checked the kernel_menuconfig for FPU, which is enabled.
At some point the -mfloat-abi=soft compiler flags is added
to the flags,
but I could not find where is it added. fgrep for
mfloat-abi=soft or
msoft-float didn't show anything relevant.
Can anyone help me?
https://dev.openwrt.org/__**browser/trunk/toolchain/gcc/__**
common.mk#L125<https://dev.openwrt.org/__browser/trunk/toolchain/gcc/__common.mk#L125>
<https://dev.openwrt.org/**browser/trunk/toolchain/gcc/**
common.mk#L125<https://dev.openwrt.org/browser/trunk/toolchain/gcc/common.mk#L125>
you can disable the use of software floating point for your
https://dev.openwrt.org/__**browser/trunk/Config.in#L670<https://dev.openwrt.org/__browser/trunk/Config.in#L670>
<https://dev.openwrt.org/**browser/trunk/Config.in#L670<https://dev.openwrt.org/browser/trunk/Config.in#L670>
software floating point is enabled by default for ARM little and
big endian toolchains. Alternatively you can set the "fpu"
feature flag in your target Makefile in
target/linux/<target>/Makefile if you want to disable software
floating point for your specific target/platform.
--
Florian
Alberich de megres
2013-02-18 20:20:37 UTC
Permalink
Hello again,

I was looking on how the kernel build works.
All error happened when building the kernel at: oldconfig prepare scripts,
and modules. The first one is defined into the include/kernel-defaults.mk,
which is called in this line (inside Kernel/Configure/Default define):

$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts

I can edit the KERNEL_MAKEOPTS variable to pass KBUILD_CFLAGS="" (for
example), but I'm will be overwriting an internal kernel Makefile variable.
How openwrt passes the CFLAGS to the kernel?

I tried the KBUILD_CFLAGS way (I also tried to include a CFLAGS="" into
KERNEL_MAKEOPTS, with no result), but I got a new different error (I think
due to I overwrote the flags). Is there some export? are the flags stored
at some place?

Thanks in advance

I'm including the output


export MAKEFLAGS= ;make -C
/home/projects/con/delme/openwrt/build_dir/linux-hardfp/linux-3.6
CROSS_COMPILE="arm-hardfp-linux-gnueabi-" ARCH="arm" KBUILD_HAVE_NLS=no
CONFIG_SHELL="/usr/local/bin/bash" KBUILD_CFLAGS="-O2 -pipe -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk" CC="arm-hardfp-linux-gnueabi-gcc"
oldconfig prepare scripts
make[5]: Entering directory `/home/projects/con/rp-kernel'
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[7]: `include/generated/mach-types.h' is up to date.
CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/time.h:9:0,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/math64.h: In function 'div_u64_rem':
include/linux/math64.h:55:15: error: '__LINUX_ARM_ARCH__' undeclared (first
use in this function)
include/linux/math64.h:55:15: note: each undeclared identifier is reported
only once for each function it appears in
make[7]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make[6]: *** [prepare0] Error 2
make[5]: *** [prepare] Error 2
make[5]: Leaving directory `/home/projects/con/rp-kernel'
make[4]:
[/home/projects/con/delme/openwrt/build_dir/linux-harfp/linux-3.6/.configured]
Error 2 (ignored)



Alberich


On Mon, Feb 18, 2013 at 10:59 AM, Alberich de megres
Post by Alberich de megres
Hello,
Thanks for the quick reply :)
Post by Alberich de megres
Hello,
Post by Alberich de megres
Hello Again,
And sorry to insist.
Editing the KBUILD_CFLAGS and KBUILD_AFLAGS from the
build_dir/linux-arm/linux/**arch/arm/Makefile and removing the
-msoft-float I can bypass the error.
This does not sound right, the kernel must be compiled with software
floating point, I assume this is because we do not want the kernel to trap
itself by making it use hardware floating point and attempt to emulate
this. The real fix would be to filter out the floating-point related CFLAGS
that are being passed to the Linux kernel build system by OpenWrt, I will
reproduce your issue and fix this.
in my target/linux/arm-hardfp/Makefile I'm using CLFAGS which contains
-mhard-soft and vfp.
Where this should be filtered? If you want I can give a try.
Post by Alberich de megres
Post by Alberich de megres
arm-hardfp-linux-gnueabi-ld: unrecognised emulation mode: uclibc
Supported emulations: armelf_linux_eabi armelfb_linux_eabi
If I try to compile the same kernel tree (which is in a local git repo),
with the toolchain (based on glibc) I can do it with no problems (also
without the -mfloat-abi=soft and -mfloat-abi=hard error). Also using a
demo .c and manually passing the -muclibc to the gcc compiler I'm able
to compile it with any complains from the compiler.
An user-space application can select the floating point implementation at
will, this is not the case for the kernel so your example here just works
because your toolchain is properly configured and will not attempt to
override the kernel floating-point CFLAGS.
Now I understand, thanks :)
Post by Alberich de megres
Post by Alberich de megres
When using an external toolchain, openwrt asked me for a file in
include/site/arm-hardfp-linux-**gnueabi. I created one as a clone of the
arm-openwrt-linux-gnueabi.
I think I'm missing something. Can anyone helpme?
thanks!
On Sun, Feb 17, 2013 at 3:16 PM, Alberich de megres
Hello Florian,
Thanks for your quick reply.
I had the fpu feature for my target Makefile, and Also I disabled
the SOFT_FLOAT.
Also, I did a quick hack into rules.mk <http://rules.mk> to ensure
msoft-float is never activated,
ifeq ($(CONFIG_SOFT_FLOAT),y)
# SOFT_FLOAT_CONFIG_OPTION:=--**with-float=soft
# TARGET_CFLAGS+= -msoft-float
SOFT_FLOAT_CONFIG_OPTION:=
else
SOFT_FLOAT_CONFIG_OPTION:=
endif
But i'm still getting the same error.
Maybe am I looking at the wrong place?
Thanks once again,
Alberich
On Sun, Feb 17, 2013 at 2:32 PM, Florian Fainelli
Hello Alberich,
Hello,
I'm trying to compile openwrt for an ARM using an external
toolchain
with hardfp.
When openwrt buildroot is compiling the kernel, at the
oldconfig prepare
arm-hardfp-linux-gnueabi-gcc: error: -mfloat-abi=soft and
-mfloat-abi=hard may not be used together
In the openwrt menuconfig,
In advanced (developers ) -> target options -> use softhp is
disabled
with this flags (for both: TARGET_OPTIMIZATION,
-O2 -pipe -mfloat-abi=hard -mfpu=vfp
Also I checked the kernel_menuconfig for FPU, which is enabled.
At some point the -mfloat-abi=soft compiler flags is added
to the flags,
but I could not find where is it added. fgrep for
mfloat-abi=soft or
msoft-float didn't show anything relevant.
Can anyone help me?
https://dev.openwrt.org/__**browser/trunk/toolchain/gcc/__**
common.mk#L125<https://dev.openwrt.org/__browser/trunk/toolchain/gcc/__common.mk#L125>
<https://dev.openwrt.org/**browser/trunk/toolchain/gcc/**
common.mk#L125<https://dev.openwrt.org/browser/trunk/toolchain/gcc/common.mk#L125>
you can disable the use of software floating point for your
https://dev.openwrt.org/__**browser/trunk/Config.in#L670<https://dev.openwrt.org/__browser/trunk/Config.in#L670>
<https://dev.openwrt.org/**browser/trunk/Config.in#L670<https://dev.openwrt.org/browser/trunk/Config.in#L670>
software floating point is enabled by default for ARM little and
big endian toolchains. Alternatively you can set the "fpu"
feature flag in your target Makefile in
target/linux/<target>/Makefile if you want to disable software
floating point for your specific target/platform.
--
Florian
Alberich de megres
2013-02-19 11:14:50 UTC
Permalink
Hello again,

And sorry to insist, but I need this to work. Can anyone help me?

Thanks in advance
Post by Alberich de megres
Hello again,
I was looking on how the kernel build works.
All error happened when building the kernel at: oldconfig prepare
scripts, and modules. The first one is defined into the include/
kernel-defaults.mk, which is called in this line (inside
Post by Alberich de megres
$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
I can edit the KERNEL_MAKEOPTS variable to pass KBUILD_CFLAGS="" (for
example), but I'm will be overwriting an internal kernel Makefile variable.
How openwrt passes the CFLAGS to the kernel?
Post by Alberich de megres
I tried the KBUILD_CFLAGS way (I also tried to include a CFLAGS="" into
KERNEL_MAKEOPTS, with no result), but I got a new different error (I think
due to I overwrote the flags). Is there some export? are the flags stored
at some place?
Post by Alberich de megres
Thanks in advance
I'm including the output
export MAKEFLAGS= ;make -C
/home/projects/con/delme/openwrt/build_dir/linux-hardfp/linux-3.6
CROSS_COMPILE="arm-hardfp-linux-gnueabi-" ARCH="arm" KBUILD_HAVE_NLS=no
CONFIG_SHELL="/usr/local/bin/bash" KBUILD_CFLAGS="-O2 -pipe -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk" CC="arm-hardfp-linux-gnueabi-gcc"
oldconfig prepare scripts
Post by Alberich de megres
make[5]: Entering directory `/home/projects/con/rp-kernel'
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[7]: `include/generated/mach-types.h' is up to date.
CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/time.h:9:0,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
include/linux/math64.h:55:15: error: '__LINUX_ARM_ARCH__' undeclared
(first use in this function)
Post by Alberich de megres
include/linux/math64.h:55:15: note: each undeclared identifier is
reported only once for each function it appears in
Post by Alberich de megres
make[7]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make[6]: *** [prepare0] Error 2
make[5]: *** [prepare] Error 2
make[5]: Leaving directory `/home/projects/con/rp-kernel'
[/home/projects/con/delme/openwrt/build_dir/linux-harfp/linux-3.6/.configured]
Error 2 (ignored)
Post by Alberich de megres
Alberich
On Mon, Feb 18, 2013 at 10:59 AM, Alberich de megres <
Hello,
Thanks for the quick reply :)
Hello,
Hello Again,
And sorry to insist.
Editing the KBUILD_CFLAGS and KBUILD_AFLAGS from the
build_dir/linux-arm/linux/arch/arm/Makefile and removing the
-msoft-float I can bypass the error.
This does not sound right, the kernel must be compiled with software
floating point, I assume this is because we do not want the kernel to trap
itself by making it use hardware floating point and attempt to emulate
this. The real fix would be to filter out the floating-point related CFLAGS
that are being passed to the Linux kernel build system by OpenWrt, I will
reproduce your issue and fix this.
Post by Alberich de megres
in my target/linux/arm-hardfp/Makefile I'm using CLFAGS which contains
-mhard-soft and vfp.
Post by Alberich de megres
Where this should be filtered? If you want I can give a try.
arm-hardfp-linux-gnueabi-ld: unrecognised emulation mode: uclibc
Supported emulations: armelf_linux_eabi armelfb_linux_eabi
If I try to compile the same kernel tree (which is in a local git repo),
with the toolchain (based on glibc) I can do it with no problems (also
without the -mfloat-abi=soft and -mfloat-abi=hard error). Also using a
demo .c and manually passing the -muclibc to the gcc compiler I'm able
to compile it with any complains from the compiler.
An user-space application can select the floating point implementation at
will, this is not the case for the kernel so your example here just works
because your toolchain is properly configured and will not attempt to
override the kernel floating-point CFLAGS.
Post by Alberich de megres
Now I understand, thanks :)
When using an external toolchain, openwrt asked me for a file in
include/site/arm-hardfp-linux-gnueabi. I created one as a clone of the
arm-openwrt-linux-gnueabi.
I think I'm missing something. Can anyone helpme?
thanks!
On Sun, Feb 17, 2013 at 3:16 PM, Alberich de megres
Hello Florian,
Thanks for your quick reply.
I had the fpu feature for my target Makefile, and Also I disabled
the SOFT_FLOAT.
Also, I did a quick hack into rules.mk <http://rules.mk> to ensure
msoft-float is never activated,
ifeq ($(CONFIG_SOFT_FLOAT),y)
# SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
# TARGET_CFLAGS+= -msoft-float
SOFT_FLOAT_CONFIG_OPTION:=
else
SOFT_FLOAT_CONFIG_OPTION:=
endif
But i'm still getting the same error.
Maybe am I looking at the wrong place?
Thanks once again,
Alberich
On Sun, Feb 17, 2013 at 2:32 PM, Florian Fainelli
Florian Fainelli
2013-02-19 13:50:13 UTC
Permalink
Hello,
Post by Alberich de megres
Hello again,
I was looking on how the kernel build works.
All error happened when building the kernel at: oldconfig prepare
scripts, and modules. The first one is defined into the
include/kernel-defaults.mk <http://kernel-defaults.mk>, which is called
$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
I can edit the KERNEL_MAKEOPTS variable to pass KBUILD_CFLAGS="" (for
example), but I'm will be overwriting an internal kernel Makefile
variable. How openwrt passes the CFLAGS to the kernel?
I tried the KBUILD_CFLAGS way (I also tried to include a CFLAGS="" into
KERNEL_MAKEOPTS, with no result), but I got a new different error (I
think due to I overwrote the flags). Is there some export? are the flags
stored at some place?
Thanks in advance
I'm including the output
export MAKEFLAGS= ;make -C
/home/projects/con/delme/openwrt/build_dir/linux-hardfp/linux-3.6
CROSS_COMPILE="arm-hardfp-linux-gnueabi-" ARCH="arm" KBUILD_HAVE_NLS=no
CONFIG_SHELL="/usr/local/bin/bash" KBUILD_CFLAGS="-O2 -pipe -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk" CC="arm-hardfp-linux-gnueabi-gcc"
oldconfig prepare scripts
make[5]: Entering directory `/home/projects/con/rp-kernel'
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[7]: `include/generated/mach-types.h' is up to date.
CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/time.h:9:0,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
include/linux/math64.h:55:15: error: '__LINUX_ARM_ARCH__' undeclared
(first use in this function)
include/linux/math64.h:55:15: note: each undeclared identifier is
reported only once for each function it appears in
It seems like overriding KBUILD_CFLAGS like you do prevents the internal
ARM kernel Makefile in arch/arm/Makefile to define $(arch-y) for your
specific platform, thus causing your build failure because
__LINUX_ARM_ARCH__ is not defined.

Having said that, if I do modify an ARM target to have the following CFLAGS:

CFLAGS:=-Mfloat-abit=hard -mfpu=vfp I can build OpenWrt which uses the
hardware floating point ABI. Can you summarize the list of changes that
you have made to your OpenWrt copy?
--
Florian
Alberich de megres
2013-02-19 15:06:11 UTC
Permalink
Hi FLorian,

The board contains a Broadcom SoC similar to the one in the raspberry pi
(not the same), we have a kernel working for it, but when tryingo to port
the openwrt all blowed up.

For the moment I did: (it is a work in progress)
Created target/linux/hardfp/Makefile
Created target/linux/hardfp/profiles/100-hardfp.mk
Added a valid .config named config-3.6 (copied it after configuring a
working kernel, tested).

100-hardfp contains the basic:
define Profile/Uber
NAME:=Uber
endef
define Profile/Uber/Description
Über Punkt
endef
$(eval $(call Profile,Uber))

target/linux/hardfp/Makefile contains:

include $(TOPDIR)/rules.mk

ARCH:=arm
BOARD:=Uber
BOARDNAME:=Uber

FEATURES:=usb ext4 fpu
LINUX_VERSION:=3.6
#CFLAGS:=-O2 -pipe -mfloat-abi=hard -mfpu=vfp -mtune=arm1176jzf-s
-march=armv6zk

MAINTAINER:=Uber Team

include $(INCLUDE_DIR)/target.mk

define Target/Description
TODO
endef

DEFAULT_PACKAGES += kmod-usb-hid
CFLAGS:=-mfloat-abi=hard -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk
#KBUILD_CFLAGS:=${CFLAGS}
#KBUILD_CFLAGS:=

KERNELNAME:="Image_ubp"

$(eval $(call BuildTarget))

------------------
After this, I'm using an external tool chain, and I'm pointing to an own
kernel git repo.
In the openwrt menuconfig, enables the Advanced configuration option

Enter git repo to clone: i'm using our own
target options
|-> target optimizations: -O2 -pipe -mfloat-abi=hard -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk

In Use external toolchain:
edited all options except the last 3 ( program path, toolchain include path
and library path)

---
After this, I tried to compile the openwrt to see if it was working. And
then all issues started.

Thanks for the support,
Alberich
Post by Alberich de megres
Hello,
Post by Alberich de megres
Hello again,
I was looking on how the kernel build works.
All error happened when building the kernel at: oldconfig prepare
scripts, and modules. The first one is defined into the
include/kernel-defaults.mk <http://kernel-defaults.mk>, which is called
$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
I can edit the KERNEL_MAKEOPTS variable to pass KBUILD_CFLAGS="" (for
example), but I'm will be overwriting an internal kernel Makefile
variable. How openwrt passes the CFLAGS to the kernel?
I tried the KBUILD_CFLAGS way (I also tried to include a CFLAGS="" into
KERNEL_MAKEOPTS, with no result), but I got a new different error (I
think due to I overwrote the flags). Is there some export? are the flags
stored at some place?
Thanks in advance
I'm including the output
export MAKEFLAGS= ;make -C
/home/projects/con/delme/**openwrt/build_dir/linux-**hardfp/linux-3.6
CROSS_COMPILE="arm-hardfp-**linux-gnueabi-" ARCH="arm" KBUILD_HAVE_NLS=no
CONFIG_SHELL="/usr/local/bin/**bash" KBUILD_CFLAGS="-O2 -pipe -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk" CC="arm-hardfp-linux-gnueabi-**gcc"
oldconfig prepare scripts
make[5]: Entering directory `/home/projects/con/rp-kernel'
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[7]: `include/generated/mach-types.**h' is up to date.
CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/time.h:9:0,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
include/linux/math64.h:55:15: error: '__LINUX_ARM_ARCH__' undeclared
(first use in this function)
include/linux/math64.h:55:15: note: each undeclared identifier is
reported only once for each function it appears in
It seems like overriding KBUILD_CFLAGS like you do prevents the internal
ARM kernel Makefile in arch/arm/Makefile to define $(arch-y) for your
specific platform, thus causing your build failure because
__LINUX_ARM_ARCH__ is not defined.
CFLAGS:=-Mfloat-abit=hard -mfpu=vfp I can build OpenWrt which uses the
hardware floating point ABI. Can you summarize the list of changes that you
have made to your OpenWrt copy?
--
Florian
Florian Fainelli
2013-02-20 10:47:57 UTC
Permalink
Hello Alberich,
Post by Alberich de megres
Hi FLorian,
The board contains a Broadcom SoC similar to the one in the raspberry pi
(not the same), we have a kernel working for it, but when tryingo to
port the openwrt all blowed up.
For the moment I did: (it is a work in progress)
Created target/linux/hardfp/Makefile
Created target/linux/hardfp/profiles/100-hardfp.mk <http://100-hardfp.mk>
Added a valid .config named config-3.6 (copied it after configuring a
[snip]
Post by Alberich de megres
DEFAULT_PACKAGES += kmod-usb-hid
CFLAGS:=-mfloat-abi=hard -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk
Ok this is good, I used basically the same CFLAGS on realview to test
building with a hard-float ABI in mind.
Post by Alberich de megres
#KBUILD_CFLAGS:=${CFLAGS}
#KBUILD_CFLAGS:=
KERNELNAME:="Image_ubp"
$(eval $(call BuildTarget))
------------------
After this, I'm using an external tool chain, and I'm pointing to an own
kernel git repo.
In the openwrt menuconfig, enables the Advanced configuration option
Enter git repo to clone: i'm using our own
target options
|-> target optimizations: -O2 -pipe -mfloat-abi=hard -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk
This is not strictly required but does not conflict with what you want
to do.
Post by Alberich de megres
edited all options except the last 3 ( program path, toolchain include
path and library path)
Ok, I think the issue is that you are actually using an external
toolchain while I am using the toolchain built by OpenWrt. Can you point
me at your toolchain (if public) so I can try to fix the issues? Is your
toolchain built to target uClibc as libc as well?

Thanks!
--
Florian
Alberich de megres
2013-02-20 13:46:04 UTC
Permalink
Hi Florian,

I think you are right: the point is the toolchain. At the moment we could
not release anything.
The toolchain targets a normal glibc, I was expecting buildroot would
interpert it, or at least give the oportunity to use different libc than
uclibc when using an external toolchain, as when building the toolchain
(using openwrt buildroot) one can choose between glibc, eglibc and uclibc.
Am I wrong?

thanks once again!
Post by Florian Fainelli
Hello Alberich,
Post by Alberich de megres
Hi FLorian,
The board contains a Broadcom SoC similar to the one in the raspberry pi
(not the same), we have a kernel working for it, but when tryingo to
port the openwrt all blowed up.
For the moment I did: (it is a work in progress)
Created target/linux/hardfp/Makefile
Created target/linux/hardfp/profiles/1**00-hardfp.mk<http://100-hardfp.mk><
http://100-hardfp.mk>
Added a valid .config named config-3.6 (copied it after configuring a
[snip]
Post by Alberich de megres
DEFAULT_PACKAGES += kmod-usb-hid
CFLAGS:=-mfloat-abi=hard -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk
Ok this is good, I used basically the same CFLAGS on realview to test
building with a hard-float ABI in mind.
#KBUILD_CFLAGS:=${CFLAGS}
Post by Alberich de megres
#KBUILD_CFLAGS:=
KERNELNAME:="Image_ubp"
$(eval $(call BuildTarget))
------------------
After this, I'm using an external tool chain, and I'm pointing to an own
kernel git repo.
In the openwrt menuconfig, enables the Advanced configuration option
Enter git repo to clone: i'm using our own
target options
|-> target optimizations: -O2 -pipe -mfloat-abi=hard -mfpu=vfp
-mtune=arm1176jzf-s -march=armv6zk
This is not strictly required but does not conflict with what you want to
do.
Post by Alberich de megres
edited all options except the last 3 ( program path, toolchain include
path and library path)
Ok, I think the issue is that you are actually using an external toolchain
while I am using the toolchain built by OpenWrt. Can you point me at your
toolchain (if public) so I can try to fix the issues? Is your toolchain
built to target uClibc as libc as well?
Thanks!
--
Florian
Florian Fainelli
2013-02-20 14:53:11 UTC
Permalink
Hello Alberich,
Post by Alberich de megres
Hi Florian,
I think you are right: the point is the toolchain. At the moment we
could not release anything.
The toolchain targets a normal glibc, I was expecting buildroot would
interpert it, or at least give the oportunity to use different libc than
uclibc when using an external toolchain, as when building the toolchain
(using openwrt buildroot) one can choose between glibc, eglibc and
uclibc. Am I wrong?
The problem comes from toolchain/wrapper/Makefile which assumes the
external toolchain is using uclibc, this is where the -muclibc is coming
from. We are working on a fix for this.
--
Florian
Florian Fainelli
2013-02-20 15:10:45 UTC
Permalink
Alberich,
Post by Florian Fainelli
Hello Alberich,
Post by Alberich de megres
Hi Florian,
I think you are right: the point is the toolchain. At the moment we
could not release anything.
The toolchain targets a normal glibc, I was expecting buildroot would
interpert it, or at least give the oportunity to use different libc than
uclibc when using an external toolchain, as when building the toolchain
(using openwrt buildroot) one can choose between glibc, eglibc and
uclibc. Am I wrong?
The problem comes from toolchain/wrapper/Makefile which assumes the
external toolchain is using uclibc, this is where the -muclibc is coming
from. We are working on a fix for this.
r35703 should allow you to select your external toolchain personality
(glibc, uclibc ...). Please also restart your build by removing your old
.config and run this:

./scripts/ext-toolchain.sh --toolchain /path/to/external/toolchain
--config

Thank you!
--
Florian
Alberich de megres
2013-02-21 13:42:54 UTC
Permalink
Thanks Florian, I will give it a try :)
Post by Florian Fainelli
Alberich,
Post by Florian Fainelli
Hello Alberich,
Post by Alberich de megres
Hi Florian,
I think you are right: the point is the toolchain. At the moment we
could not release anything.
The toolchain targets a normal glibc, I was expecting buildroot would
interpert it, or at least give the oportunity to use different libc than
uclibc when using an external toolchain, as when building the toolchain
(using openwrt buildroot) one can choose between glibc, eglibc and
uclibc. Am I wrong?
The problem comes from toolchain/wrapper/Makefile which assumes the
external toolchain is using uclibc, this is where the -muclibc is coming
from. We are working on a fix for this.
r35703 should allow you to select your external toolchain personality
(glibc, uclibc ...). Please also restart your build by removing your old
./scripts/ext-toolchain.sh --toolchain /path/to/external/toolchain
--config
Thank you!
--
Florian
Ted Hess
2013-02-19 20:56:59 UTC
Permalink
Alberich -

I hope the enclosed info is helpful and not just creating more confusion on this subject. I have
been successfully building the RPi 3.6.11+ Kernel within the OpenWRT buildroot using the following
patches (+/-)... IMMV

I also am using 4.7-linaro (4.7.1) and eglibc 2.15 (20866).

/ted

In target/linux/<platform>/Makefile, I set:

CFLAGS:=-O2 -pipe -march=armv6 -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm

Apply this patch to rules.mk

Index: rules.mk
===================================================================
--- rules.mk (revision 35642)
+++ rules.mk (working copy)
@@ -163,7 +163,7 @@
SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
TARGET_CFLAGS+= -msoft-float
else
- SOFT_FLOAT_CONFIG_OPTION:=
+ SOFT_FLOAT_CONFIG_OPTION:=--with-float=hard
endif

export PATH:=$(TARGET_PATH)

---------------------------------------------------------
Include this patch in the target/linux/<platform>/<kernel-patch> directory

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 42d87d7..396f9f3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -58,7 +58,7 @@ comma = ,
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call
cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
-arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call
cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
+arch-$(CONFIG_CPU_32v6)
:=-D__LINUX_ARM_ARCH__=6 -Ofast -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -fomit-frame-pointer
-fexcess-precision=fast
# Only override the compiler option if ARMv6. The ARMv6K extensions are
# always available in ARMv7
ifeq ($(CONFIG_CPU_32v6),y)
@@ -113,8 +113,8 @@ endif
endif

# Need -Uarm for gcc < 3.x
-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
+KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call
cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
+KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h

CHECKFLAGS += -D__arm__
Alberich de megres
2013-02-20 07:42:27 UTC
Permalink
Hi Ted,

Thank you for your reply. I did tried this changes before (patching the
kernel) but then at some point buildroot forces a uclibc emulation mode,
which makes the arm-hardfp-linux-ld fail.

I am able to comple our kernel with this toolchain outside the openwrt. So
I'm trying to find where this -muclibc mode is forced.

Thanks once again for the support.
:)
Post by Ted Hess
Alberich -
I hope the enclosed info is helpful and not just creating more confusion
on this subject. I have
been successfully building the RPi 3.6.11+ Kernel within the OpenWRT
buildroot using the following
patches (+/-)... IMMV
I also am using 4.7-linaro (4.7.1) and eglibc 2.15 (20866).
/ted
CFLAGS:=-O2 -pipe -march=armv6 -mtune=arm1176jzf-s -mfpu=vfp
-mfloat-abi=hard -marm
Apply this patch to rules.mk
Index: rules.mk
===================================================================
--- rules.mk (revision 35642)
+++ rules.mk (working copy)
@@ -163,7 +163,7 @@
SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
TARGET_CFLAGS+= -msoft-float
else
- SOFT_FLOAT_CONFIG_OPTION:=
+ SOFT_FLOAT_CONFIG_OPTION:=--with-float=hard
endif
export PATH:=$(TARGET_PATH)
---------------------------------------------------------
Include this patch in the target/linux/<platform>/<kernel-patch> directory
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 42d87d7..396f9f3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -58,7 +58,7 @@ comma = ,
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call
cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
-arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call
cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
+arch-$(CONFIG_CPU_32v6)
:=-D__LINUX_ARM_ARCH__=6 -Ofast -mcpu=arm1176jzf-s -mtune=arm1176jzf-s
-mfloat-abi=hard -mfpu=vfp -fomit-frame-pointer
-fexcess-precision=fast
# Only override the compiler option if ARMv6. The ARMv6K extensions are
# always available in ARMv7
ifeq ($(CONFIG_CPU_32v6),y)
@@ -113,8 +113,8 @@ endif
endif
# Need -Uarm for gcc < 3.x
-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
+KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call
cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
+KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h
CHECKFLAGS += -D__arm__
_______________________________________________
openwrt-devel mailing list
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Loading...