]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Fix DKMS builds for amd64 kernels on i386 architecture
authorThorsten Alteholz <openafs@alteholz.de>
Mon, 25 Feb 2013 23:21:05 +0000 (15:21 -0800)
committerRuss Allbery <rra@debian.org>
Mon, 25 Feb 2013 23:21:05 +0000 (15:21 -0800)
Parse the kernel version in the DKMS configuration to get the
architecture and kernel version and use that to form the AFS sysname
on i386 and amd64.  This fixes DKMS builds of the module for amd64
kernels on the i386 architecture, and provides a framework that can
be used for similar cases in the future.

debian/openafs-modules-dkms.dkms

index e99876e6fa7fd6ac8bb4e37a34ee146198c24448..981df35b3e3d48fe0f53d6463441985a085c5f2d 100644 (file)
@@ -1,5 +1,24 @@
 # DKMS configuration for the OpenAFS kernel module.  -*- sh -*-
 
+# look for arch in kernel version, this looks
+# like: 3.2.0-4-686-pae or 3.2.0-4-amd64
+ARCH=`echo $kernelver|awk -F"-" '{printf("%s",$3)}'`
+case "$ARCH" in
+  amd64) AFS_SYSNAME="amd64_linuxXX" ;;
+  486 | 686) AFS_SYSNAME="i386_linuxXX" ;;
+  *) AFS_SYSNAME="NOTHING" ;;
+esac
+
+# the kernel version should be part of the SYSNAME
+case "$kernelver" in
+  2.2.*) AFS_SYSKVERS=22 ;;
+  2.4.*) AFS_SYSKVERS=24 ;;
+  2.6.* | 3.*) AFS_SYSKVERS=26 ;;
+  *) AFS_SYSKVERS=00;; 
+esac
+_AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
+AFS_SYSNAME="$_AFS_SYSNAME"
+
 # The version is replaced at build time by dh_dkms invoked in debian/rules.
 PACKAGE_NAME="openafs"
 PACKAGE_VERSION="#MODULE_VERSION#"
@@ -8,9 +27,20 @@ BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
 DEST_MODULE_LOCATION[0]="/updates/dkms/"
 AUTOINSTALL=yes
 
-MAKE[0]="(./configure --disable-linux-syscall-probing \
+if [ "${AFS_SYSNAME}" == "NOTHING" ]; then
+  # we have no special SYSNAME so let configure make the magic
+  MAKE[0]="(./configure --disable-linux-syscall-probing \
+                      --with-linux-kernel-packaging \
+                      --with-linux-kernel-headers=${kernel_source_dir} \
+          && make \
+          && mv src/libafs/MODLOAD-*/openafs.ko .)"
+else
+  # we already know who we are so go on
+  MAKE[0]="(./configure --disable-linux-syscall-probing \
+                      --with-afs-sysname=${AFS_SYSNAME} \
                       --with-linux-kernel-packaging \
                       --with-linux-kernel-headers=${kernel_source_dir} \
           && make \
           && mv src/libafs/MODLOAD-*/openafs.ko .)"
+fi
 CLEAN="rm -f openafs.ko && make clean"