All of lore.kernel.org
 help / color / mirror / Atom feed
From: maximilian attems <max@stro.at>
To: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Cc: Michal Marek <mmarek@suse.cz>,
	Linux Kbuild <linux-kbuild@vger.kernel.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] builddeb: remove unneeded explicit Architecture
Date: Thu, 6 Sep 2012 14:04:16 +0000	[thread overview]
Message-ID: <20120906140416.GG28778@vostochny.stro.at> (raw)
In-Reply-To: <20120906140004.GL19848@vostochny.stro.at>

On Thu, Sep 06, 2012 at 02:00:04PM +0000, maximilian attems wrote:
> On Wed, Sep 05, 2012 at 08:26:05PM +0000, maximilian attems wrote:
> > On Wed, Sep 05, 2012 at 07:40:09PM +0300, Tzafrir Cohen wrote:
> > > 
> > > $ grep CROSS_COMPILE .config
> > > CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
> > > 
> > > Command:
> > > 
> > >   KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> > > 
> > > Error I get:
> > > 
> > >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> > >   appear in package's architecture list (amd64)
> > > 
> > > It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
> > > really tell if I want armel or armhf (If I built the same kernel for a
> > > Squeeze system I would have been forced to use armel).
> > 
> > well, obviously the dpkg call in
> >  -arch=$(dpkg --print-architecture)
> > is wrong please fix that.
> > 
> 
> care to test belows:
> 

without a useless snippet about the lost forcearch v2:

>From f78afbe0b7fa7c49656f4ed1cf404e915f3c325b Mon Sep 17 00:00:00 2001
From: maximilian attems <max@stro.at>
Date: Thu, 6 Sep 2012 15:22:02 +0200
Subject: [PATCH v2] deb-pkg: Simplify architecture matching for cross building

No point in invoking dpkg to get the archticture of the host
we build on. Instead directly use the logic implemented
in create_package(). No need anymore to override arch.

While at it fix the linux images to be for the specific
built arch.

Signed-off-by: maximilian attems <max@stro.at>
---
 scripts/package/builddeb |   81 ++++++++++++++++++++++------------------------
 1 file changed, 38 insertions(+), 43 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb8650..a5f197b 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,44 +25,8 @@ 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)
-		debarch="$UTS_MACHINE" ;;
-	x86_64)
-		debarch=amd64 ;;
-	sparc*)
-		debarch=sparc ;;
-	s390*)
-		debarch=s390 ;;
-	ppc*)
-		debarch=powerpc ;;
-	parisc*)
-		debarch=hppa ;;
-	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 "$KBUILD_DEBARCH" ] ; then
-		debarch="$KBUILD_DEBARCH"
-	fi
-	if [ -n "$debarch" ] ; then
-		forcearch="-DArchitecture=$debarch"
-	fi
-
 	# Create the package
-	dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
+	dpkg-gencontrol -p$pname -P"$pdir"
 	dpkg --build "$pdir" ..
 }
 
@@ -83,6 +47,38 @@ fwpackagename=linux-firmware-image
 kernel_headers_packagename=linux-headers-$version
 libc_headers_packagename=linux-libc-dev
 
+# Attempt to find the correct Debian architecture
+case "$UTS_MACHINE" in
+i386|ia64|alpha)
+	debarch="$UTS_MACHINE" ;;
+x86_64)
+	debarch=amd64 ;;
+sparc*)
+	debarch=sparc ;;
+s390*)
+	debarch=s390 ;;
+ppc*)
+	debarch=powerpc ;;
+parisc*)
+	debarch=hppa ;;
+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 "$KBUILD_DEBARCH" ] ; then
+	debarch="$KBUILD_DEBARCH"
+fi
+
 if [ "$ARCH" = "um" ] ; then
 	packagename=user-mode-linux-$version
 fi
@@ -234,8 +230,8 @@ else
 Package: $packagename
 Provides: linux-image, linux-image-2.6, linux-modules-$version
 Suggests: $fwpackagename
-Architecture: any
-Description: Linux kernel, version $version
+Architecture: $debarch
+Description: Linux kernel, version $version on $debarch
  This package contains the Linux kernel, modules and corresponding other
  files, version: $version.
 EOF
@@ -252,15 +248,14 @@ mkdir -p "$destdir"
 (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
 ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
 rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-arch=$(dpkg --print-architecture)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
+Architecture: $debarch
 Provides: linux-headers, linux-headers-2.6
-Architecture: $arch
-Description: Linux kernel headers for $KERNELRELEASE on $arch
- This package provides kernel header files for $KERNELRELEASE on $arch
+Description: Linux kernel headers for $KERNELRELEASE on $debarch
+ This package provides kernel header files for $KERNELRELEASE on $debarch
  .
  This is useful for people who need to build external modules
 EOF
-- 
1.7.10.4


WARNING: multiple messages have this Message-ID (diff)
From: maximilian attems <max@stro.at>
To: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Cc: Michal Marek <mmarek@suse.cz>,
	Linux Kbuild <linux-kbuild@vger.kernel.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] builddeb: remove unneeded explicit Architecture
Date: Thu, 6 Sep 2012 14:04:16 +0000	[thread overview]
Message-ID: <20120906140416.GG28778@vostochny.stro.at> (raw)
In-Reply-To: <20120906140004.GL19848@vostochny.stro.at>

