All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
@ 2010-11-01 23:31 Asbjoern Sloth Toennesen
  2010-11-03 22:57 ` Michal Marek
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-11-01 23:31 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

If the environment variable CROSS_COMPILE is set, override
the Architecture control field, based on the value of the
ARCH environment variable.

With this patch the following make command:

	make CROSS_COMPILE='' ARCH=i386 deb-pkg

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

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

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 49b74e1..e5b7b9b 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,20 @@ create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Check for cross compilation
+	local forcearch=""
+	env | grep -q CROSS_COMPILE
+	if [ $? -eq 0 ] ; then
+		local debarch=""
+		case "$ARCH" in
+			x86_64) debarch="amd64" ;;
+			*) debarch="$ARCH" ;;
+		esac
+		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


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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
  0 siblings, 2 replies; 34+ messages in thread
From: Michal Marek @ 2010-11-03 22:57 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen; +Cc: linux-kbuild, linux-kernel

On 2.11.2010 00:31, Asbjoern Sloth Toennesen wrote:
> If the environment variable CROSS_COMPILE is set, override
> the Architecture control field, based on the value of the
> ARCH environment variable.
> 
> With this patch the following make command:
> 
> 	make CROSS_COMPILE='' ARCH=i386 deb-pkg
> 
> will output an i386 Debian package instead of an amd64 one,
> when run on amd64 machine.

I know very little about debian packaging, but shouldn't this be done in
all cases, regardless of CROSS_COMPILE being set or not? You even show
in the above example that in some cases you don't need CROSS_COMPILE to
build a kernel for a different architecture. make rpm-pkg seems to
suffer from the same problem, btw.

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  2010-11-03 22:57 ` Michal Marek
@ 2010-11-03 23:25   ` Michal Marek
  2010-11-04  1:42   ` Asbjørn Sloth Tønnesen
  1 sibling, 0 replies; 34+ messages in thread
From: Michal Marek @ 2010-11-03 23:25 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen; +Cc: linux-kbuild, linux-kernel

On 3.11.2010 23:57, Michal Marek wrote:
> build a kernel for a different architecture. make rpm-pkg seems to
> suffer from the same problem, btw.

rpm-pkg actually handles this properly, it runs rpmbuild --target
$(UTS_MACHINE).

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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
  1 sibling, 1 reply; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-04  1:42 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

On 11/03/2010 10:57 PM, Michal Marek wrote:
> I know very little about debian packaging, but shouldn't this be done in
> all cases, regardless of CROSS_COMPILE being set or not? You even show
> in the above example that in some cases you don't need CROSS_COMPILE to
> build a kernel for a different architecture.

I had a problem earlier with Kbuild ignoring ARCH if CROSS_COMPILE
wasn't set, but can't reproduce with the current kernel, but I also
started out with upgrading it from .26, since squeezes .32 doesn't work
on Soekris net4501. So this is no longer an issue.

The other reason for make it dependent on CROSS_COMPILE at least to
begin with is that the ARCH -> debarch translation table doesn't have to
be as complete since it doesn't break anything in the currently working
non-cross compile senario. If this doesn't matter then I will send a new
patch, that doesn't depend on CROSS_COMPILE being set.

I have CC'ed the debian-kernel list, for people not on LKML:
https://patchwork.kernel.org/patch/296182/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-11-04  2:42 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

Attempt to guess the correct value of the Architecture control
field, based on the ARCH environment variable. Fallback to letting
deb-gencontrol use the host platform's architecture.

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 amd64 machine.

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

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5f1e2fc..02fd63f 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,24 @@ create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Attempt to find correct debian architecture
+	local forcearch="" debarch=""
+	case "$ARCH" in
+		x86_64) debarch="amd64" ;;
+		i386|ia64) debarch="$ARCH" ;;
+		*)
+			case "$SUBARCH" in
+				arm) debarch=$(grep -q CONFIG_AEABI=y .config \
+						&& echo armel || echo arm) ;;
+			esac
+			;;
+	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


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-04  3:38 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

On 11/04/2010 02:42 AM, Asbjoern Sloth Toennesen wrote:
> +			case "$SUBARCH" in
> +				arm) debarch=$(grep -q CONFIG_AEABI=y .config \
> +						&& echo armel || echo arm) ;;
> +			esac

Hmm, didn't test the ARM part of that patch properly SUBARCH isn't
available to builddeb. Will reply to this mail with fixed patch.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-11-04  3:44 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

