[PATCH 1/2] UBUNTU: add support for building selected stages of kernel

Andy Whitcroft apw at canonical.com
Thu Aug 5 11:02:51 UTC 2010


BugLink: http://bugs.launchpad.net/bugs/603087

To bootstrap in a cross-compile environment we need to be able to build
the compiler and libc, for this we need linux-libc-dev from the kernel.
However we cannot build the kernel without the compiler.  Catch 22.

This patch adds "DEB_STAGE=stage1" variable which skips building kernel
requesting only the linux-libc-dev package.

Based on a patch by Marcin Juszkiewicz <marcin.juszkiewicz at linaro.org>

Signed-off-by: Andy Whitcroft <apw at canonical.com>
---
 debian/rules                     |    9 +++++++++
 debian/rules.d/0-common-vars.mk  |    6 ++++++
 debian/rules.d/1-maintainer.mk   |    3 +++
 debian/rules.d/2-binary-arch.mk  |   10 +++++++++-
 debian/rules.d/3-binary-indep.mk |    2 ++
 5 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/debian/rules b/debian/rules
index b167196..92ec033 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,6 +29,15 @@ include $(DROOT)/rules.d/0-common-vars.mk
 # Maintainer targets
 include $(DROOT)/rules.d/1-maintainer.mk
 
+# Stages
+ifeq ($(DEB_STAGE),stage1)
+    do_tools=false
+    do_doc_package=false
+    do_source_package=false
+    do_flavour_image_package=false
+    do_flavour_header_package=false
+endif
+
 # Debian Build System targets
 binary: binary-indep binary-arch
 
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index b59656c..2880576 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -141,6 +141,12 @@ endif
 tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
 tools_common_pkg_name=$(src_pkg_name)-tools-common
 
+# The general flavour specific image package.
+do_flavour_image_package=true
+
+# The general flavour specific header package.
+do_flavour_header_package=true
+
 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
 #
 # These 2 environment variables set the -j value of the kernel build. For example,
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 65b9688..4443274 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -102,9 +102,12 @@ endif
 	@echo "do_source_package         = $(do_source_package)"
 	@echo "do_source_package_content = $(do_source_package_content)"
 	@echo "do_libc_dev_package       = $(do_libc_dev_package)"
+	@echo "do_flavour_image_package  = $(do_flavour_image_package)"
+	@echo "do_flavour_header_package = $(do_flavour_header_package)"
 	@echo "do_common_headers_indep   = $(do_common_headers_indep)"
 	@echo "do_full_source            = $(do_full_source)"
 	@echo "do_tools                  = $(do_tools)"
+	@echo "full_build                = $(full_build)"
 
 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 ace4d85..6a07d3c 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -377,16 +377,24 @@ endif
 
 binary-debs: binary-perarch $(stampdir)/stamp-flavours $(addprefix binary-,$(flavours))
 
-build-arch:  $(addprefix build-,$(flavours))
+build-arch-deps =
+ifeq ($(do_flavour_image_package),true)
+build-arch-deps += $(addprefix build-,$(flavours))
+endif
+build-arch: $(build-arch-deps)
 
+ifeq ($(do_flavour_image_package),true)
 binary-arch-deps = binary-debs
 ifeq ($(AUTOBUILD),)
 binary-arch-deps += binary-udebs
 endif
+endif
 ifeq ($(do_libc_dev_package),true)
 binary-arch-deps += binary-arch-headers
 endif
 ifneq ($(do_common_headers_indep),true)
+ifeq ($(do_flavour_header_package),true)
 binary-arch-deps += binary-headers
 endif
+endif
 binary-arch: $(binary-arch-deps)
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index d8f2407..c4ac483 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -97,8 +97,10 @@ install-tools:
 
 install-indep-deps =
 ifeq ($(do_common_headers_indep),true)
+ifeq ($(do_flavour_header_package),true)
 install-indep-deps += install-headers
 endif
+endif
 ifeq ($(do_doc_package),true)
 install-indep-deps += install-doc
 endif
-- 
1.7.0.4





More information about the kernel-team mailing list