From: Brian J. Murrell Date: Tue, 19 Oct 2010 02:01:31 +0000 (-0400) Subject: b=20744 use Novell supplied ofed-devel X-Git-Tag: 2.0.54.0~12 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=cf458845724c4e630b334f624ec7dfd74970f31a b=20744 use Novell supplied ofed-devel 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 --- diff --git a/build/autoconf/lustre-build-linux.m4 b/build/autoconf/lustre-build-linux.m4 index 47da3e0..1c47255 100644 --- a/build/autoconf/lustre-build-linux.m4 +++ b/build/autoconf/lustre-build-linux.m4 @@ -517,7 +517,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 diff --git a/build/lbuild b/build/lbuild index 4be4576..ab6c725 100755 --- a/build/lbuild +++ b/build/lbuild @@ -237,6 +237,9 @@ Usage: ${0##*/} [OPTION]... [-- ] --xen Builds a Xen domX kernel. + --set-value + Set's a variable to a given value. + EOF # list_targets @@ -1330,11 +1333,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})"; @@ -1395,7 +1411,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 @@ -1474,19 +1492,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 diff --git a/build/lbuild-sles b/build/lbuild-sles index 1e3902d2..6d886c6 100644 --- a/build/lbuild-sles +++ b/build/lbuild-sles @@ -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") diff --git a/build/lbuild-sles10 b/build/lbuild-sles10 index 1f32ee7..0cdf3c5 100644 --- a/build/lbuild-sles10 +++ b/build/lbuild-sles10 @@ -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-..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 + +} diff --git a/lustre/kernel_patches/targets/2.6-sles10.target.in b/lustre/kernel_patches/targets/2.6-sles10.target.in index 8bba7c9..cf0f57e 100644 --- a/lustre/kernel_patches/targets/2.6-sles10.target.in +++ b/lustre/kernel_patches/targets/2.6-sles10.target.in @@ -16,7 +16,10 @@ VERSION=$lnxmaj EXTRA_VERSION="${lnxmin#.}-${lnxrel}_lustre.@VERSION@" LUSTRE_VERSION=@VERSION@ -OFED_VERSION=1.5.1 +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" BASE_ARCHS="i686 ppc x86_64 ia64 ppc64" BIGMEM_ARCHS=""