Attempt to guess the correct value of the Architecture control
field, based on the ARCH environment variable. Fallback to letting
deb-gencontrol use the host platform's architecture.

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 amd64 machine.

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

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5f1e2fc..43b8826 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,23 @@ create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Attempt to find the correct Debian architecture
+	local forcearch="" debarch=""
+	case "$ARCH" in
+	i386|ia64)
+		debarch="$ARCH" ;;
+	x86_64)
+		debarch="amd64" ;;
+	*)
+		grep -q CONFIG_ARM=y .config &&
+			debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el)
+	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


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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
  0 siblings, 1 reply; 34+ messages in thread
From: Sam Ravnborg @ 2010-11-04  5:58 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On Thu, Nov 04, 2010 at 03:44:04AM +0000, Asbjoern Sloth Toennesen wrote:
> Attempt to guess the correct value of the Architecture control
> field, based on the ARCH environment variable. Fallback to letting
> deb-gencontrol use the host platform's architecture.
> 
> 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 amd64 machine.
> 
> Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
> ---
>  scripts/package/builddeb |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index 5f1e2fc..43b8826 100644
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -25,8 +25,23 @@ create_package() {
>  	chown -R root:root "$pdir"
>  	chmod -R go-w "$pdir"
>  
> +	# Attempt to find the correct Debian architecture
> +	local forcearch="" debarch=""
> +	case "$ARCH" in
> +	i386|ia64)
> +		debarch="$ARCH" ;;
> +	x86_64)
> +		debarch="amd64" ;;

On the commandline I can say ARCH=x86 - will it do the right thing then?

> +	*)
> +		grep -q CONFIG_ARM=y .config &&
> +			debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el)
> +	esac

