diff mbox

Cross compile rules update

Message ID AANLkTik7728+gwTLxhwP3kmH071p6xOBiEMJd6ZFLQZ9@mail.gmail.com
State Accepted
Delegated to: Tim Gardner
Headers show

Commit Message

Sebastien Jan Oct. 12, 2010, 3:25 p.m. UTC
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@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?

---

Comments

Tim Gardner Oct. 13, 2010, 4:13 p.m. UTC | #1
On 10/12/2010 09:25 AM, Jan, Sebastien wrote:
> 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@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)" \

Applied, plus the addition of the case when -aarmel is specified without 
CROSS_COMPILE.
diff mbox

Patch

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)" \