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
<[email protected]>wrote:

> Hello,
>
> Thanks for the quick reply :)
>
>
> On Mon, Feb 18, 2013 at 10:46 AM, Florian Fainelli <[email protected]>wrote:
>
>> Hello,
>>
>>
>> On 02/18/2013 10:21 AM, Alberich de megres wrote:
>>
>>> 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.
>
>
>
>>
>>> 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.
>>>
>>
>> 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 :)
>
>
>>
>>
>>> 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
>>> <[email protected] <mailto:[email protected]>**> wrote:
>>>
>>>     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
>>>     <[email protected] <mailto:[email protected]>> wrote:
>>>
>>>         Hello Alberich,
>>>
>>>         Le 17/02/2013 14:26, Alberich de megres a écrit :
>>>
>>>             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?
>>>
>>>
>>>         This is specifically passed to the GCC configure script here:
>>>         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
>>>         binaries from here:
>>>         
>>> 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
>>>
>>>
>>>
>>>
>>
>
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to