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

login
register
mail settings
Submitter Andy Whitcroft
Date Aug. 5, 2010, 11:02 a.m.
Message ID <1281006172-29467-2-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/60949/
State Accepted
Delegated to: Leann Ogasawara
Headers show

Comments

Andy Whitcroft - Aug. 5, 2010, 11:02 a.m.
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@linaro.org>

Signed-off-by: Andy Whitcroft <apw@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(-)
Stefan Bader - Aug. 5, 2010, 2:30 p.m.
Look like it will be doing what is intended.

On 08/05/2010 01:02 PM, Andy Whitcroft wrote:
> 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@linaro.org>
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Stefan Bader <stefan.bader@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

Patch

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