- pushd "$TOPDIR" >/dev/null
- rm -rf kernel-ib-devel
- mkdir kernel-ib-devel
- cd kernel-ib-devel
- # the actual ofed RPMs don't have the -rc$n or -$date string appened that
- # might be present on the file
- local 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
- CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}"
- popd >/dev/null
+ pushd "$TOPDIR" >/dev/null
+ rm -rf kernel-ib-devel
+ mkdir kernel-ib-devel
+ cd kernel-ib-devel
+ # the actual ofed RPMs don't have the -rc$n or -$date string appened that
+ # might be present on the file
+ local linuxrelease=$(find_linux_release "$linux")
+ 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
+ CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}"
+ popd >/dev/null
+
+}
+
+build_with_srpm() {
+
+ if ! $PATCHLESS; then
+ local kernel_extra_version
+ if ! kernel_extra_version=$(build_kernel_with_srpm ${STDOUT}); then
+ fatal 1 "Failed to build the kernel from it's SRPM"
+ fi
+
+ for arch in $BUILD_ARCHS; do
+ local kernel_devel_rpm
+ if ! kernel_devel_rpm=$(find_rpm "$TOPDIR/RPMS/$arch/" provides "^$(devel_kernel_name $KERNEL_LUSTRE_NAMING) ="); then
+ fatal 1 "Failed to find a kernel development RPM in $TOPDIR/RPMS/$arch/"
+ fi
+
+ # install the -devel RPM in preparation for modules builds
+ if ! lnxrel="$kernel_extra_version" unpack_linux_devel_rpm \
+ "$TOPDIR/RPMS/$arch/$kernel_devel_rpm"; then
+ fatal 1 "Could not find the Linux tree in $TOPDIR/RPMS/$arch/$kernel_devel_rpm"
+ fi
+ done
+ else
+ # need to find and unpack the vendor's own kernel-devel for patchless
+ # client build
+ local kernelrpm
+ if ! kernelrpm=$(find_linux_rpm "-$DEVEL_KERNEL_TYPE"); then
+ fatal 1 "Could not find the kernel-$DEVEL_KERNEL_TYPE RPM in ${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}"
+ fi
+ if ! lnxrel="$lnxrel" unpack_linux_devel_rpm "$kernelrpm" "-"; then
+ fatal 1 "Could not find the Linux tree in $kernelrpm"
+ fi