FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 09-29-2010, 03:39 PM
Tim Gardner
 
Default Add support for cross compiling armel

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
debian/rules.d/0-common-vars.mk | 36 +++++++++++++++++++++++++++++++++++-
debian/rules.d/1-maintainer.mk | 6 ++++++
debian/rules.d/2-binary-arch.mk | 2 +-
3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index e03fa14..eddcd0d 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -96,7 +96,32 @@ endif
# committing changes to the top level Makefile
SUBLEVEL := $(shell echo $(release) | awk -F. '{print $$3}')

-arch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+#
+# Detect invocations of the form 'fakeroot debian/rules binary arch=armel'
+# within an x86'en schroot. This only gets you part of the way sicne the
+# packaging phase fails, but you can at least compile the kernel quickly.
+#
+arch := $(DEB_HOST_ARCH)
+ifneq ($(arch),$(DEB_HOST_ARCH))
+ ifeq ($(arch),armel)
+ cross_compile = CROSS_COMPILE=arm-linux-gnueabi-
+ endif
+endif
+
+#
+# Detect invocations of the form 'dpk-buildpackage -B -aarmel' within
+# an x86'en schroot. This is the only way to build all of the packages
+# (except for tools).
+#
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+ cross_compile = CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(revision)/$(arch)
prev_abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(prev_revision)/$(arch)
commonconfdir := $(CURDIR)/$(DEBIAN)/config
@@ -198,3 +223,12 @@ kmake = make ARCH=$(build_arch)
ifneq ($(LOCAL_ENV_CC),)
kmake += CC=$(LOCAL_ENV_CC) DISTCC_HOSTS=$(LOCAL_ENV_DISTCC_HOSTS)
endif
+
+ifneq ($(cross_compile),)
+ #
+ # Can't build the tools 'cause the make wants cross libraries and such.
+ #
+ do_tools=false
+ kmake += $(cross_compile)
+endif
+
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 7ad68dd..9713e3d 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -109,6 +109,12 @@ endif
@echo "do_tools = $(do_tools)"
@echo "full_build = $(full_build)"
@echo "libc_dev_version = $(libc_dev_version)"
+ @echo "DEB_HOST_GNU_TYPE = $(DEB_HOST_GNU_TYPE)"
+ @echo "DEB_BUILD_GNU_TYPE = $(DEB_BUILD_GNU_TYPE)"
+ @echo "DEB_HOST_ARCH = $(DEB_HOST_ARCH)"
+ @echo "DEB_BUILD_ARCH = $(DEB_BUILD_ARCH)"
+ @echo "arch = $(arch)"
+ @echo "kmake = $(kmake)"

printchanges:
@baseCommit=$$(git log --pretty=format:'%H %s' |
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 1d26496..ccb3fce 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -277,7 +277,7 @@ binary-%: install-%
dh_fixperms -p$(pkgimg)
dh_installdeb -p$(pkgimg)
dh_shlibdeps -p$(pkgimg)
- dh_gencontrol -p$(pkgimg)
+ export DEB_BUILD_ARCH=$(arch) && export DEB_HOST_ARCH=$(arch) && dh_gencontrol -p$(pkgimg)
dh_md5sums -p$(pkgimg)
dh_builddeb -p$(pkgimg) -- -Zbzip2 -z9

--
1.7.0.4


--------------040907080206030507020905
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

--------------040907080206030507020905--
 
Old 09-29-2010, 03:39 PM
Tim Gardner
 
Default Add support for cross compiling armel

The best way to cross compile is by using dpkg-buildpackage, e.g.,

dpkg-buildpackage -B -aarmel

You'll likely have problems cross compiling the tools unless you've
built and installed some prerequisites, but thats your problem. Work
around the issue by deleting the tools directorty or specify do_tools=false.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
debian/rules.d/0-common-vars.mk | 29 ++++++++++++++++++++++++++++-
debian/rules.d/1-maintainer.mk | 6 ++++++
debian/rules.d/2-binary-arch.mk | 2 +-
3 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index e03fa14..5ff544b 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -96,7 +96,32 @@ endif
# committing changes to the top level Makefile
SUBLEVEL := $(shell echo $(release) | awk -F. '{print $$3}')

-arch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+#
+# Detect invocations of the form 'fakeroot debian/rules binary arch=armel'
+# within an x86'en schroot. This only gets you part of the way sicne the
+# packaging phase fails, but you can at least compile the kernel quickly.
+#
+arch := $(DEB_HOST_ARCH)
+ifneq ($(arch),$(DEB_HOST_ARCH))
+ ifeq ($(arch),armel)
+ CROSS_COMPILE ?= CROSS_COMPILE=arm-linux-gnueabi-
+ endif
+endif
+
+#
+# Detect invocations of the form 'dpk-buildpackage -B -aarmel' within
+# an x86'en schroot. This is the only way to build all of the packages
+# (except for tools).
+#
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+ CROSS_COMPILE ?= CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(revision)/$(arch)
prev_abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(prev_revision)/$(arch)
commonconfdir := $(CURDIR)/$(DEBIAN)/config
@@ -191,6 +216,7 @@ conc_level = -j$(CONCURRENCY_LEVEL)

# target_flavour is filled in for each step
kmake = make ARCH=$(build_arch)
+ $(CROSS_COMPILE)
EXTRAVERSION=-$(abinum)-$(target_flavour)
CONFIG_DEBUG_SECTION_MISMATCH=y SUBLEVEL=$(SUBLEVEL)
KBUILD_BUILD_VERSION="$(uploadnum)"
@@ -198,3 +224,4 @@ kmake = make ARCH=$(build_arch)
ifneq ($(LOCAL_ENV_CC),)
kmake += CC=$(LOCAL_ENV_CC) DISTCC_HOSTS=$(LOCAL_ENV_DISTCC_HOSTS)
endif
+
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 7ad68dd..9713e3d 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -109,6 +109,12 @@ endif
@echo "do_tools = $(do_tools)"
@echo "full_build = $(full_build)"
@echo "libc_dev_version = $(libc_dev_version)"
+ @echo "DEB_HOST_GNU_TYPE = $(DEB_HOST_GNU_TYPE)"
+ @echo "DEB_BUILD_GNU_TYPE = $(DEB_BUILD_GNU_TYPE)"
+ @echo "DEB_HOST_ARCH = $(DEB_HOST_ARCH)"
+ @echo "DEB_BUILD_ARCH = $(DEB_BUILD_ARCH)"
+ @echo "arch = $(arch)"
+ @echo "kmake = $(kmake)"

printchanges:
@baseCommit=$$(git log --pretty=format:'%H %s' |
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 1d26496..2c4332e 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -353,7 +353,7 @@ endif

$(stampdir)/stamp-build-perarch: prepare-perarch
ifeq ($(do_tools),true)
- cd $(builddir)/tools-$*/tools/perf && make
+ cd $(builddir)/tools-$*/tools/perf && make $(CROSS_COMPILE)
endif
@touch $@

--
1.7.0.4


--------------020004010503010901090908
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

--------------020004010503010901090908--
 

Thread Tools




All times are GMT. The time now is 05:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org