sparc may be know as sparc32, sparc64 and sparc these days.
I recall that at least in the past debian supported sparc.

	Sam

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  2010-11-04  5:58           ` Sam Ravnborg
@ 2010-11-04 12:29             ` Asbjørn Sloth Tønnesen
  2010-11-04 12:36               ` Michal Marek
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-04 12:29 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On 11/04/2010 05:58 AM, Sam Ravnborg wrote:
> On Thu, Nov 04, 2010 at 03:44:04AM +0000, Asbjoern Sloth Toennesen wrote:
>> [...]
>> +	# Attempt to find the correct Debian architecture
>> +	local forcearch="" debarch=""
>> +	case "$ARCH" in
>> +	i386|ia64)
>> +		debarch="$ARCH" ;;
>> +	x86_64)
>> +		debarch="amd64" ;;
> 
> On the commandline I can say ARCH=x86 - will it do the right thing then?

No, not if you are cross compiling since ARCH=x86 isn't specific to
either, we would have to look at the config. In that case it is better
to do something like:

x86|i386|x86_64)
	debarch=$(grep -q CONFIG_64BIT=y .config &&
			echo amd64 || echo i386) ;;

>> +	*)
>> +		grep -q CONFIG_ARM=y .config &&
>> +			debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el)
>> +	esac
> 
> sparc may be know as sparc32, sparc64 and sparc these days.
> I recall that at least in the past debian supported sparc.

I only included the major Debian architectures in my patch since, I
don't know enough about all the smaller architectures and there config
dependencies. I have however added mips as it seemed straight forward.

AFAICT there are some problems surrounding sparc, since sparc in debian
uses 64-bit kernels, 32-bit userland, and the new sparc64 port uses
64-kernels and 64-bit userland, so we have no way of knowing if the
64-bit sparc kernel should have the Architecture field set to sparc or
sparc64.

For now I will just set it to sparc, as that is a release candidate for
squeeze, where sparc64 isn't nearly that far along.

sparc*)
	debarch=sparc ;;
mips)
	debarch=mips$(grep -q CPU_LITTLE_ENDIAN && echo el) ;;


I will sum these up in a new revision of the patch, when I get an ack
from Michal or a Debian kernel team member.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  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                 ` [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE Asbjoern Sloth Toennesen
  0 siblings, 2 replies; 34+ messages in thread
From: Michal Marek @ 2010-11-04 12:36 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: Sam Ravnborg, linux-kbuild, linux-kernel, debian-kernel

On 4.11.2010 13:29, Asbjørn Sloth Tønnesen wrote:
> No, not if you are cross compiling since ARCH=x86 isn't specific to
> either, we would have to look at the config. In that case it is better
> to do something like:
> 
> x86|i386|x86_64)
> 	debarch=$(grep -q CONFIG_64BIT=y .config &&

No, you should use $UTS_MACHINE (`uname -m` in the resulting kernel),
like make rpm-pkg does, and only translate x86_64 to amd64.

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling
  2010-11-04 12:36               ` Michal Marek
@ 2010-11-04 13:33                 ` Asbjørn Sloth Tønnesen
  2010-11-05 12:32                 ` [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE Asbjoern Sloth Toennesen
  1 sibling, 0 replies; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-04 13:33 UTC (permalink / raw)
  To: Michal Marek; +Cc: Sam Ravnborg, linux-kbuild, linux-kernel, debian-kernel

On 11/04/2010 12:36 PM, Michal Marek wrote:
> On 4.11.2010 13:29, Asbjørn Sloth Tønnesen wrote:
>> No, not if you are cross compiling since ARCH=x86 isn't specific to
>> either, we would have to look at the config. In that case it is better
>> to do something like:
>>
>> x86|i386|x86_64)
>> 	debarch=$(grep -q CONFIG_64BIT=y .config &&
> 
> No, you should use $UTS_MACHINE (`uname -m` in the resulting kernel),
> like make rpm-pkg does, and only translate x86_64 to amd64.

Ok, sorry, hadn't caught that it was on the resulting kernel.

So that solves the x86 architectures, but according to a quick git grep,
.config analysis is still needed for arm(el) and mips(el).

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE
  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
  2010-11-05 12:41                   ` maximilian attems
  2010-11-05 12:44                   ` [PATCH] kbuild, deb-pkg: select userland architectire " Asbjørn Sloth Tønnesen
  1 sibling, 2 replies; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-11-05 12:32 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

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


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE
  2010-11-05 12:32                 ` [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE Asbjoern Sloth Toennesen
@ 2010-11-05 12:41                   ` maximilian attems
  2010-11-05 13:29                     ` Asbjørn Sloth Tønnesen
  2010-11-05 12:44                   ` [PATCH] kbuild, deb-pkg: select userland architectire " Asbjørn Sloth Tønnesen
  1 sibling, 1 reply; 34+ messages in thread
From: maximilian attems @ 2010-11-05 12:41 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On Fri, Nov 05, 2010 at 12:32:41PM +0000, Asbjoern Sloth Toennesen wrote:
> 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>

thank you, indeed very cool.

Acked-by: maximilian attems <max@stro.at>
> ---
>  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" ;;

small nitpick parisc* != hppa


> +	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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE
  2010-11-05 12:32                 ` [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE Asbjoern Sloth Toennesen
  2010-11-05 12:41                   ` maximilian attems
@ 2010-11-05 12:44                   ` Asbjørn Sloth Tønnesen
  1 sibling, 0 replies; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-05 12:44 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

On 11/05/2010 12:32 PM, Asbjoern Sloth Toennesen wrote:
> kbuild, deb-pkg: select userland architectire based on UTS_MACHINE

s/architectire/architecture/g

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE
  2010-11-05 12:41                   ` 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
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-05 13:29 UTC (permalink / raw)
  To: maximilian attems; +Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On 11/05/2010 12:41 PM, maximilian attems wrote:
> On Fri, Nov 05, 2010 at 12:32:41PM +0000, Asbjoern Sloth Toennesen wrote:
>> 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>
> 
> thank you, indeed very cool.

Thanks.

>> [...]
>> +	case "$UTS_MACHINE" in
>> +	i386|ia64|alpha|hppa)
>> +		debarch="$UTS_MACHINE" ;;
> 
> small nitpick parisc* != hppa

Right, hppa should be by it self.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE
  2010-11-05 13:29                     ` Asbjørn Sloth Tønnesen
@ 2010-11-05 13:30                       ` Asbjoern Sloth Toennesen
  2010-11-05 13:36                         ` maximilian attems
                                           ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-11-05 13:30 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

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 |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5f1e2fc..0043ccd 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,41 @@ 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 "$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


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE
  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-25 14:35                         ` [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE Michal Marek
  2 siblings, 0 replies; 34+ messages in thread
From: maximilian attems @ 2010-11-05 13:36 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On Fri, Nov 05, 2010 at 01:30:08PM +0000, Asbjoern Sloth Toennesen wrote:
> 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>

please add my ack as Debian linux-2.6 maintainer.

Acked-by: maximilian attems <max@stro.at>
> ---
>  scripts/package/builddeb |   35 ++++++++++++++++++++++++++++++++++-
>  1 files changed, 34 insertions(+), 1 deletions(-)
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE
  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-25 14:35                         ` [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE Michal Marek
  2 siblings, 1 reply; 34+ messages in thread
From: Sven-Haegar Koch @ 2010-11-05 13:42 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On Fri, 5 Nov 2010, Asbjoern Sloth Toennesen wrote:

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

> 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.

How do I either select a differnet package-arch or reverse to the 
current way?

I am right now using 'make ARCH=x86_64 deb-pkg' on a 32bit userspace
environment running with a 64bit kernel, wanting to create packages to 
be installed in this i386 arch.

(As I want 64bit support where possible (mostly for AES-NI support in 
dm-crypt), but don't have the time available to do a complete userspace 
reinstall and reconfiguration)

c'ya
sven-haegar

-- 
Three may keep a secret, if two of them are dead.
- Ben F.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE
  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
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-11-06 19:04 UTC (permalink / raw)
  To: Sven-Haegar Koch; +Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On 11/05/2010 01:42 PM, Sven-Haegar Koch wrote:
> On Fri, 5 Nov 2010, Asbjoern Sloth Toennesen wrote:
> 
>> Instead of creating the debian package for the compiling userland,
>> create it for a userland matching the kernel thats being compiled.
> 
>> 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.
> 
> How do I either select a differnet package-arch or reverse to the 
> current way?
> 
> I am right now using 'make ARCH=x86_64 deb-pkg' on a 32bit userspace
> environment running with a 64bit kernel, wanting to create packages to 
> be installed in this i386 arch.
>
> (As I want 64bit support where possible (mostly for AES-NI support in 
> dm-crypt), but don't have the time available to do a complete userspace 
> reinstall and reconfiguration)

Sounds like an one off thing, so in your case forcing the installation
should work:

	dpkg --force-architecture linux-image-*.deb

The problem with that approach is that it doesn't work with APT, but I
doubt that there are any private APT repositories with this environment.

The issue with one kernel and 2 userspaces will also arise in sparc,
when the sparc64 userland gets going. So it will need to be dealt with
at some point, so I create a 3 lines additional patch for it.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH] kbuild, deb-pkg: support overriding userland architecture
  2010-11-06 19:04                           ` Asbjørn Sloth Tønnesen
@ 2010-11-06 19:05                             ` Asbjoern Sloth Toennesen
  2010-11-07  8:24                               ` Américo Wang
                                                 ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-11-06 19:05 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

Usefull if building for sparc64 userland, because the
sparc and sparc64 userlands use the same 64-bit kernel,
making it impossible to always select the correct userland
architecture for the resulting debian package.

Might also be usefull, if you want a i386 userland with a amd64 kernel.

Example usage:
	make DEBARCH=i386 deb-pkg

This patch is based on my 'kbuild, deb-pkg: select
userland architecture based on UTS_MACHINE' patch.

LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
---
 scripts/package/builddeb |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 0043ccd..4772a73 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -54,6 +54,9 @@ create_package() {
 		echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
 		echo "" >&2
 	esac
+	if [ -n "$DEBARCH" ] ; then
+		debarch="$DEBARCH"
+	fi
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: support overriding userland architecture
  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-12-03 17:48                               ` [PATCH] " maximilian attems
  2 siblings, 0 replies; 34+ messages in thread
From: Américo Wang @ 2010-11-07  8:24 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On Sat, Nov 06, 2010 at 07:05:20PM +0000, Asbjoern Sloth Toennesen wrote:
>Usefull if building for sparc64 userland, because the
>sparc and sparc64 userlands use the same 64-bit kernel,
>making it impossible to always select the correct userland
>architecture for the resulting debian package.
>
>Might also be usefull, if you want a i386 userland with a amd64 kernel.
>
>Example usage:
>	make DEBARCH=i386 deb-pkg
>
>This patch is based on my 'kbuild, deb-pkg: select
>userland architecture based on UTS_MACHINE' patch.
>

This is a good idea. :)

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>

Thanks.

-- 
Live like a child, think like the god.
 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: select userland architecture based on UTS_MACHINE
  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-25 14:35                         ` Michal Marek
  2 siblings, 0 replies; 34+ messages in thread
From: Michal Marek @ 2010-11-25 14:35 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen; +Cc: linux-kbuild, linux-kernel, debian-kernel

On Fri, Nov 05, 2010 at 01:30:08PM +0000, Asbjoern Sloth Toennesen wrote:
> 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 |   35 ++++++++++++++++++++++++++++++++++-
>  1 files changed, 34 insertions(+), 1 deletions(-)

Applied to kbuild-2.6.git#packaging, thanks.

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: support overriding userland architecture
  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-03 17:48                               ` [PATCH] " maximilian attems
  2 siblings, 2 replies; 34+ messages in thread
From: Michal Marek @ 2010-11-25 14:37 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen; +Cc: linux-kbuild, linux-kernel, debian-kernel

On Sat, Nov 06, 2010 at 07:05:20PM +0000, Asbjoern Sloth Toennesen wrote:
> Usefull if building for sparc64 userland, because the
> sparc and sparc64 userlands use the same 64-bit kernel,
> making it impossible to always select the correct userland
> architecture for the resulting debian package.
> 
> Might also be usefull, if you want a i386 userland with a amd64 kernel.
> 
> Example usage:
> 	make DEBARCH=i386 deb-pkg

This variable deserves a mention in Documentation/kbuild/kbuild.txt not
just in the commit log. Otherwise the patch is OK with me.  

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: support overriding userland architecture
  2010-11-25 14:37                               ` Michal Marek
@ 2010-11-25 19:10                                 ` Sam Ravnborg
  2010-12-08 21:35                                 ` [PATCH v2] " Asbjoern Sloth Toennesen
  1 sibling, 0 replies; 34+ messages in thread
From: Sam Ravnborg @ 2010-11-25 19:10 UTC (permalink / raw)
  To: Michal Marek
  Cc: Asbjoern Sloth Toennesen, linux-kbuild, linux-kernel, debian-kernel

On Thu, Nov 25, 2010 at 03:37:39PM +0100, Michal Marek wrote:
> On Sat, Nov 06, 2010 at 07:05:20PM +0000, Asbjoern Sloth Toennesen wrote:
> > Usefull if building for sparc64 userland, because the
> > sparc and sparc64 userlands use the same 64-bit kernel,
> > making it impossible to always select the correct userland
> > architecture for the resulting debian package.
> > 
> > Might also be usefull, if you want a i386 userland with a amd64 kernel.
> > 
> > Example usage:
> > 	make DEBARCH=i386 deb-pkg
> 
> This variable deserves a mention in Documentation/kbuild/kbuild.txt not
> just in the commit log. Otherwise the patch is OK with me.  
kbuild related variables is usually named KBUILD_* - but not all of them.

	Sam

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: support overriding userland architecture
  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-12-03 17:48                               ` maximilian attems
  2010-12-03 19:37                                 ` Asbjørn Sloth Tønnesen
  2 siblings, 1 reply; 34+ messages in thread
From: maximilian attems @ 2010-12-03 17:48 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

hello Asbjoern,

On Sat, 06 Nov 2010, Asbjoern Sloth Toennesen wrote:

> Usefull if building for sparc64 userland, because the
> sparc and sparc64 userlands use the same 64-bit kernel,
> making it impossible to always select the correct userland
> architecture for the resulting debian package.
> 
> Might also be usefull, if you want a i386 userland with a amd64 kernel.
> 
> Example usage:
> 	make DEBARCH=i386 deb-pkg
> 
> This patch is based on my 'kbuild, deb-pkg: select
> userland architecture based on UTS_MACHINE' patch.

care to repost with KBUILD_ prefix, to keep namespace sane and mention
in  Documentation/kbuild/kbuild.txt together with the relevant acks.
It be really cool to have that in next 2.6.38.

thanks
 
> LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
> Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>

Acked-by: maximilian attems <max@stro.at>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] kbuild, deb-pkg: support overriding userland architecture
  2010-12-03 17:48                               ` [PATCH] " maximilian attems
@ 2010-12-03 19:37                                 ` Asbjørn Sloth Tønnesen
  0 siblings, 0 replies; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-12-03 19:37 UTC (permalink / raw)
  To: maximilian attems; +Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

Hi Max,

On 12/03/2010 05:48 PM, maximilian attems wrote:
> On Sat, 06 Nov 2010, Asbjoern Sloth Toennesen wrote:
>> Usefull if building for sparc64 userland, because the
>> sparc and sparc64 userlands use the same 64-bit kernel,
>> making it impossible to always select the correct userland
>> architecture for the resulting debian package.
>>
>> Might also be usefull, if you want a i386 userland with a amd64 kernel.
>>
>> Example usage:
>> 	make DEBARCH=i386 deb-pkg
>>
>> This patch is based on my 'kbuild, deb-pkg: select
>> userland architecture based on UTS_MACHINE' patch.
>
> care to repost with KBUILD_ prefix, to keep namespace sane and mention
> in  Documentation/kbuild/kbuild.txt together with the relevant acks.
> It be really cool to have that in next 2.6.38.

Sure its on my todo for the weekend, have just had an insane week.

I just noticed the armhf port effort yesterday, that would also need
this patch, I will add your Ack-by when sending the updated patch.

I also have a bunch of e1000e cleanups scheduled for 2.6.38, will submit
to netdev this weekend as well.

Thanks, for the reminding effort.

-- 
Best regards
Asbjørn Sloth Tønnesen
asbjorn.biz

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2] kbuild, deb-pkg: support overriding userland architecture
  2010-11-25 14:37                               ` Michal Marek
  2010-11-25 19:10                                 ` Sam Ravnborg
@ 2010-12-08 21:35                                 ` Asbjoern Sloth Toennesen
  2010-12-09 14:24                                   ` maximilian attems
  1 sibling, 1 reply; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-12-08 21:35 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

Usefull if building for sparc64 userland, because the
sparc and sparc64 userlands use the same 64-bit kernel,
making it impossible to always select the correct userland
architecture for the resulting debian package.

Might also be usefull, if you want a i386 userland with a amd64 kernel.

Example usage:
	make DEBARCH=i386 deb-pkg

LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: maximilian attems <max@stro.at>
---
 Documentation/kbuild/kbuild.txt |    8 ++++++++
 scripts/package/builddeb        |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 634c625..2940df0 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -60,6 +60,14 @@ But some architectures such as x86 and sparc have aliases.
 x86: i386 for 32 bit, x86_64 for 64 bit
 sparc: sparc for 32 bit, sparc64 for 64 bit
 
+DEBARCH
+--------------------------------------------------
+For the deb-pkg target, allows overriding the normal heuristics deployed by
+deb-deb. Normally deb-pkg attempts to guess the right architecture based on
+the UTS_MACHINE variable, and on some architectures also the kernel config.
+The value of DEBARCH is assumed (not checked) to be a valid Debian
+architecture.
+
 CROSS_COMPILE
 --------------------------------------------------
 Specify an optional fixed part of the binutils filename.
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5d6be3f..22b6995 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -54,6 +54,9 @@ create_package() {
 		echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
 		echo "" >&2
 	esac
+	if [ -n "$DEBARCH" ] ; then
+		debarch="$DEBARCH"
+	fi
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] kbuild, deb-pkg: support overriding userland architecture
  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
  0 siblings, 1 reply; 34+ messages in thread
From: maximilian attems @ 2010-12-09 14:24 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen
  Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On Wed, Dec 08, 2010 at 09:35:50PM +0000, Asbjoern Sloth Toennesen wrote:
> Usefull if building for sparc64 userland, because the
> sparc and sparc64 userlands use the same 64-bit kernel,
> making it impossible to always select the correct userland
> architecture for the resulting debian package.
> 
> Might also be usefull, if you want a i386 userland with a amd64 kernel.
> 
> Example usage:
> 	make DEBARCH=i386 deb-pkg

hmm the conclusion was to prepend a KBUILD_ prefix for a kbuild variable?
Any reason why that was overlooked?

I checked man devscripts and saw yet no definition of DEBARCH, but in order
not to have any potential conflicts and to keep namespase sane I think
it is very much preferred to use KBUILD_DEBARCH.

thanks

-- 
maks

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] kbuild, deb-pkg: support overriding userland architecture
  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
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-12-09 15:23 UTC (permalink / raw)
  To: maximilian attems; +Cc: Michal Marek, linux-kbuild, linux-kernel, debian-kernel

On 12/09/2010 02:24 PM, maximilian attems wrote:
> On Wed, Dec 08, 2010 at 09:35:50PM +0000, Asbjoern Sloth Toennesen wrote:
>> Usefull if building for sparc64 userland, because the
>> sparc and sparc64 userlands use the same 64-bit kernel,
>> making it impossible to always select the correct userland
>> architecture for the resulting debian package.
>>
>> Might also be usefull, if you want a i386 userland with a amd64 kernel.
>>
>> Example usage:
>> 	make DEBARCH=i386 deb-pkg
> 
> hmm the conclusion was to prepend a KBUILD_ prefix for a kbuild variable?
> Any reason why that was overlooked?
> 
> I checked man devscripts and saw yet no definition of DEBARCH, but in order
> not to have any potential conflicts and to keep namespase sane I think
> it is very much preferred to use KBUILD_DEBARCH.

Sorry, I forgot it, patch comming up.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v3] kbuild, deb-pkg: support overriding userland architecture
  2010-12-09 15:23                                     ` Asbjørn Sloth Tønnesen
@ 2010-12-09 15:24                                       ` Asbjoern Sloth Toennesen
  2010-12-09 15:34                                         ` Michal Marek
  0 siblings, 1 reply; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-12-09 15:24 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

Usefull if building for sparc64 userland, because the
sparc and sparc64 userlands use the same 64-bit kernel,
making it impossible to always select the correct userland
architecture for the resulting debian package.

Might also be usefull, if you want a i386 userland with a amd64 kernel.

Example usage:
	make KBUILD_DEBARCH=i386 deb-pkg

LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: maximilian attems <max@stro.at>
---
 Documentation/kbuild/kbuild.txt |    8 ++++++++
 scripts/package/builddeb        |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 634c625..9cf3bf0 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -60,6 +60,14 @@ But some architectures such as x86 and sparc have aliases.
 x86: i386 for 32 bit, x86_64 for 64 bit
 sparc: sparc for 32 bit, sparc64 for 64 bit
 
+KBUILD_DEBARCH
+--------------------------------------------------
+For the deb-pkg target, allows overriding the normal heuristics deployed by
+deb-deb. Normally deb-pkg attempts to guess the right architecture based on
+the UTS_MACHINE variable, and on some architectures also the kernel config.
+The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
+architecture.
+
 CROSS_COMPILE
 --------------------------------------------------
 Specify an optional fixed part of the binutils filename.
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5d6be3f..ffe2419 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -54,6 +54,9 @@ create_package() {
 		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
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v3] kbuild, deb-pkg: support overriding userland architecture
  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
  0 siblings, 2 replies; 34+ messages in thread
From: Michal Marek @ 2010-12-09 15:34 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen; +Cc: linux-kbuild, linux-kernel, debian-kernel

On 9.12.2010 16:24, Asbjoern Sloth Toennesen wrote:
> Usefull if building for sparc64 userland, because the
> sparc and sparc64 userlands use the same 64-bit kernel,
> making it impossible to always select the correct userland
> architecture for the resulting debian package.
> 
> Might also be usefull, if you want a i386 userland with a amd64 kernel.
> 
> Example usage:
> 	make KBUILD_DEBARCH=i386 deb-pkg
> 
> LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
> Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
> Acked-by: maximilian attems <max@stro.at>
> ---
>  Documentation/kbuild/kbuild.txt |    8 ++++++++
>  scripts/package/builddeb        |    3 +++
>  2 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
> index 634c625..9cf3bf0 100644
> --- a/Documentation/kbuild/kbuild.txt
> +++ b/Documentation/kbuild/kbuild.txt
> @@ -60,6 +60,14 @@ But some architectures such as x86 and sparc have aliases.
>  x86: i386 for 32 bit, x86_64 for 64 bit
>  sparc: sparc for 32 bit, sparc64 for 64 bit
>  
> +KBUILD_DEBARCH
> +--------------------------------------------------
> +For the deb-pkg target, allows overriding the normal heuristics deployed by
> +deb-deb. Normally deb-pkg attempts to guess the right architecture based on
   ^^^^^^^

deb-pkg?

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3] kbuild, deb-pkg: support overriding userland architecture
  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
  1 sibling, 0 replies; 34+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2010-12-09 15:42 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

On 12/09/2010 03:34 PM, Michal Marek wrote:
> On 9.12.2010 16:24, Asbjoern Sloth Toennesen wrote:
>> Usefull if building for sparc64 userland, because the
>> sparc and sparc64 userlands use the same 64-bit kernel,
>> making it impossible to always select the correct userland
>> architecture for the resulting debian package.
>>
>> Might also be usefull, if you want a i386 userland with a amd64 kernel.
>>
>> Example usage:
>> 	make KBUILD_DEBARCH=i386 deb-pkg
>>
>> LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
>> Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
>> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
>> Acked-by: maximilian attems <max@stro.at>
>> ---
>>  Documentation/kbuild/kbuild.txt |    8 ++++++++
>>  scripts/package/builddeb        |    3 +++
>>  2 files changed, 11 insertions(+), 0 deletions(-)
>>
>> diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
>> index 634c625..9cf3bf0 100644
>> --- a/Documentation/kbuild/kbuild.txt
>> +++ b/Documentation/kbuild/kbuild.txt
>> @@ -60,6 +60,14 @@ But some architectures such as x86 and sparc have aliases.
>>  x86: i386 for 32 bit, x86_64 for 64 bit
>>  sparc: sparc for 32 bit, sparc64 for 64 bit
>>  
>> +KBUILD_DEBARCH
>> +--------------------------------------------------
>> +For the deb-pkg target, allows overriding the normal heuristics deployed by
>> +deb-deb. Normally deb-pkg attempts to guess the right architecture based on
>    ^^^^^^^
> 
> deb-pkg?

Sure. Anything else before I make a v4?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v4] kbuild, deb-pkg: support overriding userland architecture
  2010-12-09 15:34                                         ` Michal Marek
  2010-12-09 15:42                                           ` Asbjørn Sloth Tønnesen
