Cross compile rules update
Loïc Minier
loic.minier at ubuntu.com
Mon Oct 11 14:51:29 UTC 2010
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-".
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.
Cheers,
--
Loïc Minier
More information about the kernel-team
mailing list