[Buildroot] [PATCH 8/9] RFC: Remove HOSTCFLAGS from kernel compile

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Oct 16 21:09:12 UTC 2008


On Thu, Oct 16, 2008 at 02:32:56PM -0600, Grant Likely wrote:
>From: Grant Likely <grant.likely at secretlab.ca>
>
>Setting HOSTCFLAGS when calling make for the kernel compile messes up
>the tools that the kernel builds for itself.  Specifically, the
>building of the device tree compiler (dtc) in arch/powerpc adds some
>required flags to HOSTCFLAGS.  However, if HOSTCFLAGS= is specified
>when calling make, then the local flags are never added and the kernel
>compile fails.

One could argue that this is really a bug in the kernel.

>
>This patch removes the HOSTCFLAGS= from $(LINUX26_MAKE_FLAGS).  I've
>marked this patch as an RFC because I don't know what is really required
>here.  Removing it works for me (of course), but it may break other users.
>I just don't know if there is a better way to set HOSTCFLAGS so that it
>doesn't override the settings that the kernel uses itself.

you could append it to HOSTCC, but that didn't work either (at least for
some earlier 2.6.x). The problem with HOSTCFLAGS and HOSTCC is that for
some hosts the HOSTCFLAGS are integral part of having a working HOSTCC,
you can't separate them without rendering your HOSTCC completely
dysfunctional (since the stuff is supposed to run, too).

>---
>
> target/linux/Makefile.in.advanced |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>
>diff --git a/target/linux/Makefile.in.advanced b/target/linux/Makefile.in.advanced
>index 42384f1..9c6df1f 100644
>--- a/target/linux/Makefile.in.advanced
>+++ b/target/linux/Makefile.in.advanced
>@@ -186,7 +186,7 @@ LINUX_KERNEL:=$(LINUX26_KERNEL)
> LINUX26_BZCAT:=$(BZCAT)
> 
> __LINUX26_NO_PIC=-fPIC -fpic -DPIC -fwrapv -ftrapv
>-LINUX26_MAKE_FLAGS = HOSTCC="$(HOSTCC)" HOSTCFLAGS="$(HOSTCFLAGS)" \
>+LINUX26_MAKE_FLAGS = HOSTCC="$(HOSTCC)" \
> 	ARCH=$(KERNEL_ARCH) \
> 	CFLAGS_KERNEL="$(filter-out $(__LINUX26_NO_PIC),$(TARGET_CFLAGS))" \
> 	INSTALL_MOD_PATH=$(TARGET_DIR) \
>



More information about the buildroot mailing list