Whamcloud - gitweb
LU-3389 build: Fix build fails on RHEL6.4 kernel with OFED-3.5 48/6448/5
authorShuichi Ihara <sihara@ddn.com>
Fri, 24 May 2013 18:29:50 +0000 (03:29 +0900)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 26 Jul 2013 18:36:52 +0000 (18:36 +0000)
OFED-3.5.1 supports RHEL6.4 kernel. CONFIG_COMPAT_RHEL_6_4 macro
needs to build lustre with them.

Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Change-Id: Id64aeedecd7b034fbf618c41f774852c967e6eb7
Reviewed-on: http://review.whamcloud.com/6448
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
config/lustre-build-linux.m4
contrib/lbuild/lbuild

index e2bbfeb..fb58fce 100644 (file)
@@ -94,22 +94,19 @@ AC_MSG_RESULT($RELEASE)
 AC_SUBST(RELEASE)
 
 # check is redhat/suse kernels
-AC_MSG_CHECKING([that RedHat kernel])
-LB_LINUX_TRY_COMPILE([
-               #include <$VERSION_HDIR/version.h>
-       ],[
-               #ifndef RHEL_RELEASE_CODE
-               #error "not redhat kernel"
-               #endif
-       ],[
+AC_MSG_CHECKING([for RedHat kernel version])
+       AS_IF([fgrep -q RHEL_RELEASE ${LINUX_OBJ}/include/linux/version.h], [
                RHEL_KERNEL="yes"
-               AC_MSG_RESULT([yes])
-       ],[
-               AC_MSG_RESULT([no])
-])
-
-LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
-
+               RHEL_RELEASE=$(expr 0$(awk -F \" '/ RHEL_RELEASE / { print [$]2 }' \
+                              ${LINUX_OBJ}/include/linux/version.h) + 1)
+               KERNEL_VERSION=$(sed -e 's/\(@<:@23@:>@\.@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/' <<< ${LINUXRELEASE})
+               RHEL_KERNEL_VERSION=${KERNEL_VERSION}-${RHEL_RELEASE}
+               AC_SUBST(RHEL_KERNEL_VERSION)
+               AC_MSG_RESULT([${RHEL_KERNEL_VERSION}])
+       ], [
+               AC_MSG_RESULT([not found])
+               LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
+       ])
 ])
 
 # LB_ARG_REPLACE_PATH(PACKAGE, PATH)
@@ -518,11 +515,16 @@ else
                esac
        else
                if ! $compatrdma_found; then
-                       if test -f $O2IBPATH/config.mk; then
+                       if test -f $O2IBPATH/config.mk; then
                                . $O2IBPATH/config.mk
                        elif test -f $O2IBPATH/ofed_patch.mk; then
                                . $O2IBPATH/ofed_patch.mk
                        fi
+               else
+                       case $RHEL_KERNEL_VERSION in
+                               2.6.32-358*)
+                                       EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE -DCONFIG_COMPAT_RHEL_6_4";;
+                       esac
                fi
                if test -n "$BACKPORT_INCLUDES"; then
                        OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
index f4a4099..fc1c705 100755 (executable)
@@ -539,9 +539,9 @@ download_ofed() {
 
     local location="http://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VERSION}/"
 
-    if [[ $OFED_VERSION = *-rc[0-9] ]]; then
+    if [[ $OFED_VERSION = *-[rR][cC][0-9] ]]; then
         local Mmv
-        Mmv=${OFED_VERSION%%-*}
+        Mmv=${OFED_VERSION%%-[rR][cC][0-9]}
         location="http://www.openfabrics.org/downloads/OFED/ofed-${Mmv}/"
     fi
 
@@ -1595,6 +1595,13 @@ build_ofed() {
     local linuxrelease=$(find_linux_release)
     ofed_version=$(echo $ofed_version |
                    sed -re 's/-(20[0-9]{6,6}-[0-9]{4,4}|rc[0-9]*)$//')
+    # FIXME
+    # OFED version will have 'hyphen' for minor release. (e.g. 3.5-1, instead
+    # of 3.5.1) compat-rdma and compat-rdma-devel could have same version
+    # number, but currectly not. Once OFED fix this in the future release, we
+    # can remove following filter.
+    ofed_version=$(echo $ofed_version |
+                   sed -re 's/-([0-9]*-[rR][cC][0-9]*)$//')
     local rpm=$(ls $TOPDIR/RPMS/*/${kib_rpm}-devel-${ofed_version}-${linuxrelease//-/_}.*.rpm)
     if ! rpm2cpio < $rpm | cpio -id; then
         fatal 1 "could not unpack the ${kib_rpm}-devel rpm."