From patchwork Wed May 4 06:27:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert X-Patchwork-Id: 752712 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p446RW1d019828 for ; Wed, 4 May 2011 06:27:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752361Ab1EDG13 (ORCPT ); Wed, 4 May 2011 02:27:29 -0400 Received: from 75.98.165.80.static.a2webhosting.com ([75.98.165.80]:36876 "EHLO greenroomsoftware.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752195Ab1EDG13 (ORCPT ); Wed, 4 May 2011 02:27:29 -0400 Received: from ip68-6-231-78.sd.sd.cox.net ([68.6.231.78] helo=robert-VGN-Z690Y.localdomain6) by a2s60.a2hosting.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1QHVYV-0006V0-Vb; Wed, 04 May 2011 02:27:28 -0400 From: Robert Gordon To: Cc: Robert Nelson , maximilian attems , Robert Gordon Subject: [PATCH] kbuild, deb-pkg: set host machine $arch correctly when cross-compiling or not Date: Tue, 3 May 2011 23:27:18 -0700 Message-Id: <1304490438-17099-1-git-send-email-robert@greenroomsoftware.com> X-Mailer: git-send-email 1.7.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s60.a2hosting.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - greenroomsoftware.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 04 May 2011 06:27:33 +0000 (UTC) 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 --- 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 <> debian/control