Skip to contentSkip to conversation

kbuild, deb-pkg: set host machine after dpkg-gencontrol

PATCH In review Robert 3 participants 7 messages Apr 13, 2011 – Apr 14, 2011 Kbuild

lore
Share & tools
lore

Robert

author
#0 lore raw

PATCH 1/1 kbuild, deb-pkg: set host machine after dpkg-gencontrol

This is my first patch, so hopefully I've done it correctly. Details follow.

Regards,
Robert Gordon

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol. The patch modifies the script to guarantee the correct debian arch for the target is written to the control file instead.

---
 scripts/package/builddeb |   70 +++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 34 deletions(-)
scripts/package/builddeb +36 -34
index f6cbc3d..2a15fda 100644
@@ -26,37 +26,7 @@ create_package() {
 	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
+	local forcearch=""
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
@@ -66,6 +36,38 @@ create_package() {
 	dpkg --build "$pdir" ..
 }
 
+#Set the correct debian arch
+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
+
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 revision=$(cat .version)
@@ -252,9 +254,9 @@ cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
 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
+Architecture: $debarch
+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 lore raw
Quoted 1 line · Robert

This is my first patch, so hopefully I've done it correctly. Details follow.

looks mostly good at a quick check,
please just fix 2 small critics and resubmit.

Quoted 79 lines

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol. The patch modifies the script to guarantee the correct debian arch for the target is written to the control file instead.

---
 scripts/package/builddeb |   70 +++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 34 deletions(-)
scripts/package/builddeb +23 -31
index f6cbc3d..2a15fda 100644
@@ -26,37 +26,7 @@ create_package() {
 	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
+	local forcearch=""
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
@@ -66,6 +36,38 @@ create_package() {
 	dpkg --build "$pdir" ..
 }
 
+#Set the correct debian arch
+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

scripts/package/builddeb create_package() { · line 70

Quoted 10 lines
scripts/package/builddeb +10 -0
+    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
+

aboves is now all "whispace damaged", please use a tab for indentation. every project has it's indendation rules and linux-2.6 enforces tab not 4 spaces like python.

Quoted 7 lines
scripts/package/builddeb +0 -0
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 revision=$(cat .version)
@@ -252,9 +254,9 @@ cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename

scripts/package/builddeb cat <<EOF >> debian/control · line 262

Quoted 10 lines
scripts/package/builddeb +3 -3
 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
+Architecture: $debarch
+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

Haven't applied the patch yet, but I remember a stupid dpkg arch call. From a quick look aboves codeflow should make it unnecessary, speaking of:

arch=$(dpkg --print-architecture)

so please also remove it.

thank you.

Signature · 1 line
maks
#2 lore raw

This is my first patch submission, and I am trying to get it
right. I fixed white space issues and removed the following unneeded line:
arch=$(dpkg --print-architecture)

Regards,
Robert Gordon

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol. The patch modifies the script to guarantee the correct debian arch for the target is written to the control file instead.

---
 .../2.6-stable/KERNEL/scripts/package/builddeb     |   73 
++++++++++----------
 1 files changed, 37 insertions(+), 36 deletions(-)
scripts/package/builddeb +37 -37
index f6cbc3d..975e39a 100644
@@ -25,38 +25,7 @@ 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
+	local forcearch=""
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
@@ -66,6 +35,39 @@ create_package() {
 	dpkg --build "$pdir" ..
 }
 
+# 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
+
+
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 revision=$(cat .version)
@@ -246,15 +248,14 @@ 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)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
 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
+Architecture: $debarch
+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
---

#3 lore raw

kernel/2.6-stable/KERNEL/scripts/package/builddeb

Quoted 21 lines · On Thu, Apr 14, 2011 at 8:11 AM, <[email protected]> wrote:

    This is my first patch submission, and I am trying to get it right.  I fixed white space issues and removed the following unneeded line:
arch=$(dpkg --print-architecture)

Regards,
Robert Gordon

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol.  The patch modifies the script to guarantee the correct debian arch for the target is written to the control file instead.

---
 .../2.6-stable/KERNEL/scripts/package/builddeb     |   73
++++++++++----------

 1 files changed, 37 insertions(+), 36 deletions(-)
kernel/2.6-stable/KERNEL/scripts/package/builddeb renamed from kernel-unpatched/2.6-stable/KERNEL/scripts/package/builddeb +0 -0

Sorry Robert, my build/patch script ^^^ can really make a mess of this..

In system.sh uncomment out GIT_MODE, then you can use the git tree under the "/KERNEL" directory

But it would be better to just clone linus's tree and base the patch off that..

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Quoted 106 lines

index f6cbc3d..975e39a 100644

scripts/package/builddeb +0 -0
@@ -25,38 +25,7 @@ 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!"

Quoted 1 line

&2

-               echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
-               echo "" >&2
-       esac
-       if [ -n "$KBUILD_DEBARCH" ] ; then
-               debarch="$KBUILD_DEBARCH"
-       fi
+       local forcearch=""
       if [ -n "$debarch" ] ; then forcearch="-DArchitecture=$debarch"
       fi

scripts/package/builddeb +0 -0
@@ -66,6 +35,39 @@ create_package() {

       dpkg --build "$pdir" ..
 }

scripts/package/builddeb +33 -0
+# 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
+
+

 # Some variables and settings used throughout the script version=$KERNELRELEASE
 revision=$(cat .version)

scripts/package/builddeb +0 -0
@@ -246,15 +248,14 @@ 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)

 cat <<EOF >> debian/control

 Package: $kernel_headers_packagename
 Provides: linux-headers, linux-headers-2.6

scripts/package/builddeb +3 -3
-Architecture: $arch
-Description: Linux kernel headers for $KERNELRELEASE on $arch
- This package provides kernel header files for $KERNELRELEASE on $arch
+Architecture: $debarch
+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
---

Signature · 2 lines
Robert Nelson
http://www.rcn-ee.com/
#4 lore raw
In reply to [email protected]

This patch is now diffed against Linus's tree. The issue first arose in the 2.6.38 release.

Regards,
Robert Gordon

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol. The patch modifies the script to guarantee the correct debian arch for the target is written to the control file instead.

---
 .../scripts/package/builddeb    |   73 ++++++++++----------
 1 files changed, 37 insertions(+), 36 deletions(-)
scripts/package/builddeb +37 -37
index f6cbc3d..975e39a 100644
@@ -25,38 +25,7 @@ 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
+	local forcearch=""
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
@@ -66,6 +35,39 @@ create_package() {
 	dpkg --build "$pdir" ..
 }
 
+# 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
+
+
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 revision=$(cat .version)
@@ -246,15 +248,14 @@ 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)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
 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