On Thu, Sep 06, 2012 at 02:00:04PM +0000, maximilian attems wrote:
> On Wed, Sep 05, 2012 at 08:26:05PM +0000, maximilian attems wrote:
> > On Wed, Sep 05, 2012 at 07:40:09PM +0300, Tzafrir Cohen wrote:
> > > 
> > > $ grep CROSS_COMPILE .config
> > > CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
> > > 
> > > Command:
> > > 
> > >   KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> > > 
> > > Error I get:
> > > 
> > >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> > >   appear in package's architecture list (amd64)
> > > 
> > > It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
> > > really tell if I want armel or armhf (If I built the same kernel for a
> > > Squeeze system I would have been forced to use armel).
> > 
> > well, obviously the dpkg call in
> >  -arch=$(dpkg --print-architecture)
> > is wrong please fix that.
> > 
> 
> care to test belows:
> 

without a useless snippet about the lost forcearch v2:

From f78afbe0b7fa7c49656f4ed1cf404e915f3c325b Mon Sep 17 00:00:00 2001
From: maximilian attems <max@stro.at>
Date: Thu, 6 Sep 2012 15:22:02 +0200
Subject: [PATCH v2] deb-pkg: Simplify architecture matching for cross building

No point in invoking dpkg to get the archticture of the host
we build on. Instead directly use the logic implemented
in create_package(). No need anymore to override arch.

While at it fix the linux images to be for the specific
built arch.

Signed-off-by: maximilian attems <max@stro.at>
---
 scripts/package/builddeb |   81 ++++++++++++++++++++++------------------------
 1 file changed, 38 insertions(+), 43 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb8650..a5f197b 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,44 +25,8 @@ 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)
-		debarch="$UTS_MACHINE" ;;
-	x86_64)
-		debarch=amd64 ;;
-	sparc*)
-		debarch=sparc ;;
-	s390*)
-		debarch=s390 ;;
-	ppc*)
-		debarch=powerpc ;;
-	parisc*)
-		debarch=hppa ;;
-	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 "$KBUILD_DEBARCH" ] ; then
-		debarch="$KBUILD_DEBARCH"
-	fi
-	if [ -n "$debarch" ] ; then
-		forcearch="-DArchitecture=$debarch"
-	fi
-
 	# Create the package
-	dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
+	dpkg-gencontrol -p$pname -P"$pdir"
 	dpkg --build "$pdir" ..
 }
 
@@ -83,6 +47,38 @@ fwpackagename=linux-firmware-image
 kernel_headers_packagename=linux-headers-$version
 libc_headers_packagename=linux-libc-dev
 
+# Attempt to find the correct Debian architecture
+case "$UTS_MACHINE" in
+i386|ia64|alpha)
+	debarch="$UTS_MACHINE" ;;
+x86_64)
+	debarch=amd64 ;;
+sparc*)
+	debarch=sparc ;;
+s390*)
+	debarch=s390 ;;
+ppc*)
+	debarch=powerpc ;;
+parisc*)
+	debarch=hppa ;;
+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 "$KBUILD_DEBARCH" ] ; then
+	debarch="$KBUILD_DEBARCH"
+fi
+
 if [ "$ARCH" = "um" ] ; then
 	packagename=user-mode-linux-$version
 fi
@@ -234,8 +230,8 @@ else
 Package: $packagename
 Provides: linux-image, linux-image-2.6, linux-modules-$version
 Suggests: $fwpackagename
-Architecture: any
-Description: Linux kernel, version $version
+Architecture: $debarch
+Description: Linux kernel, version $version on $debarch
  This package contains the Linux kernel, modules and corresponding other
  files, version: $version.
 EOF
@@ -252,15 +248,14 @@ mkdir -p "$destdir"
 (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
 ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
 rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-arch=$(dpkg --print-architecture)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
+Architecture: $debarch
 Provides: linux-headers, linux-headers-2.6
-Architecture: $arch
-Description: Linux kernel headers for $KERNELRELEASE on $arch
- This package provides kernel header files for $KERNELRELEASE on $arch
+Description: Linux kernel headers for $KERNELRELEASE on $debarch
+ This package provides kernel header files for $KERNELRELEASE on $debarch
  .
  This is useful for people who need to build external modules
 EOF
-- 
1.7.10.4


  reply	other threads:[~2012-09-06 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 10:44 [PATCH] builddeb: remove unneeded explicit Architecture Tzafrir Cohen
2012-08-31 13:50 ` Michal Marek
2012-09-05 13:05   ` Tzafrir Cohen
2012-09-05 13:26     ` Michal Marek
2012-09-05 15:14       ` maximilian attems
2012-09-05 16:40         ` Tzafrir Cohen
2012-09-05 20:26           ` maximilian attems
2012-09-06 14:00             ` maximilian attems
2012-09-06 14:00               ` maximilian attems
2012-09-06 14:04               ` maximilian attems [this message]
2012-09-06 14:04                 ` maximilian attems
2012-09-06 16:21                 ` Tzafrir Cohen
2012-09-07  0:02                   ` maximilian attems
2012-09-09 11:54                     ` Tzafrir Cohen

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=20120906140416.GG28778@vostochny.stro.at \
    --to=max@stro.at \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=tzafrir.cohen@xorcom.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 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.