[PATCH 1/1] deb-pkg: fix cross-compile build

From: Nuno Subtil
Date: Tue May 10 2011 - 01:26:27 EST


When generating the header package, scripts/package/builddeb was inferring the
target architecture by looking at the output of dpkg --print-architecture. This
makes it go instead through the same detection sequence that was previously
implemented in create_package.

Signed-off-by: Nuno Subtil <subtil@xxxxxxxxx>
---
scripts/package/builddeb | 42 ++++++++++++++++++++++++------------------
1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index f6cbc3d..67a72d2 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -12,21 +12,10 @@

set -e

-create_package() {
- local pname="$1" pdir="$2"
-
- cp debian/copyright "$pdir/usr/share/doc/$pname/"
- cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
- gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
- sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
- | xargs -r0 md5sum > DEBIAN/md5sums"
-
- # Fix ownership and permissions
- chown -R root:root "$pdir"
- chmod -R go-w "$pdir"
-
+infer_debian_architecture() {
# Attempt to find the correct Debian architecture
- local forcearch="" debarch=""
+ forcearch=""
+ debarch=""
case "$UTS_MACHINE" in
i386|ia64|alpha)
debarch="$UTS_MACHINE" ;;
@@ -60,6 +49,22 @@ create_package() {
if [ -n "$debarch" ] ; then
forcearch="-DArchitecture=$debarch"
fi
+}
+
+create_package() {
+ local pname="$1" pdir="$2"
+
+ cp debian/copyright "$pdir/usr/share/doc/$pname/"
+ cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
+ gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
+ sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
+ | xargs -r0 md5sum > DEBIAN/md5sums"
+
+ # Fix ownership and permissions
+ chown -R root:root "$pdir"
+ chmod -R go-w "$pdir"
+
+ infer_debian_architecture

# Create the package
dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
@@ -246,15 +251,16 @@ 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)
+
+infer_debian_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
--
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/