SMPTYPES="smp bigsmp default ''"
KERNCONFSMPTYPE=
PATCHLESS=false
+XEN=false
LINUXOBJ=
REUSEDKERNELMASK=
DISTRO=
pulling from CVS.
--nodownload
- Do not try to download a kernel from ftp.lustre.org
+ Do not try to download a kernel from downloads.lustre.org
--nosrc
Do not build a .src.rpm, a full kernel patch, or a patched kernel
checkouts. This is a workaround for a problem encountered when
using lbuild with tinderbox.
+ --xen
+ Builds a Xen domX kernel.
+
EOF
# list_targets
local srpm=kernel-${lnxmaj}-${lnxrel}.src.rpm
- echo "Downloading http://ftp.lustre.org/kernels/$target/old/$srpm..."
- if ! wget -nv "http://ftp.lustre.org/kernels/$target/old/$srpm" \
+ echo "Downloading http://downloads.lustre.org/public/kernels/$target/old/$srpm..."
+ if ! wget -nv "http://downloads.lustre.org/public/kernels/$target/old/$srpm" \
-O "$KERNELDIR/$srpm" ; then
- fatal 1 "Could not download target $kernel_file's kernel SRPM $srpm from ftp.lustre.org."
+ fatal 1 "Could not download target $kernel_file's kernel SRPM $srpm from downloads.lustre.org."
fi
+ [ -s "$KERNELDIR/$srpm" ] || {
+ rm -rf $KERNELDIR/$srpm
+ fatal 1 "Could not download target $kernel_file's kernel SRPM $srpm from downloads.lustre.org."
+ }
build_tarball $target $srpm
}
. "$TARGET_FILE"
+ # doesn't make any sense to build OFED for xen domX's
+ if $XEN; then
+ OFED_VERSION=""
+ fi
+
[ "$KERNEL" ] || fatal 1 "Target $TARGET did not specify a kernel."
[ "$VERSION" ] || fatal 1 "Target $TARGET did not specify a kernel version."
build_tarball $CANONICAL_TARGET $KERNEL_SRPM
else
if (( $DOWNLOAD )) ; then
- echo "Downloading http://ftp.lustre.org/kernels/$CANONICAL_TARGET/old/$KERNEL..."
- if ! wget -nv "http://ftp.lustre.org/kernels/$CANONICAL_TARGET/old/$KERNEL" -O "$KERNELDIR/$KERNEL" ; then
+ echo "Downloading http://downloads.lustre.org/public/kernels/$DISTRO/old/$KERNEL..."
+ if ! wget -nv "http://downloads.lustre.org/public/kernels/$DISTRO/old/$KERNEL" -O "$KERNELDIR/$KERNEL" ; then
# see if we can do it with an SRPM from the download site
download_and_build_tarball $CANONICAL_TARGET $KERNEL_FILE
+ else
+ [ -s "$KERNELDIR/$KERNEL" ] || {
+ rm -rf "$KERNELDIR/$KERNEL"
+ fatal 1 "Target $TARGET's kernel $KERNEL not found in directory $KERNELDIR."
+ }
fi
else
fatal 1 "Target $TARGET's kernel file $KERNEL not found in kernel directory $KERNELDIR."
fi
fi
fi
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ] && \
+ [ ! -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
done
fi
+ local XENPOSTFIX=""
+ if $XEN; then
+ XENPOSTFIX="-xen"
+ fi
if [ -f $TOPDIR/lustre/lustre/kernel_patches/kernel_configs/kernel-$lnxmaj-$TARGET-$TARGET_ARCH.config ]; then
- CONFIG_FILE="$TOPDIR/lustre/lustre/kernel_patches/kernel_configs/kernel-$lnxmaj-$TARGET-$TARGET_ARCH.config"
+ CONFIG_FILE="$TOPDIR/lustre/lustre/kernel_patches/kernel_configs/kernel-$lnxmaj-$TARGET$XENPOSTFIX-$TARGET_ARCH.config"
fi
local smptype
for smptype in $SMPTYPES; do
[ "$smptype" = "''" ] && smptype=
if [ -f $TOPDIR/lustre/lustre/kernel_patches/kernel_configs/kernel-$lnxmaj-$TARGET-$TARGET_ARCH-${smptype}.config ]; then
- CONFIG_FILE="$TOPDIR/lustre/lustre/kernel_patches/kernel_configs/kernel-$lnxmaj-$TARGET-$TARGET_ARCH-${smptype}.config"
+ CONFIG_FILE="$TOPDIR/lustre/lustre/kernel_patches/kernel_configs/kernel-$lnxmaj-$TARGET$XENPOSTFIX-$TARGET_ARCH-${smptype}.config"
KERNCONFSMPTYPE=$smptype
fi
done
- local lnxrelnew=$( echo ${lnxrel} | sed s/-/_/g )
+ local lnxrelnew=${lnxrel//-/_}
- [ -f "$CONFIG_FILE" ] || \
+ if ! $PATCHLESS && [ ! -f "$CONFIG_FILE" ]; then
fatal 1 "Config file for target $TARGET missing from $TOPDIR/lustre/lustre/kernel_patches/kernel_configs/."
+ fi
+
if [ "$EXTRA_VERSION_save" ] ; then
EXTRA_VERSION="$EXTRA_VERSION_save"
elif ! $RELEASE; then
BUILD_ARCHS=
for arch in $(uniqify "$ALL_ARCHS") ; do
- if [ -z "$TARGET_ARCHS" ] || echo "$TARGET_ARCHS" | grep "$arch" >/dev/null 2>/dev/null ; then
+ if [ -z "$TARGET_ARCHS" ] || echo "$TARGET_ARCHS" | grep -w "$arch" >/dev/null 2>/dev/null ; then
BUILD_ARCHS="$BUILD_ARCHS $arch"
fi
done
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"
prep_kernel_build()
{
+ local lmakeopts="\"\""
+ if $XEN; then
+ lmakeopts="--xen"
+ fi
# make .spec file
ENABLE_INIT_SCRIPTS=""
sed \
-e "s^@JENSEN_ARCHS@^$BOOT_ARCHS^g" \
-e "s^@KERNEL_EXTRA_VERSION@^$EXTRA_VERSION^g" \
-e "s^@KERNEL_EXTRA_VERSION_DELIMITER@^$EXTRA_VERSION_DELIMITER^g" \
+ -e "s^@KERNEL_TARGET_DELIMITER@^$TARGET_DELIMITER^g" \
-e "s^@KERNEL_RELEASE@^${EXTRA_VERSION//-/_}^g" \
-e "s^@KERNEL_SOURCE@^$KERNEL^g" \
-e "s^@KERNEL_VERSION@^$VERSION^g" \
-e "s^@SMP_ARCHS@^$SMP_ARCHS^g" \
-e "s^@SUSEBUILD@^$SUSEBUILD^g" \
-e "s^@UP_ARCHS@^$UP_ARCHS^g" \
+ -e "s^@LMAKEOPTS@^$lmakeopts^g" \
< $TOPDIR/lustre/build/lustre-kernel-2.4.spec.in \
> lustre-kernel-2.4.spec
[ -d SRPMS ] || mkdir SRPMS
[ "$KERNCONFSMPTYPE" = "" ] || smptype=$KERNCONFSMPTYPE
[ "$RPMSMPTYPE" = "" ] || smptype=$RPMSMPTYPE
- LUSTRE_EXTRA_VERSION="${lnxmaj}-${EXTRA_VERSION}"
- if [ "$PATCHLESS" = "true" -a "$DISTRO" = "sles10" ]; then
- LUSTRE_EXTRA_VERSION="${LUSTRE_EXTRA_VERSION}-${smptype}"
- else
- LUSTRE_EXTRA_VERSION="${LUSTRE_EXTRA_VERSION}${smptype}"
- fi
- LUSTRE_EXTRA_VERSION=$( echo $LUSTRE_EXTRA_VERSION | sed -e "s^-^_^g" )
+ LUSTRE_EXTRA_VERSION="${lnxmaj}${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}${TARGET_DELIMITER}${smptype}"
+ LUSTRE_EXTRA_VERSION=${LUSTRE_EXTRA_VERSION//-/_}
}
-#store RPMs and/or BUILD dir for feature reuse
+#store RPMs and/or BUILD dir for future reuse
store_for_reuse()
{
local rpmonly=$1
return 255
fi
- local lnxrelnew=$( echo ${lnxrel} | sed s/-/_/g )
- local EXTRA_VERSIONnew=$( echo ${EXTRA_VERSION} | sed s/-/_/g )
- local KERNELRPMnew=$(basename "$KERNELRPM")
+ local lnxrelnew=${lnxrel//-/_}
+ local EXTRA_VERSIONnew=${EXTRA_VERSION//-/_}
+ local KERNELRPMnew=$(basename "$KERNELRPM")
if [ ! "$rpmonly" = "rpmonly" ]; then
local builddir=
if [ ! "$KERNELCOMPILEDIR" = "" ]; then
builddir="$KERNELCOMPILEDIR"
else
builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/linux-${lnxmaj}"
- [ "$KERNELCOMPILEDIR" = "" ] || builddir="$KERNELCOMPILEDIR"
+ [ "$KERNELCOMPILEDIR" = "" ] || builddir="$KERNELCOMPILEDIR"
[ -d "$builddir" ] || builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/linux-${lnxmaj}.${lnxrel}"
[ -d "$builddir" ] || builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/linux-${lnxmaj}-${lnxrel}"
- if [ ! -d "$builddir" ]; then
+ if [ ! -d "$builddir" ]; then
pushd "BUILD/lustre-kernel-${lnxmaj}/lustre/" || return 255
local basebuilddir=$(ls -d linux-${lnxmaj}* | head -1)
[ "$basebuilddir" = "" ] || builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/${basebuilddir}"
popd
- fi
+ fi
fi
[ -d "$builddir" ] || return 255
- local dstdir="${REUSEBUILD}/${TIMESTAMP}/linux-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}"
- ( $PATCHLESS ) && dstdir="${REUSEBUILD}/${TIMESTAMP}/linux-$KERNELRPMnew" && \
- dstdir="${dstdir%.rpm}"
- [ -d "$dstdir" ] && rm -rf "$dstdir"
+ local dstdir="${REUSEBUILD}/${TIMESTAMP}/linux-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}"
+ ( $PATCHLESS ) && dstdir="${REUSEBUILD}/${TIMESTAMP}/linux-$KERNELRPMnew" && \
+ dstdir="${dstdir%.rpm}"
+ [ -d "$dstdir" ] && rm -rf "$dstdir"
mv "${builddir}" "$dstdir" || return 255
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
+ # move the OFED kernel-ib-devel tree as well
+ mv "${builddir%/*}/kernel-ib-devel/usr/src/ofa_kernel" "${dstdir%/*}" || return 255
+ fi
fi
#store kernel rpm
local kernelrpmname="kernel-lustre-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}.rpm"
[ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] || kernelrpmname="kernel-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSNnew}.${TARGET_ARCH}.rpm"
- ( $PATCHLESS ) && [ -f "$KERNELRPM" ] && kernelrpmname="$KERNELRPMnew"
+ ( $PATCHLESS ) && [ -f "$KERNELRPM" ] && kernelrpmname="$KERNELRPMnew"
if [ "$rpmonly" = "rpmonly" ] && [ -f "${REUSEBUILD}/${TIMESTAMP}/${kernelrpmname}" ]; then
echo "RPM already exist in store directory tree"
else
else
[ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] && cp -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" "${REUSEBUILD}/${TIMESTAMP}/"
fi
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
+ # store kernel-ib RPMs
+ local rpmname
+ for rpmname in "kernel-ib" "kernel-ib-devel"; do
+ rpmname="${rpmname}-${OFED_VERSION}"
+ if $PATCHLESS; then
+ rpmname="${rpmname}-${LINUXRELEASE//-/_}"
+ else
+ rpmname="${rpmname}-${lnxmaj}${EXTRA_VERSION_DELIMITER//-/_}${EXTRA_VERSIONnew}${TARGET_DELIMITER//-/_}${KERNCONFSMPTYPE}"
+ fi
+ rpmname="${rpmname}.${TARGET_ARCH}.rpm"
+ if [ "$rpmonly" = "rpmonly" ] && [ -f "${REUSEBUILD}/${TIMESTAMP}/${rpmname}" ]; then
+ echo "RPM already exist in store directory tree"
+ else
+ [ -f "RPMS/${TARGET_ARCH}/${rpmname}" ] && cp -f "RPMS/${TARGET_ARCH}/${rpmname}" "${REUSEBUILD}/${TIMESTAMP}/"
+ fi
+ done
+ fi
+}
+
+set_rpm_smp_type()
+{
+ local infact_arch=${TARGET_ARCH}
+ RPMSMPTYPE=default
+ [ "$infact_arch" == "i586" ] && infact_arch="i686"
+ for smp_type in $SMP_ARCHS; do
+ [ $infact_arch == $smp_type ] && RPMSMPTYPE=smp && break
+ done
+ for smp_type in $BIGSMP_ARCHS; do
+ [ $infact_arch == $smp_type ] && RPMSMPTYPE=bigsmp && break
+ done
+}
+
+# This function takes a linux source pool and digs out the linux release
+# from it
+find_linux_release() {
+ local SRCDIR="$1"
+
+ local LINUXRELEASEHEADER=$SRCDIR/include/linux/version.h
+ if [ -s $SRCDIR/include/linux/utsrelease.h ]; then
+ LINUXRELEASEHEADER=$SRCDIR/include/linux/utsrelease.h
+ fi
+
+ sed -ne 's/#define UTS_RELEASE "\(.*\)"$/\1/p' $LINUXRELEASEHEADER
+
}
#unpack kernel(/source/devel) RPM
unpack_linux_rpm()
{
local prefix=$1
+ local delimiter=${2:-"-"}
local pathtorpms="${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}"
local kernelbinaryrpm=
[ -d $pathtorpms ] || return 255
local rpmfile=
- local smptype=
+ local wanted_kernel="${lnxmaj}${delimiter}${lnxrel}"
for arch in $TARGET_ARCHS_ALL; do
- for smptype in $SMPTYPES; do
- [ "$smptype" = "''" ] && smptype=
- [ "$smptype" = "" ] || smptype="-${smptype}"
- case "$DISTRO" in
- sles10)
- rpmfile="kernel${smptype}${prefix}-${lnxmaj}.${lnxrel}.${arch}.rpm"
- kernelbinaryrpm="kernel${smptype}-${lnxmaj}.${lnxrel}.${arch}.rpm"
- ;;
- *)
- rpmfile="kernel${smptype}${prefix}-${lnxmaj}-${lnxrel}.${arch}.rpm"
- kernelbinaryrpm="kernel${smptype}-${lnxmaj}-${lnxrel}.${arch}.rpm"
- ;;
- esac
- [ -f "${pathtorpms}/${arch}/${kernelbinaryrpm}" ] && KERNELRPM="${pathtorpms}/${arch}/${kernelbinaryrpm}"
- [ -f "${pathtorpms}/${arch}/${rpmfile}" ] && RPMSMPTYPE=${smptype/-/} && break
+ for rpm in ${pathtorpms}/${arch}/*.rpm; do
+ local provides=$(rpm -q --provides -p $rpm)
+ if (echo $provides | grep -q "kernel${prefix} = $wanted_kernel"); then
+ KERNELRPM=$rpm
+ fi
done
- [ -f "${pathtorpms}/${arch}/${kernelbinaryrpm}" ] && KERNELRPM="${pathtorpms}/${arch}/${kernelbinaryrpm}"
- [ -f "${pathtorpms}/${arch}/${rpmfile}" ] && TARGET_ARCH="$arch" && BUILD_ARCHS="$arch"
- [ -f "${pathtorpms}/${arch}/${rpmfile}" ] && break
+ [ -f "$KERNELRPM" ] && TARGET_ARCH="$arch" && BUILD_ARCHS="$arch" && break
done
- [ -f "${pathtorpms}/${TARGET_ARCH}/${rpmfile}" ] || return 255
+
+ # bleah
+ set_rpm_smp_type
+
+ [ -f "$KERNELRPM" ] || return 255
[ -d $TOPDIR/reused ] || mkdir $TOPDIR/reused
pushd $TOPDIR/reused || return 255
- rpm2cpio < "${pathtorpms}/${TARGET_ARCH}/${rpmfile}" | cpio -idc > /dev/null 2>&1
+ RC=0
+ rpm2cpio < "$KERNELRPM" | cpio -idc > /dev/null 2>&1
if [ ${PIPESTATUS[0]} -eq 0 ]; then
- local path2source=$(ls usr/src/kernels/ | grep ${lnxmaj})
- [ -d "usr/src/kernels/${path2source}" ] && LINUX="$(pwd)/usr/src/kernels/${path2source}"
+ # RHEL-style and SLES-style rpms
+ local paths="kernels/${lnxmaj}${delimiter}${lnxrel}-${TARGET_ARCH} linux-${lnxmaj}${delimiter}${lnxrel}"
+
+ for path in $paths; do
+ local src='usr/src'
+
+ if [ -d "$src/$path/" ]; then
+ LINUX="$(pwd)/$src/$path"
+ fi
+ # SLES has a separate -obj tree
+ if [ -d "$src/${path}-obj" ]; then
+ src="$src/${path}-obj"
+ local objects="$TARGET_ARCH/$RPMSMPTYPE"
+
+ # Novell, are you *TRYING* to make life hard for me?
+ if [ -d "$src/powerpc" ]; then
+ objects="powerpc/$TARGET_ARCH"
+ elif [ $TARGET_ARCH == 'i686' ]; then
+ objects="i386/$RPMSMPTYPE"
+ fi
+
+ LINUXOBJ="$(pwd)/$src/$objects"
+ fi
+ done
+ if [ -z "$LINUX" ]; then
+ RC=255
+ else
+ # dig out the release version
+ LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
+ if [ -z "$LINUXRELEASE" ]; then
+ echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"
+ RC=255
+ fi
+ fi
else
- popd
- return 255
+ RC=255
fi
popd
+ return $RC
}
#look for kernel source RPM
reuse_kernel_rpm()
{
local pathtorpm=$1
+ local pathtokernelibrpm=$2
[ "$pathtorpm" = "" ] && return 255
[ -f "$pathtorpm" ] || return 255
[ -d $TOPDIR/reused ] || mkdir $TOPDIR/reused
rpm2cpio < $pathtorpm | cpio -idc
[ ${PIPESTATUS[0]} -eq 0 ] || return 255
+ if [ -n "$pathtokernelibrpm" ] && [ -f "$pathtokernelibrpm" ]; then
+ rpm2cpio < $pathtokernelibrpm | cpio -idc
+ [ ${PIPESTATUS[0]} -eq 0 -o ${PIPESTATUS[1]} -eq 0 ] || return 255
+ CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}"
+ fi
+
local smptype=
if pushd usr/src/linux-*-obj/${TARGET_ARCH}; then
local smptypes="$SMPTYPES"
return
}
+build_kernel_ib()
+{
+ # 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
+ local K_SRC="K_SRC"
+ # ofed 1.3 had a bug in the rpm spec
+ if [ "$OFED_VERSION" = "1.3" ]; then
+ K_SRC="KSRC"
+ fi
+ $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-${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 $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 patchless lustre
patchless_build_sequence()
{
+ if [ -f $LINUX/Makefile ]; then
+ # Get the correct kernel release - I'm unsure how this can ever
+ # work otherwise, unless you're using the exact same kernel version
+ # Lustre is shipped with.
+
+ local LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
+ if [ -z "$LINUXRELEASE" ]; then
+ echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"
+ RC=255
+ fi
+
+ lnxmaj=$(echo $LINUXRELEASE | cut -f1 -d-)
+ EXTRA_VERSION=$(echo $LINUXRELEASE | cut -f2 -d-)_lustre.$LUSTRE_VERSION
+ RPMSMPTYPE=" "
+ build_lustre && buildsuccess=true
+ else
#try to build from kernel-devel RPM (RHEL)
LINUX=
TARGET_ARCH=
return 255
fi
[ -d $TOPDIR/reused ] && rm -rf $TOPDIR/reused
- unpack_linux_rpm "-devel" && rpmfound=true
- ( $rpmfound ) && build_lustre && buildsuccess=true && find_linux_source_rpm
- if ! $buildsuccess; then
- # cannot build from -devel. Try to build from kernel source RPM without rebuilding kernel
- KERNELSOURCERPM=
- # first unpack kernel binary RPM
- rpmfound=false
- [ -d $TOPDIR/reused ] && rm -rf $TOPDIR/reused
- unpack_linux_rpm && rpmfound=true
- ! ( $rpmfound ) && echo "Cannot find kernel RPM"
-
- if ! $rpmfound; then #kernel RPM not found.
- # try to reuse
- build_sequence_reuse && buildsuccess=true
- if ! $buildsuccess; then
- # reuse failed. Try to build from tarbal
- KERNELRPM=
- KERNELSOURCERPM=
- unpack_linux && LINUX="$TOPDIR/linux" && \
- build_linux fullmake copykernel && build_linux_rpm
- ! [ "$KERNELRPM" = "" ] && build_lustre && storeforreuse=true && buildsuccess=true
- fi
- else
- # next find and unpack source RPM
- rpmfound=false
- find_linux_source_rpm && rpmfound=true
- ( $rpmfound ) && \
- reuse_kernel_rpm "$KERNELSOURCERPM" && build_linux nofullmake copyrpmkernel && build_lustre && buildsuccess=true
- fi
- fi
+ local delimiter=${EXTRA_VERSION_DELIMITER:-"-"}
+ # default to source type -source and special case below
+ local type=-source
+ case "$DISTRO" in
+ rhel*)
+ type=-devel
+ ;;
+ esac
+
+ unpack_linux_rpm $type $delimiter && rpmfound=true
+
+ [ -d SRPMS ] || mkdir SRPMS
+ [ -d RPMS ] || mkdir RPMS
+ [ -d BUILD ] || mkdir BUILD
+ [ -d SOURCES ] || mkdir SOURCES
- if ! $buildsuccess && $rpmfound; then
- # build wrong. try to build kernel first
- REUSEDKERNELMASK=$(basename $KERNELRPM | sed s/\\.rpm//)
- build_sequence_reuse && buildsuccess=true
+ # first build kernel-ib
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
+ $rpmfound && build_kernel_ib
fi
-
- if ! $buildsuccess && $rpmfound; then
- build_linux fullmake copyrpmkernel && build_lustre && buildsuccess=true && storeforreuse=true
+ ( $rpmfound ) && build_lustre && buildsuccess=true && find_linux_source_rpm
fi
if $buildsuccess; then
- [ -d "RPMS/${TARGET_ARCH}" ] && [ -f "$KERNELRPM" ] && \
- cp "$KERNELRPM" RPMS/${TARGET_ARCH}/
- [ -d "RPMS/${TARGET_ARCH}" ] && [ -f "$KERNELSOURCERPM" ] && \
- cp "$KERNELSOURCERPM" RPMS/${TARGET_ARCH}/
- KERNELCOMPILEDIR="$LINUX"
+ [ -d "RPMS/${TARGET_ARCH}" ] && [ -f "$KERNELRPM" ] && \
+ cp "$KERNELRPM" RPMS/${TARGET_ARCH}/
+ [ -d "RPMS/${TARGET_ARCH}" ] && [ -f "$KERNELSOURCERPM" ] && \
+ cp "$KERNELSOURCERPM" RPMS/${TARGET_ARCH}/
+ KERNELCOMPILEDIR="$LINUX"
if $storeforreuse; then
- store_for_reuse || echo "Cannot store for feature reuse"
+ store_for_reuse || echo "Cannot store for future reuse"
fi
+
return
+ elif ! $rpmfound; then
+ echo "COULD NOT FIND VENDOR -devel or -source RPM for $DISTRO/$TARGET_ARCH: $lnxmaj-$lnxrel in $KERNELRPMSBASE"
+ return 255
+ else
+ echo "Patchless build failed."
+ return 255
fi
-
- # patchless build filed
- return 255
}
#check timestamp value. should bi 14-digits string
reusedkernelsourcerpm=$(ls ${curdir}/${REUSEDKERNELMASKnew}.rpm | head -1 )
[ -f "$reusedkernelsourcerpm" ] || continue
+ # don't need to check for kernel-ib RPM reuse here because sles9 is not supported
+ # by OFED >= 1.3.0 and this function appears to only be used for sles9
+
[ -d $TOPDIR/reused ] && rm -rf $TOPDIR/reused
- reuse_kernel_rpm "$reusedkernelsourcerpm" && build_linux nofullmake copyrpmkernel && build_lustre && buildsuccess=true
+ reuse_kernel_rpm "$reusedkernelsourcerpm" "" && build_linux nofullmake copyrpmkernel && build_lustre && buildsuccess=true
( $buildsuccess ) || continue
if ( ! $NORPM ) && ( ! $PATCHLESS ) ; then
[ -f "$reusedkernelrpm" ] && \
for curdir in $(echo $dirsforreuse); do
local reusedkernelrpm=
local reusedkernelsourcerpm=
+ local reusedkernelibrpm=
[ -d "$curdir" ] || continue
+ [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" -a
+ ! -d "${curdir%/*}/ofa_kernel" ] && continue
local reusedkernelprefix="kernel-lustre-"
( $PATCHLESS ) && reusedkernelprefix=
[ -f ${curdir}/../${reusedkernelprefix}${REUSEDKERNELMASK}.rpm ] && \
reusedkernelprefix="kernel-lustre-source-"
[ -f ${curdir}/../${reusedkernelprefix}${REUSEDKERNELMASKnew}.rpm ] && \
reusedkernelsourcerpm=$(ls ${curdir}/../${reusedkernelprefix}${REUSEDKERNELMASKnew}.rpm | head -1 )
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
+ gen_lustre_version
+ reusedkernelprefix="kernel-ib-"
+ [ -f ${curdir}/../${reusedkernelprefix}${OFED_VERSION}-${LUSTRE_EXTRA_VERSION}.${TARGET_ARCH}.rpm ] && \
+ reusedkernelibrpm=$(ls ${curdir}/../${reusedkernelprefix}${OFED_VERSION}-${LUSTRE_EXTRA_VERSION}.${TARGET_ARCH}.rpm | head -1 )
+ reusedkernelibdevelrpm=$(ls ${curdir}/../${reusedkernelprefix}devel-${OFED_VERSION}-${LUSTRE_EXTRA_VERSION}.${TARGET_ARCH}.rpm | head -1 )
+ fi
if ! ( $NORPM ) && ! [ -f "$reusedkernelrpm" ]; then #kernel rpm not found. Build all
continue
fi
if ! ( $NORPM ) && ! [ -f "$reusedkernelsourcerpm" ]; then #kernel source rpm not found. Build all
continue
fi
+ if [ -n "$OFED_VERSION" ]; then
+ if [ "$OFED_VERSION" != "inkernel" ]; then
+ if ! ( $NORPM ) && [ ! -f "$reusedkernelibrpm" -o ! -f "$reusedkernelibdevelrpm"]; then #kernel-ib{,-devel} rpm not found. Build all
+ continue
+ fi
+ CONFIGURE_FLAGS="--with-o2ib=${curdir%/*}/ofa_kernel ${CONFIGURE_FLAGS}"
+ else
+ CONFIGURE_FLAGS="--with-o2ib=yes ${CONFIGURE_FLAGS}"
+ fi
+ fi
LINUX="$curdir"
build_lustre || continue
touch "$curdir/../"
touch RPMS/${TARGET_ARCH}/kernel_was_reused
[ -f "$reusedkernelsourcerpm" ] && \
cp -f "$reusedkernelsourcerpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1
+ [ -f "$reusedkernelibrpm" ] && \
+ cp -f "$reusedkernelibrpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1
+ cp -f "$reusedkernelibdevelrpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1
fi
return
done
[ -r ~/.lbuildrc ] && . ~/.lbuildrc
-options=$(getopt -o d:D:h -l kerneltree:,distro:,kernelrpm:,reusebuild:,patchless,ldiskfs,ccache,reuse:,norpm,disable-datestamp,external-patches:,timestamp:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,publish,release,src,stage:,tag:,target:,target-archs:,with-linux: -- "$@")
+options=$(getopt -o d:D:h -l kerneltree:,distro:,kernelrpm:,reusebuild:,patchless,ldiskfs,ccache,reuse:,norpm,disable-datestamp,external-patches:,timestamp:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,publish,release,src,stage:,tag:,target:,target-archs:,with-linux:,xen -- "$@")
if [ $? != 0 ] ; then
usage 1
USE_DATESTAMP=
shift
;;
+ --xen)
+ XEN=true
+ shift
+ ;;
--)
shift
CONFIGURE_FLAGS=$@
load_target
EXTRA_VERSION_DELIMITER=${EXTRA_VERSION_DELIMITER:-"-"}
+if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
+ unpack_ofed
+fi
+
build_success=false
if $PATCHLESS; then
patchless_build_sequence && build_success=true
if ! $build_success; then
build_sequence && build_success=true
if $build_success; then
- store_for_reuse || echo "Cannot store for feature reuse"
+ store_for_reuse || echo "Cannot store for future reuse"
fi
fi
fi
else
- build_lustre
+ build_lustre && build_success=true
fi
( $build_success ) || fatal 1 "Cannot build lustre"