+Architecture: $debarch
+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
---

#5 lore raw
In reply to [email protected]
Quoted 7 lines · On Thu, 14 Apr 2011, [email protected] wrote:

This is my first patch submission, and I am trying to get it
right. I fixed white space issues and removed the following unneeded line:
arch=$(dpkg --print-architecture)

Regards,
Robert Gordon

the patch itselfs looks good now, but I was unable to apply it, copied over to some temporary mailbox /tmp/n, but getting this:

maks@dual:~/src/linux-2.6 (debarch $)$ git am -i -s /tmp/n Patch is empty. Was it split wrong?
If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". maks@dual:~/src/linux-2.6 (debarch $|AM)$ git am --abort

it looks like your mail client borked the patch while sending it, adding everywhere an additional " " prefix.

Try to send the patch to yourself and to apply it, before resending here, also you might want to read in linux-2.6 git Documentation/email-clients.txt

I hope this helps?

kind regards

Quoted 120 lines

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol. The patch modifies the script to guarantee the correct
debian arch for the target is written to the control file instead.

---
 .../2.6-stable/KERNEL/scripts/package/builddeb     |   73
++++++++++----------
 1 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/kernel-unpatched/2.6-stable/KERNEL/scripts/package/builddeb b/kernel/2.6-stable/KERNEL/scripts/package/builddeb index f6cbc3d..975e39a 100644

scripts/package/builddeb +37 -37
@@ -25,38 +25,7 @@ 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
+	local forcearch=""
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
@@ -66,6 +35,39 @@ create_package() {
 	dpkg --build "$pdir" ..
 }
 
+# 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
+
+
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 revision=$(cat .version)
@@ -246,15 +248,14 @@ 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)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
 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
+Architecture: $debarch
+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
---

Signature · 1 line
maks
#6 lore raw
Quoted 20 lines · maximilian attems
Quoted 7 lines · On Thu, 14 Apr 2011, [email protected] wrote:

This is my first patch submission, and I am trying to get it
right. I fixed white space issues and removed the following unneeded line:
arch=$(dpkg --print-architecture)

Regards,
Robert Gordon

the patch itselfs looks good now, but I was unable to apply it, copied over to some temporary mailbox /tmp/n, but getting this:

maks@dual:~/src/linux-2.6 (debarch $)$ git am -i -s /tmp/n Patch is empty. Was it split wrong?
If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". maks@dual:~/src/linux-2.6 (debarch $|AM)$ git am --abort

Quoted 2 lines

it looks like your mail client borked the patch while sending it, adding everywhere an additional " " prefix.

scratch that comment, try to use for getting a proper patch git format-patch HEAD^..

for sending off, git send-email is very practical.

Quoted 130 lines

Try to send the patch to yourself and to apply it, before resending here, also you might want to read in linux-2.6 git Documentation/email-clients.txt

I hope this helps?

kind regards

Quoted 120 lines

scripts/package/builddeb script was setting the host machine $arch in the KERNEL/debian/control prior to an invocation of dpkg-gencontrol. The patch modifies the script to guarantee the correct
debian arch for the target is written to the control file instead.

---
 .../2.6-stable/KERNEL/scripts/package/builddeb     |   73
++++++++++----------
 1 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/kernel-unpatched/2.6-stable/KERNEL/scripts/package/builddeb b/kernel/2.6-stable/KERNEL/scripts/package/builddeb index f6cbc3d..975e39a 100644

scripts/package/builddeb +37 -37
@@ -25,38 +25,7 @@ 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
+	local forcearch=""
 	if [ -n "$debarch" ] ; then
 		forcearch="-DArchitecture=$debarch"
 	fi
@@ -66,6 +35,39 @@ create_package() {
 	dpkg --build "$pdir" ..
 }
 
+# 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
+
+
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 revision=$(cat .version)
@@ -246,15 +248,14 @@ 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)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
 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
+Architecture: $debarch
+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
---

Signature · 1 line
maks