All of lore.kernel.org
 help / color / mirror / Atom feed
From: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	debian-kernel@lists.debian.org
Subject: [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE
Date: Fri,  5 Nov 2010 12:32:41 +0000	[thread overview]
Message-ID: <1288960361-6407-1-git-send-email-asbjorn@asbjorn.biz> (raw)
In-Reply-To: <4CD2A8BC.3010500@suse.cz>

Instead of creating the debian package for the compiling userland,
create it for a userland matching the kernel thats being compiled.

This patch supports all Lenny release architectures,
and Linux-based architecture candidates for Squeeze.

If it can't find a proper Debian userspace it displays a warning,
and fallback to let deb-gencontrol use the host's userspace arch.

Eg. with this patch the following make command:

	make ARCH=i386 deb-pkg

will output an i386 Debian package instead of an amd64 one,
when run on an amd64 machine.

Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
---
 scripts/package/builddeb |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5f1e2fc..1df1cc0 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,39 @@ create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Attempt to find the correct Debian architecture
+	local forcearch="" debarch=""
+	case "$UTS_MACHINE" in
+	i386|ia64|alpha|hppa)
+		debarch="$UTS_MACHINE" ;;
+	x86_64)
+		debarch=amd64 ;;
+	sparc*)
+		debarch=sparc ;;
+	s390*)
+		debarch=s390 ;;
+	ppc*)
+		debarch=powerpc ;;
+	mips*)
+		debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;;
+	arm*)
+		debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;;
+	*)
+		echo "" >&2
+		echo "** ** **  WARNING  ** ** **" >&2
+		echo "" >&2
+		echo "Your architecture doesn't have it's equivalent" >&2
+		echo "Debian userspace architecture defined!" >&2
+		echo "Falling back to using your current userspace instead!" >&2
+		echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
+		echo "" >&2
+	esac
+	if [ -n "$debarch" ] ; then
+		forcearch="-DArchitecture=$debarch"
+	fi
+
 	# Create the package
-	dpkg-gencontrol -isp -p$pname -P"$pdir"
+	dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
 	dpkg --build "$pdir" ..
 }
 
-- 
1.7.2.3


  parent reply	other threads:[~2010-11-05 12:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 23:31 [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling Asbjoern Sloth Toennesen
2010-11-03 22:57 ` Michal Marek
2010-11-03 23:25   ` Michal Marek
2010-11-04  1:42   ` Asbjørn Sloth Tønnesen
2010-11-04  2:42     ` Asbjoern Sloth Toennesen
2010-11-04  3:38       ` Asbjørn Sloth Tønnesen
2010-11-04  3:44         ` Asbjoern Sloth Toennesen
2010-11-04  5:58           ` Sam Ravnborg
2010-11-04 12:29             ` Asbjørn Sloth Tønnesen
2010-11-04 12:36               ` Michal Marek
2010-11-04 13:33                 ` Asbjørn Sloth Tønnesen
2010-11-05 12:32                 ` Asbjoern Sloth Toennesen [this message]
2010-11-05 12:41                   ` [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE maximilian attems
2010-11-05 13:29                     ` Asbjørn Sloth Tønnesen
2010-11-05 13:30                       ` [PATCH] kbuild, deb-pkg: select userland architecture " Asbjoern Sloth Toennesen
2010-11-05 13:36                         ` maximilian attems
2010-11-05 13:42                         ` Sven-Haegar Koch
2010-11-06 19:04                           ` Asbjørn Sloth Tønnesen
2010-11-06 19:05                             ` [PATCH] kbuild, deb-pkg: support overriding userland architecture Asbjoern Sloth Toennesen
2010-11-07  8:24                               ` Américo Wang
2010-11-25 14:37                               ` Michal Marek
2010-11-25 19:10                                 ` Sam Ravnborg
2010-12-08 21:35                                 ` [PATCH v2] " Asbjoern Sloth Toennesen
2010-12-09 14:24                                   ` maximilian attems
2010-12-09 15:23                                     ` Asbjørn Sloth Tønnesen
2010-12-09 15:24                                       ` [PATCH v3] " Asbjoern Sloth Toennesen
2010-12-09 15:34                                         ` Michal Marek
2010-12-09 15:42                                           ` Asbjørn Sloth Tønnesen
2010-12-12 17:39                                           ` [PATCH v4] " Asbjoern Sloth Toennesen
2010-12-20 15:53                                             ` Michal Marek
2010-12-03 17:48                               ` [PATCH] " maximilian attems
2010-12-03 19:37                                 ` Asbjørn Sloth Tønnesen
2010-11-25 14:35                         ` [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE Michal Marek
2010-11-05 12:44                   ` [PATCH] kbuild, deb-pkg: select userland architectire " Asbjørn Sloth Tønnesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288960361-6407-1-git-send-email-asbjorn@asbjorn.biz \
    --to=asbjorn@asbjorn.biz \
    --cc=debian-kernel@lists.debian.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.