cross compilation of kernel does not need tools to be built

Andy Whitcroft apw at canonical.com
Fri Mar 16 11:06:02 UTC 2012


On Thu, Mar 15, 2012 at 08:26:58PM +0100, Marcin Juszkiewicz wrote:
> 
> At Linaro we want to be able to cross compile as much as we can. One of
> most popular targets for people (inside or outside) is kernel.
> 
> Today we are not able to cross build it due to linux-tools-VER package
> as it requires libdw-dev which requires binutils-dev which is not
> possible to install for other architecture then host one.
> 
> So solution which I want to propose is simple: disable build of tools/
> when we cross compile:
> 
> diff -Naru linux-3.2.0/debian/rules.d/0-common-vars.mk
> linux-3.2.0-hrw/debian/rules.d/0-common-vars.mk
> --- linux-3.2.0/debian/rules.d/0-common-vars.mk	2012-03-15
> 17:31:25.000000000 +0000
> +++ linux-3.2.0-hrw/debian/rules.d/0-common-vars.mk	2012-03-15
> 17:25:47.665905092 +0000
> @@ -170,6 +170,9 @@
>  else
>  do_tools?=false
>  endif
> +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
> +do_tools=false
> +endif
>  tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
>  tools_common_pkg_name=$(src_pkg_name)-tools-common
> 
> 
> Other thing which I found during my work was wrong use of
> $(CROSS_COMPILE) during build of tools:
> 
> diff -Naru linux-3.2.0/debian/rules.d/2-binary-arch.mk
> linux-3.2.0-hrw/debian/rules.d/2-binary-arch.mk
> --- linux-3.2.0/debian/rules.d/2-binary-arch.mk	2012-03-15
> 17:31:25.000000000 +0000
> +++ linux-3.2.0-hrw/debian/rules.d/2-binary-arch.mk	2012-03-15
> 16:44:31.545858606 +0000
> @@ -397,7 +397,7 @@
>  $(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch
>  ifeq ($(do_tools),true)
>  	cd $(builddir)/tools/tools/perf && \
> -		make HAVE_CPLUS_DEMANGLE=1 $(CROSS_COMPILE) $(conc_level)
> +		$(kmake) HAVE_CPLUS_DEMANGLE=1 $(conc_level)
>  	if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
>  		cd $(builddir)/tools/tools/power/x86/x86_energy_perf_policy && make
> $(CROSS_COMPILE); \
>  		cd $(builddir)/tools/tools/power/x86/turbostat && make
> $(CROSS_COMPILE); \
> 
> 
> With my change $(CROSS_COMPILE) is used properly here.
> 
> Share opinion and please remember that I am not subscribed to this ML.

There is some reason we cannot use this second part of the fix.  This
breaks builds somewhere else like on buildds or something.  Tim you and
I looked at this before when someone proposed exactly this second fix;
Loic perhaps -- can you remember?

As for the first change, I am not opposed to it, but would like to ask
why you cannot use the do_tools=false override; this is what I use when
cross building.

-apw





More information about the kernel-team mailing list