cross compilation of kernel does not need tools to be built

Marcin Juszkiewicz marcin.juszkiewicz at linaro.org
Thu Mar 15 19:26:58 UTC 2012


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.




More information about the kernel-team mailing list