diff mbox

kbuild, deb-pkg: fix Architecture field when cross compiling

Message ID 1288838560-6173-1-git-send-email-asbjorn@asbjorn.biz (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Asbjørn Sloth Tønnesen Nov. 4, 2010, 2:42 a.m. UTC
None
diff mbox

Patch

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