Cross compile rules update

Jan, Sebastien s-jan at ti.com
Tue Oct 12 15:25:34 UTC 2010


Hi Tim,

Thanks to Loic help I could test the following (see my comments inlined)

On Mon, Oct 11, 2010 at 4:51 PM, Loïc Minier <loic.minier at ubuntu.com> wrote:
>  Oh right, the issue is probably that you pass the right CROSS_COMPILE
>  with the value "some-cross-prefix-" that the downstream kernel build
>  expects, but the kernel debian/rules machinery expects this variable to
>  contain "CROSS_COMPILE=some-cross-prefix-", and not just
>  "some-cross-prefix-".

With current Maverick kernel 2.6.35-903.15, I can cross-compile with
CS with the following command-line:
CROSS_COMPILE="CROSS_COMPILE=arm-none-linux-gnueabi-" do_tools=false
dpkg-buildpackage -B -aarmel

>  or, nicer:
>    ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
>    CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
>    endif
>    [...]
>    $(MAKE) CROSS_COMPILE=$(CROSS_COMPILE)
>
>  the latter will result in make being called with "CROSS_COMPILE=" in
>  native builds, which should be just fine, but if you really want to
>  avoid it you could use a $(if ) construct on the make invocation.

I tested this fix (see below patch), and can cross-compile with CS
using the command line:
CROSS_COMPILE=arm-none-linux-gnueabi- do_tools=false dpkg-buildpackage
-B -aarmel

Do we want to pull this patch in? Shall I log a bug?

---

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index 66d3900..a07f16d 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -107,7 +107,7 @@ endif
 # (except for tools).
 #
 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-       CROSS_COMPILE ?= CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+       CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
 endif

 abidir         := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(revision)/$(arch)
@@ -204,7 +204,7 @@ conc_level          = -j$(CONCURRENCY_LEVEL)

 # target_flavour is filled in for each step
 kmake = make ARCH=$(build_arch) \
-       $(CROSS_COMPILE) \
+       CROSS_COMPILE=$(CROSS_COMPILE) \
        EXTRAVERSION=-$(abinum)-$(target_flavour) \
        CONFIG_DEBUG_SECTION_MISMATCH=y SUBLEVEL=$(SUBLEVEL) \
        KBUILD_BUILD_VERSION="$(uploadnum)" \




More information about the kernel-team mailing list