From patchwork Sun Jun 10 20:20:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Collins X-Patchwork-Id: 164286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id BDCA31007D1 for ; Tue, 12 Jun 2012 09:06:14 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SeDgQ-0004WX-Js; Mon, 11 Jun 2012 23:06:02 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SeDdi-0003iy-0D for kernel-team@lists.ubuntu.com; Mon, 11 Jun 2012 23:03:14 +0000 Received: by mail-pb0-f49.google.com with SMTP id rq13so6562271pbb.8 for ; Mon, 11 Jun 2012 16:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:in-reply-to:references:from:date:subject:to; bh=TYaIlgBtWjhUUVtDrfCS8RMdbhCo8aa04mLX2xBA5ZI=; b=G226qH/+wxVhA/i62vYCRO0iUYOXCJxnrymNR6zKdE1sk7tJOrGb+mDlK4wDvY4lEI Cwfi6+epEP04TqjCxU9w/lN0mtCJjYAU1zaX5TerJ3rtu2xgHNIVMKx16d/kZBSBIEPi c2iNx81zWTTvj82cZfwlIuEaYnZUY2uffDCq1nYBePEPRB1I1oJULjDmikBPYDhfrJXI LqEMR91DeLco40/Rzra57uD1J3YYVwey7168TlF7jUmfUo68T6ASMlu772N1uyFk+WV0 neGiDx+uU1L3PD5eM7EKeudfbbcuULiqUw/z4RZy7kN4VsLQDFI/HvEJ8RXSSXLCEXKH HY0g== Received: by 10.68.228.130 with SMTP id si2mr15220185pbc.59.1339455793572; Mon, 11 Jun 2012 16:03:13 -0700 (PDT) Received: from localhost (ip68-13-200-36.hr.hr.cox.net. [68.13.200.36]) by mx.google.com with ESMTPS id mt9sm19946596pbb.14.2012.06.11.16.03.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 16:03:12 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 11 Jun 2012 19:03:08 -0400 Message-Id: In-Reply-To: References: From: Ben Collins Date: Sun, 10 Jun 2012 16:20:12 -0400 Subject: [PATCH 26/27] UBUNTU: build: Add a command that allows overriding vars by flavours To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This is an old command that used to be in here but wasn't used. I need it back now. In the next commit I'll be adding the powerpc-e500mc. The build_image, loader and kernel_file are different than other powerpc targets, so this will allow me to override it just for this one flavour. Signed-off-by: Ben Collins --- debian/rules.d/0-common-vars.mk | 5 +++++ debian/rules.d/2-binary-arch.mk | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk index 17eed6a..f0cde1a 100644 --- a/debian/rules.d/0-common-vars.mk +++ b/debian/rules.d/0-common-vars.mk @@ -230,3 +230,8 @@ endif lockme_file = $(CURDIR)/debian/.LOCK lockme_cmd = flock -w 60 lockme = $(lockme_cmd) $(lockme_file) + +# Checks if a var is overriden by the custom rules. Called with var and +# flavour as arguments. +custom_override = \ + $(shell if [ -n "$($(1)_$(2))" ]; then echo "$($(1)_$(2))"; else echo "$($(1))"; fi) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index a2555ee..37a5c5a 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -34,9 +34,10 @@ build-%: $(stampdir)/stamp-build-% # Do the actual build, including image and modules $(stampdir)/stamp-build-%: target_flavour = $* +$(stampdir)/stamp-build-%: bimage = $(call custom_override,build_image,$*) $(stampdir)/stamp-build-%: $(stampdir)/stamp-prepare-% @echo Debug: $@ - $(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image) modules + $(build_cd) $(kmake) $(build_O) $(conc_level) $(bimage) modules @touch $@ # Install the finished build @@ -46,6 +47,8 @@ install-%: bindoc = $(pkgdir)/usr/share/doc/$(bin_pkg_name)-$* install-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym install-%: basepkg = $(hdrs_pkg_name) install-%: hdrdir = $(CURDIR)/debian/$(basepkg)-$*/usr/src/$(basepkg)-$* +install-%: kfile = $(call custom_override,kernel_file,$*) +install-%: bload = $(call custom_override,loader,$*) install-%: target_flavour = $* install-%: checks-% @echo Debug: $@ @@ -59,11 +62,11 @@ install-%: checks-% # compress_file logic required because not all architectures # generate a zImage automatically out of the box ifeq ($(compress_file),) - install -m600 -D $(builddir)/build-$*/$(kernel_file) \ + install -m600 -D $(builddir)/build-$*/$(kfile) \ $(pkgdir)/boot/$(install_file)-$(abi_release)-$* else install -d $(pkgdir)/boot - gzip -c9v $(builddir)/build-$*/$(kernel_file) > \ + gzip -c9v $(builddir)/build-$*/$(kfile) > \ $(pkgdir)/boot/$(install_file)-$(abi_release)-$* chmod 600 $(pkgdir)/boot/$(install_file)-$(abi_release)-$* endif @@ -119,7 +122,7 @@ endif install -d $(pkgdir)/DEBIAN for script in postinst postrm preinst prerm; do \ sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(install_file)/g' \ - -e 's/=L/$(loader)/g' -e 's@=B@$(build_arch)@g' \ + -e 's/=L/$(bload)/g' -e 's@=B@$(build_arch)@g' \ $(DROOT)/control-scripts/$$script > $(pkgdir)/DEBIAN/$$script; \ chmod 755 $(pkgdir)/DEBIAN/$$script; \ done @@ -128,7 +131,7 @@ endif install -d $(pkgdir_ex)/DEBIAN; \ for script in postinst postrm ; do \ sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(install_file)/g' \ - -e 's/=L/$(loader)/g' -e 's@=B@$(build_arch)@g' \ + -e 's/=L/$(bload)/g' -e 's@=B@$(build_arch)@g' \ debian/control-scripts/$$script > $(pkgdir_ex)/DEBIAN/$$script; \ chmod 755 $(pkgdir_ex)/DEBIAN/$$script; \ done; \ @@ -153,7 +156,7 @@ ifneq ($(skipsub),true) for script in postinst postrm preinst prerm; do \ sed -e 's/=V/$(abi_release)-$*/g' \ -e 's/=K/$(install_file)/g' \ - -e 's/=L/$(loader)/g' \ + -e 's/=L/$(bload)/g' \ -e 's@=B@$(build_arch)@g' \ $(DROOT)/control-scripts/$$script > \ debian/$(bin_pkg_name)-$$sub/DEBIAN/$$script;\