@ 2010-12-12 17:39                                           ` Asbjoern Sloth Toennesen
  2010-12-20 15:53                                             ` Michal Marek
  1 sibling, 1 reply; 34+ messages in thread
From: Asbjoern Sloth Toennesen @ 2010-12-12 17:39 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, debian-kernel

Usefull if building for sparc64 userland, because the
sparc and sparc64 userlands use the same 64-bit kernel,
making it impossible to always select the correct userland
architecture for the resulting debian package.

Might also be usefull, if you want a i386 userland with a amd64 kernel.

Example usage:
	make KBUILD_DEBARCH=i386 deb-pkg

LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: maximilian attems <max@stro.at>
---
 Documentation/kbuild/kbuild.txt |    8 ++++++++
 scripts/package/builddeb        |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 634c625..b146eb8 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -51,6 +51,14 @@ Specify the output directory when building the kernel.
 The output directory can also be specificed using "O=...".
 Setting "O=..." takes precedence over KBUILD_OUTPUT.
 
+KBUILD_DEBARCH
+--------------------------------------------------
+For the deb-pkg target, allows overriding the normal heuristics deployed by
+deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
+the UTS_MACHINE variable, and on some architectures also the kernel config.
+The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
+architecture.
+
 ARCH
 --------------------------------------------------
 Set ARCH to the architecture to be built.
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5d6be3f..ffe2419 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -54,6 +54,9 @@ create_package() {
 		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
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v4] kbuild, deb-pkg: support overriding userland architecture
  2010-12-12 17:39                                           ` [PATCH v4] " Asbjoern Sloth Toennesen
@ 2010-12-20 15:53                                             ` Michal Marek
  0 siblings, 0 replies; 34+ messages in thread
From: Michal Marek @ 2010-12-20 15:53 UTC (permalink / raw)
  To: Asbjoern Sloth Toennesen; +Cc: linux-kbuild, linux-kernel, debian-kernel

On Sun, Dec 12, 2010 at 05:39:40PM +0000, Asbjoern Sloth Toennesen wrote:
> Usefull if building for sparc64 userland, because the
> sparc and sparc64 userlands use the same 64-bit kernel,
> making it impossible to always select the correct userland
> architecture for the resulting debian package.
> 
> Might also be usefull, if you want a i386 userland with a amd64 kernel.
> 
> Example usage:
> 	make KBUILD_DEBARCH=i386 deb-pkg
> 
> LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
> Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
> Acked-by: maximilian attems <max@stro.at>

Applied to kbuild-2.6.git#packaging, thanks.

Michal

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2010-12-20 15:53 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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                 ` [PATCH] kbuild, deb-pkg: select userland architectire based on UTS_MACHINE Asbjoern Sloth Toennesen
2010-11-05 12:41                   ` 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

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.