From: Robert Gordon <robert@greenroomsoftware.com>
To: linux-kbuild@vger.kernel.org
Cc: Robert Nelson <robertcnelson@gmail.com>,
maximilian attems <max@stro.at>,
Robert Gordon <robert@greenroomsoftware.com>
Subject: [PATCH] kbuild, deb-pkg: set host machine $arch correctly when cross-compiling or not
Date: Tue, 3 May 2011 23:27:18 -0700 [thread overview]
Message-ID: <1304490438-17099-1-git-send-email-robert@greenroomsoftware.com> (raw)
scripts/package/builddeb script was setting the host machine $arch
in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol.
The existing method is appropriate for i386/x86_64 but fails when
cross-compiling for non-intel. The patch modifies the script to
guarantee the correct $arch for the target is written to the control
file. This patch has been tested building x86_64 on an i386 machine
and also when cross-compiling for ARM on an i386 machine.
The issue first arose in the 2.6.38 release.
Signed-off-by: Robert Gordon <robert@greenroomsoftware.com>
---
scripts/package/builddeb | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index f6cbc3d..91ced36 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -246,7 +246,23 @@ mkdir -p "$destdir"
(cd $srctree; tar -c -f - -T /tmp/files$$) | (cd $destdir; tar -xf -)
(cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
rm -f /tmp/files$$ /tmp/objfiles$$
-arch=$(dpkg --print-architecture)
+
+case "$UTS_MACHINE" in
+sparc*)
+ arch=sparc ;;
+s390*)
+ arch=s390 ;;
+ppc*)
+ arch=powerpc ;;
+parisc*)
+ arch=hppa ;;
+mips*)
+ arch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;;
+arm*)
+ arch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;;
+i386|ia64|alpha|x86_64|*)
+ arch=$(dpkg --print-architecture) ;;
+esac
cat <<EOF >> debian/control
--
1.7.1
reply other threads:[~2011-05-04 6:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1304490438-17099-1-git-send-email-robert@greenroomsoftware.com \
--to=robert@greenroomsoftware.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=max@stro.at \
--cc=robertcnelson@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox