From 1b4c2bc7af46a8d7cba2bc1d4aa8fd814dc1c3cc Mon Sep 17 00:00:00 2001 From: maximilian attems <max@xxxxxxx> Date: Thu, 6 Sep 2012 15:22:02 +0200 Subject: [PATCH] deb-pkg: Simplify architecture matching for cross building No point in invoking dpkg to get the archticture of the host we build on. Instead directly use the logic implemented in create_package(). No need anymore to override arch. While at it fix the linux images to be for the specific built arch. Signed-off-by: maximilian attems <max@xxxxxxx> --- scripts/package/builddeb | 78 +++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 90e521f..1b2fc99 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -27,42 +27,9 @@ create_package() { # 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 $KCONFIG_CONFIG && echo el) ;; - arm*) - debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;; - *) - echo "" >&2 - echo "** ** ** WARNING ** ** **" >&2 - echo "" >&2 - echo "Your architecture doesn't have it's equivalent" >&2 - echo "Debian userspace architecture defined!" >&2 - echo "Falling back to using your current userspace instead!" >&2 - echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 - echo "" >&2 - esac - if [ -n "$KBUILD_DEBARCH" ] ; then - debarch="$KBUILD_DEBARCH" - fi - if [ -n "$debarch" ] ; then - forcearch="-DArchitecture=$debarch" - fi # Create the package - dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir" + dpkg-gencontrol -p$pname -P"$pdir" dpkg --build "$pdir" .. } @@ -85,6 +52,38 @@ kernel_headers_packagename=linux-headers-$version libc_headers_packagename=linux-libc-dev dbg_packagename=$packagename-dbg +# 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 $KCONFIG_CONFIG && echo el) ;; +arm*) + debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;; +*) + echo "" >&2 + echo "** ** ** WARNING ** ** **" >&2 + echo "" >&2 + echo "Your architecture doesn't have it's equivalent" >&2 + echo "Debian userspace architecture defined!" >&2 + echo "Falling back to using your current userspace instead!" >&2 + echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 + echo "" >&2 +esac +if [ -n "$KBUILD_DEBARCH" ] ; then + debarch="$KBUILD_DEBARCH" +fi + if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi @@ -269,8 +268,8 @@ else Package: $packagename Provides: linux-image, linux-image-2.6, linux-modules-$version Suggests: $fwpackagename -Architecture: any -Description: Linux kernel, version $version +Architecture: $debarch +Description: Linux kernel, version $version on $debarch This package contains the Linux kernel, modules and corresponding other files, version: $version. EOF @@ -288,15 +287,14 @@ mkdir -p "$destdir" (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" -arch=$(dpkg --print-architecture) cat <<EOF >> debian/control Package: $kernel_headers_packagename +Architecture: $debarch Provides: linux-headers, linux-headers-2.6 -Architecture: $arch -Description: Linux kernel headers for $KERNELRELEASE on $arch - This package provides kernel header files for $KERNELRELEASE on $arch +Description: Linux kernel headers for $KERNELRELEASE on $debarch + This package provides kernel header files for $KERNELRELEASE on $debarch . This is useful for people who need to build external modules EOF -- 1.8.4.rc3