diff options
Diffstat (limited to 'scripts/package/builddeb')
-rw-r--r-- | scripts/package/builddeb | 79 |
1 files changed, 37 insertions, 42 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index e3429198853e..972e6520000e 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -12,47 +12,6 @@ set -e -# Attempt to find the correct Debian architecture -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*) - if grep -q '^CONFIG_ARM64=y' $KCONFIG_CONFIG ; then - debarch=arm64 - else - debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) - fi ;; -*) - 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_package() { local pname="$1" pdir="$2" @@ -66,8 +25,44 @@ 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 + if [ -n "$debarch" ] ; then + forcearch="-DArchitecture=$debarch" + fi + # Create the package - dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir" + dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" dpkg --build "$pdir" .. } |