Whamcloud - gitweb
b=20744 use Novell supplied ofed-devel
authorBrian J. Murrell <brian.murrell@oracle.com>
Fri, 8 Oct 2010 14:17:39 +0000 (10:17 -0400)
committerAndrew Perepechko <andrew.perepechko@oracle.com>
Fri, 8 Oct 2010 14:26:17 +0000 (18:26 +0400)
Several changes to support using ofed-devel supplied in SLES10 SP3
(currently as PTFs).
Fix a bug with passing arguments to rpm2cpio that should not be passed.
Add a hook for distro specific module building after the kernel[-devel]
build and unpack.
Fix resolve_arch to be able to resolve either the "canonical" arch for
i?86, or the arch that the patchless kernel is expected to be.
Bail out of download_ofed earlier if using "inkernel".
Fix a bug where an rpm2cpio command was not being error checked.
Fix a bug where we were not processing and making available files
in all of the RPMS/i?86 subdirs.

i=mjmac
i=wangyb

build/autoconf/lustre-build-linux.m4
build/lbuild
build/lbuild-sles
build/lbuild-sles10
lustre/kernel_patches/kernel_configs/kernel-2.6.16-2.6-sles10-ppc64-ppc64.config
lustre/kernel_patches/kernel_configs/kernel-2.6.16-2.6-sles10-ppc64.config
lustre/kernel_patches/targets/2.6-sles10.target.in

index ff27505..9bedaae 100644 (file)
@@ -529,7 +529,7 @@ else
                        . $O2IBPATH/ofed_patch.mk
                fi
                if test -n "$BACKPORT_INCLUDES"; then
-                       OFED_BACKPORT_PATH=`echo $BACKPORT_INCLUDES | sed "s#.*/src/ofa_kernel/#$O2IBPATH/#"`
+                       OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
                        EXTRA_LNET_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_LNET_INCLUDE"
                        AC_MSG_RESULT([yes])
                else
