Cross compile rules update

Jan, Sebastien s-jan at ti.com
Mon Oct 11 15:50:24 UTC 2010


On Mon, Oct 11, 2010 at 4:51 PM, Loïc Minier <loic.minier at ubuntu.com> wrote:
> On Mon, Oct 11, 2010, Jan, Sebastien wrote:
>> I was able to cross-compile with the following hack:
>> diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
>> index 66d3900..b4d7a8a 100644
>> --- a/debian/rules.d/0-common-vars.mk
>> +++ b/debian/rules.d/0-common-vars.mk
>> @@ -106,9 +106,13 @@ endif
>>  # an x86'en schroot. This is the only way to build all of the packages
>>  # (except for tools).
>>  #
>> +ifneq ($(CROSS_COMPILE),)
>> +       CROSS_COMPILE := CROSS_COMPILE=$(CROSS_COMPILE)
>> +else
>>  ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
>>         CROSS_COMPILE ?= CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
>>  endif
>> +endif
>
>  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-".

Right, the following command runs well:
CROSS_COMPILE="CROSS_COMPILE=arm-none-linux-gnueabi-"
dpkg-buildpackage -B -aarmel

>  A nicer fix would be to rename the CROSS_COMPILE=foo argument to the
>  kernel build differently, or to only store its value in the variable.
>
>  That is, either:
>    ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
>    CROSS_COMPILE_ARG ?= CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
>    endif
>    [...]
>    $(MAKE) $(CROSS_COMPILE_ARG)
>
>  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.

Either ways you expect to retrieve the cross-compiler name through the
DEB_HOST_GNU_TYPE variable? In my case I always get
DEB_HOST_GNU_TYPE=arm-linux-gnueabi (that's the output of
dpkg-architecture). Is this expected?
If yes, I don't understand how my cross-compiler (CS here) gets passed
to make. Your two above proposals would override what I could write on
the command line? (hence my 1st patch)




More information about the kernel-team mailing list