From 0917187ab4aedb1ba97b3b8b3300324114f14b78 Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 25 Apr 2008 21:51:07 +0000 Subject: [PATCH] b=15316 i=cliffw i=wangyb Build OFED 1.3's kernel-ib and kernel-ib-devel with our patched lustre server kernel for RHEL 4 and 5 and SLES 10. SLES 9 is not supported by OFED 1.3. Since OFED 1.3 provides a newer open-iscsi stack, prefer those modules from the kernel-ib over those provided by the vendor kernels. Additionally, build Lustre with o2iblnd support. --- build/lbuild | 26 +++++++++++++++++++++ build/lmake | 74 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 85 insertions(+), 15 deletions(-) diff --git a/build/lbuild b/build/lbuild index 20d5439..5c35f10 100755 --- a/build/lbuild +++ b/build/lbuild @@ -430,6 +430,19 @@ load_target() fi fi fi + if [ -n "$OFED_VERSION" ] && \ + [ ! -r "$KERNELTREE/../OFED-${OFED_VERSION}.tgz" ] ; then + if (( $DOWNLOAD )) ; then + local location="http://downloads.lustre.org/public/OFED/" + echo "Downloading $location/OFED-${OFED_VERSION}.tgz..." + if ! wget -nv "$location/OFED-${OFED_VERSION}.tgz" \ + -O "$KERNELTREE/../OFED-${OFED_VERSION}.tgz" ; then + fatal 1 "Could not download OFED-${OFED_VERSION}.tgz from downloads.lustre.org." + fi + else + fatal 1 "OFED-${OFED_VERSION}.tgz not found in kernel directory $KERNELDIR." + fi + fi fi if [ "$SERIES" ] ; then @@ -521,6 +534,15 @@ untar() tar $(tarflags "$1") "$1" } +unpack_ofed() +{ + untar "$KERNELTREE/../OFED-${OFED_VERSION}.tgz" + [ -d OFED ] || ln -sf OFED-[0-9].[0-9]* OFED + pwd + ls -ld OFED OFED-[0-9].[0-9]* + ls -l OFED OFED-[0-9].[0-9]* +} + unpack_lustre() { DIRNAME="lustre-$TAG-$TIMESTAMP" @@ -1531,6 +1553,10 @@ unpack_lustre load_target EXTRA_VERSION_DELIMITER=${EXTRA_VERSION_DELIMITER:-"-"} +if [ -n "$OFED_VERSION" ]; then + unpack_ofed +fi + build_success=false if $PATCHLESS; then patchless_build_sequence && build_success=true diff --git a/build/lmake b/build/lmake index c742972..ba18136 100755 --- a/build/lmake +++ b/build/lmake @@ -437,28 +437,31 @@ depend_kernel() fi fatal 1 "update_oldconfig failed: $RC. See log above." fi - rm -f $logfile - # now notify if resulting .config is different than $CONFIG_FILE - local tmpfile=$(mktemp /tmp/XXXXXX) - diff -I '^#.*' -u "$CONFIG_FILE" .config >$tmpfile - if [ -s $tmpfile ]; then - { cat <$tmpfile + if [ -s $tmpfile ]; then + { cat <&2 fi + rm -f $tmpfile case "$VERSION" in 2.6*) @@ -493,6 +496,43 @@ build_kernel() popd >/dev/null } +build_kernel_ib() +{ + (( $BUILD_KERNEL )) || return 0 + # build kernel-ib{,-devel} + # some I/B drivers are architecture dependent and kernel-ib's configure + # does not figure it out for us ~sigh~ + local configure_options="" + case "$TARGET_ARCH" in + x86_64 | ia64) + configure_options="--with-ipath_inf-mod" + ;; + ppc64) + configure_options="--with-ipath_inf-mod --with-ehca-mod" + ;; + esac + $RPMBUILD --rebuild --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \ + --define "_topdir $(lbuild_topdir)" --target ${TARGET_ARCH} \ + --define "KVERSION ${FULL_VERSION}" \ + --define "KSRC $PWD/linux" \ + --define "LIB_MOD_DIR /lib/modules/${FULL_VERSION}" \ + --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" $(lbuild_topdir)/OFED/SRPMS/ofa_kernel-${OFED_VERSION}-ofed${OFED_VERSION}.src.rpm + + if [ ${PIPESTATUS[0]} != 0 ]; then + fatal 1 "Error building kernel-ib" + fi + + pushd "$TOPDIR" >/dev/null + rm -rf kernel-ib-devel + mkdir kernel-ib-devel + cd kernel-ib-devel + local rpm=$(ls $(lbuild_topdir)/RPMS/*/kernel-ib-devel-${OFED_VERSION}-${FULL_VERSION//-/_}.*.rpm) + rpm2cpio -itv < $rpm | cpio -id + CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}" + popd >/dev/null +} + + configure_lustre() { return 0 @@ -824,6 +864,10 @@ patch_kernel depend_kernel build_kernel +if [ -n "$OFED_VERSION" ]; then + build_kernel_ib +fi + configure_lustre build_lustre -- 1.8.3.1