index 219fe43..2babed6 100755 (executable)
@@ -249,6 +249,10 @@ Usage: ${0##*/} [OPTION]... [-- <lustre configure options>]
   --enable-rdac
     Enables the building of MPTLINUX with the same kernel Lustre is
     built with.
+
+  --set-value
+    Set's a variable to a given value.
+
 EOF
 
 #   list_targets
@@ -1485,11 +1489,24 @@ build_ofed() {
     local linux="$1"
     local ofed_version="$2"
 
-    # before lustre, build kernel-ib
+    # if an ofed version is given, then it means use OFED proper,
+    # not any vendor specific "inkernel" version
     if [ -z "$ofed_version" -o "$ofed_version" = "inkernel" ]; then
+        # first see if there is a distro specific override for this
+        # XXX we need to better integrate an distro specific override with
+        #     the rest of this function so that all of the reuse cache
+        #     stuff is leveraged given that 80% of this function is reuse
+        if type -p build_ofed-${DISTRO}; then
+            local ofed_location
+            ofed_location=$(build_ofed-${DISTRO} ${STDOUT})
+            CONFIGURE_FLAGS="--with-o2ib=${ofed_location} ${CONFIGURE_FLAGS}"
+            return ${PIPESTATUS[0]}
+        fi
+    else
         return 0
     fi
-
+    
+    # build kernel-ib
     if $USE_BUILD_CACHE && [ -n "$REUSEBUILD" ]; then
         local REUSE_SIGNATURE=$({ echo "$ofed_version";
                                   echo "$(find_linux_release ${linux})";
@@ -1550,7 +1567,9 @@ build_ofed() {
     ofed_version=$(echo $ofed_version |
                    sed -re 's/-(20[0-9]{6,6}-[0-9]{4,4}|rc[0-9]*)$//')
     local rpm=$(ls $TOPDIR/RPMS/*/kernel-ib-devel-${ofed_version}-${linuxrelease//-/_}.*.rpm)
-    rpm2cpio -itv < $rpm | cpio -id
+    if ! rpm2cpio < $rpm | cpio -id; then
+        fatal 1 "could not unpack the kernel-ib-devel rpm."
+    fi
     CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}"
     popd >/dev/null
 
@@ -1638,19 +1657,35 @@ EOF
         # in RPMS/$arch to real files so that that that huge mess of
         # complication known as LTS can copy them yet somewhere else.
         # is it any wonder this whole process is so damn so?  anyone ever
-        # heard of hardlinks?  it this cool new thing that allows you save
+        # heard of hardlinks?  it's this cool new thing that allows you save
         # tons of time and space by creating... well you can go read about
         # them if you have not heard about them yet.
         # can i say how much the implemenation of all of this really impedes
         # RPM reuse?
-        pushd RPMS/$TARGET_ARCH
-            for file in *; do
-                if [ -h $file ]; then
-                    cp $file foo
-                    mv foo $file
-                fi
+        local dir
+        for dir in RPMS/*; do
+            pushd $dir
+                for file in *; do
+                    if [ -h $file ]; then
+                        cp $file foo
+                        mv foo $file
+                    fi
+                done
             done
         popd
+        # also, for i?86, make sure all of the RPMs are in RPMS/$TARGET_ARCH
+        # as that's where LTS expects to find them
+        for dir in RPMS/*; do
+            if [ $dir = RPMS/$TARGET_ARCH ]; then
+                continue
+            fi
+            pushd $dir
+            local files=$(ls)
+            if [ -n "$files" ]; then
+                cp -al $files ../$TARGET_ARCH
+            fi
+            popd
+        done
     else
         return 1
     fi
index 1e3902d..6d886c6 100644 (file)
@@ -86,11 +86,20 @@ rpm_BUILD_kernel_dirname() {
 
 resolve_arch() {
     local arch="$1"
+    # because we build an i686 kernel, we need to know if the arch we are
+    # resolving for is for the patched or patchless kernel (which is i586)
+    # we really should be building an i586 kernel to match what Novell does
+    local for_patchless=${2:-true}
+    local canonical=${3:-false}
 
     case $arch in
         ppc64) arch=powerpc
                 ;;
-        i686)  arch=i386
+        i?86)  if $canonical; then
+                    arch=i386
+                elif $for_patchless; then
+                    arch=i586
+                fi
                 ;;
     esac
 
@@ -102,7 +111,7 @@ find_linux_devel_paths() {
     local path="$1"
 
     LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}
-    LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH)/$RPMSMPTYPE
+    LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
     # XXX this has been commented out in th rhel5 build file for a while
     # as it says there, it's probably not needed anymore and can be deleted
     #LINUXRELEASE=$(find_linux_release "$LINUXOBJ")
index 1f32ee7..0cdf3c5 100644 (file)
@@ -8,6 +8,12 @@ BUILD_GEN=3    # bz19975 enable the building of src.rpms by default
 
 source ${0%/*}/lbuild-sles
 
+# the location of the ofed-devel-<version>.<arch>.rpm
+OFED_DEVEL_LOCATION="$KERNELTREE"
+
+# do we want to rebuild the OFED devel RPM or use the supplied one?
+REBUILD_OFED_DEVEL_RPM=${REBUILD_OFED_DEVEL_RPM:-false}
+
 edit_specs() {
 
     # edit the SPECs with our changes
@@ -53,13 +59,13 @@ unpack_linux_devel_rpm-sles10() {
     # get the Module.symvers out of the kenrel-flavor RPM
     local kernelrpm=${callers_rpm/-source-/-$RPMSMPTYPE-}
 
-    if ! rpm2cpio < "$kernelrpm" | cpio -id ./usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH)/$RPMSMPTYPE/Module.symvers ./boot/sym\* > /dev/null 2>&1; then
+    if ! rpm2cpio < "$kernelrpm" | cpio -id ./usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS true)/$RPMSMPTYPE/Module.symvers ./boot/sym\* > /dev/null 2>&1; then
         return 255
     fi
 
     # now just sanity check that everything needed to build properly versioned
     # modules is in place
-    if [ ! -f usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH)/$RPMSMPTYPE/Module.symvers && ! -f usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$TARGET_ARCH/$RPMSMPTYPE/Module.symvers ]; then
+    if [ ! -f usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS true)/$RPMSMPTYPE/Module.symvers ]; then
         fatal 1 "cannot build kernel modules: the Kernel's Module.symvers is missing."
     fi
     if [ ! -f boot/symsets-${lnxmaj}${lnxmin}-${lnxrel}-$RPMSMPTYPE.tar.gz ]; then
@@ -69,3 +75,76 @@ unpack_linux_devel_rpm-sles10() {
     return 0
 
 }
+
+build_sles_ofed_rpm() {
+    local variant="${1:+-$1}"
+    local add_spec_edit="$2"
+
+    if $REBUILD_OFED_DEVEL_RPM; then
+        #
+        # rebuild the $variant rpm
+        #
+
+        local SOURCE="${KERNELTREE}/ofed${variant}-${OFED_DEVEL_VERSION}.src.rpm"
+
+        local targets
+        for arch in $BUILD_ARCHS; do
+            targets="--target $(resolve_arch $arch $PATCHLESS) $targets"
+        done
+        if ! $RPMBUILD --rebuild --nodeps $targets \
+                                 --define "symsetsdir ${TOPDIR}/reused/boot" \
+                                 --define "kobjdir ${LINUXOBJ%/*/*}" \
+                                 --define "_tmppath /var/tmp" \
+                                 --define "_topdir ${TOPDIR}" \
+                      ${SOURCE} 2>&1; then
+            return 255
+        fi
+    fi # $REBUILD_OFED_DEVEL_RPM; then
+
+}
+
+# additional edits need to the ofed spec
+edit_spec_ofed() {
+
+        ed ofed.spec <<"EOF"
+/^# we assume config.mk and the include files are same for all flavors/a
+built_flavors=(%flavors_to_build)
+.
+/^cp obj\/default\/config\.mk \$RPM_BUILD_ROOT\/%{_prefix}\/src\/kernel-modules-ofed/c
+cp obj/${built_flavors[0]}/config.mk $RPM_BUILD_ROOT/%{_prefix}/src/kernel-modules-ofed
+.
+/^for D in obj\/default\\\\include \$(sed 's@^.*-I\\\${CWD}\/@obj\/default\\\\@' obj\/default\/config.mk); do/c
+for D in obj/${built_flavors[0]}\\include $(sed "s@^.*-I\${CWD}/@obj/${built_flavors[0]}\\\@" obj/${built_flavors[0]}/config.mk); do
+.
+wq
+EOF
+
+}
+
+build_ofed-sles10() {
+    local outfd=$1
+
+    if [ -z "$outfd" ] || [ $outfd = 1 ]; then
+        fatal 1 "You must supply a file descriptor to ${FUNCNAME[0]} and it cannot be 1"
+    fi
+
+    if $REBUILD_OFED_DEVEL_RPM; then
+        build_sles_ofed_rpm cxgb3-NIC >&${outfd} || return ${PIPESTATUS[0]}
+        build_sles_ofed_rpm >&${outfd} || return ${PIPESTATUS[0]}
+        OFED_DEVEL_LOCATION="${TOPDIR}/RPMS/$(resolve_arch $TARGET_ARCH $PATCHLESS)"
+    fi # $REBUILD_OFED_DEVEL_RPM; then
+
+    # XXX I'm not convinced this belongs in here, but really, this is a
+    # temporary hack until we get a base O/S intalled ofed-devel
+    local arch=$TARGET_ARCH
+    if [ -n "$OFED_VERSION" -a "$OFED_VERSION" = "inkernel" ]; then
+        local ofed_devel="${OFED_DEVEL_LOCATION}/ofed-devel-${OFED_DEVEL_VERSION}.$(resolve_arch $TARGET_ARCH $PATCHLESS).rpm"
+        if ! rpm2cpio < $ofed_devel | cpio -id; then
+            fatal 1 "could not unpack the ofed-devel rpm."
+       fi
+        echo "$(pwd)/usr/src/kernel-modules-ofed/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE"
+    fi
+
+    return 0
+
+}
index dd43736..41e6d96 100644 (file)
@@ -1841,7 +1841,16 @@ CONFIG_USB_LD=m
 #
 # InfiniBand support
 #
-# CONFIG_INFINIBAND is not set
+CONFIG_INFINIBAND=m
+CONFIG_INFINIBAND_USER_MAD=m
+CONFIG_INFINIBAND_USER_ACCESS=m
+CONFIG_INFINIBAND_MTHCA=m
+CONFIG_INFINIBAND_MTHCA_DEBUG=y
+CONFIG_INFINIBAND_IPOIB=m
+CONFIG_INFINIBAND_IPOIB_DEBUG=y
+# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
+CONFIG_INFINIBAND_SRP=m
+
 
 #
 # DMA Engine support
index fff3b80..6209260 100644 (file)
@@ -1835,7 +1835,16 @@ CONFIG_USB_LD=m
 #
 # InfiniBand support
 #
-# CONFIG_INFINIBAND is not set
+CONFIG_INFINIBAND=m
+CONFIG_INFINIBAND_USER_MAD=m
+CONFIG_INFINIBAND_USER_ACCESS=m
+CONFIG_INFINIBAND_MTHCA=m
+CONFIG_INFINIBAND_MTHCA_DEBUG=y
+CONFIG_INFINIBAND_IPOIB=m
+CONFIG_INFINIBAND_IPOIB_DEBUG=y
+# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
+CONFIG_INFINIBAND_SRP=m
+
 
 #
 # DMA Engine support
index 3304706..16fa736 100644 (file)
@@ -16,7 +16,10 @@ VERSION=$lnxmaj
 EXTRA_VERSION="${lnxmin#.}-${lnxrel}_lustre.@VERSION@"
 LUSTRE_VERSION=@VERSION@
 
-OFED_VERSION=1.5.2
+OFED_VERSION=inkernel
+# if using "inkernel" on sles10, we need to know which version of ofed-devel
+# to use
+OFED_DEVEL_VERSION="1.4.2-0.8.4.1682.0.PTF.578796"
 RDAC_VERSION="09.03.0C02.0013"
 MPTLINUX_VERSION="4.18.20.04"