- $RPMBUILD --rebuild --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
- --define "_topdir ${TOPDIR}" --target ${TARGET_ARCH} \
- --define "KVERSION ${LINUXRELEASE}" \
- --define "$K_SRC ${LINUXOBJ:-${LINUX}}" \
- --define "LIB_MOD_DIR /lib/modules/${LINUXRELEASE}/updates" \
- --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --without-srp-target-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" ${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm
-
- if [ ${PIPESTATUS[0]} != 0 ]; then
+
+ local OFED_CORE="--with-core-mod --with-ipoib-mod --with-sdp-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-rds-mod --with-qlgc_vnic-mod --with-madeye-mod"
+ local OFED_HARDWARE="--with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-cxgb3-mod --with-nes-mod"
+ # some I/B drivers are architecture dependent and kernel-ib's configure
+ # does not figure it out for us ~sigh~
+ case "$TARGET_ARCH" in
+ ppc64)
+ OFED_HARDWARE="$OFED_HARDWARE --with-ehca-mod"
+ ;;
+ esac
+ # we're no longer shipping the OFED iSCSI
+ #OFED_ISCSI="--with-srp-mod --with-srp-target-mod"
+ ## ISER module has no backport support as of OFED 1.5 (i.e. only builds on
+ ##kernels >= 2.6.30)
+ #if [[ $OFED_VERSION = 1.[0-4]* ]]; then
+ # OFED_ISCSI="$OFED_ISCSI --with-iser-mod"
+ #fi
+
+ # assume we are just rebuilding the SRPM
+ local BUILD_TYPE=${BUILD_TYPE:-"--rebuild"}
+ local SOURCE="${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm"
+
+ # but switch to building from the SPEC if we need to apply patches
+ if ls ${TOPDIR}/lustre/build/patches/ofed/* >/dev/null; then
+ BUILD_TYPE="-bb"
+ rpm --define "_topdir ${TOPDIR}" -ivh $SOURCE
+ SOURCE="${TOPDIR}/SPECS/ofa_kernel.spec"
+ local file ed_fragment1 ed_fragment2 n=1
+ for file in $(ls ${TOPDIR}/lustre/build/patches/ofed/*.patch); do
+ ed_fragment1="$ed_fragment1
+Patch$n: ${file%%*/}"
+ ed_fragment2="$ed_fragment2
+%patch$n -p0"
+ cp $file ${TOPDIR}/SOURCES
+ let n=$n+1
+ done
+ for file in $(ls ${TOPDIR}/lustre/build/patches/ofed/*.ed); do
+ ed_fragment3="$ed_fragment3
+$(cat $file)"
+ let n=$n+1
+ done
+
+ if [ $n -gt 1 ]; then
+ ed $SOURCE <<EOF
+/^Source: /a
+$ed_fragment1
+.
+/^%setup /a
+$ed_fragment2
+.
+$ed_fragment3
+wq
+EOF
+ fi
+ fi
+
+ local linuxrelease=$(find_linux_release "$linux")
+ if ! $RPMBUILD $BUILD_TYPE --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
+ ${FIND_REQUIRES:+--define "__find_requires $FIND_REQUIRES"} \
+ --define "_topdir ${TOPDIR}" --target ${TARGET_ARCH} \
+ --define "KVERSION ${linuxrelease}" \
+ --define "$K_SRC ${linux}" \
+ --define "LIB_MOD_DIR /lib/modules/${linuxrelease}/updates" \
+ ${OFA_KERNEL_RELEASE:+--define "_release $OFA_KERNEL_RELEASE"} \
+ --define "configure_options --without-quilt $OFED_CORE $OFED_HARDWARE $OFED_ISCSI" \
+ ${SOURCE} 2>&1; then