SMPTYPES="smp bigsmp default ''"
KERNCONFSMPTYPE=
PATCHLESS=false
+XEN=false
LINUXOBJ=
REUSEDKERNELMASK=
DISTRO=
checkouts. This is a workaround for a problem encountered when
using lbuild with tinderbox.
+ --xen
+ Builds a Xen domX kernel.
+
EOF
# list_targets
. "$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."
fi
fi
fi
- if [ -n "$OFED_VERSION" ] && \
+ 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/"
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
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
prep_kernel_build()
{
+ local lmakeopts="\"\""
+ if $XEN; then
+ lmakeopts="--xen"
+ fi
# make .spec file
ENABLE_INIT_SCRIPTS=""
sed \
-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
dstdir="${dstdir%.rpm}"
[ -d "$dstdir" ] && rm -rf "$dstdir"
mv "${builddir}" "$dstdir" || return 255
- if [ -n "$OFED_VERSION" ]; then
+ 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
else
[ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] && cp -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" "${REUSEBUILD}/${TIMESTAMP}/"
fi
- if [ -n "$OFED_VERSION" ]; then
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
# store kernel-ib RPMs
local rpmname
for rpmname in "kernel-ib" "kernel-ib-devel"; do
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()
{
RC=255
else
# dig out the release version
- local LINUXRELEASEHEADER=version.h
- if test -s ${LINUXOBJ:-$LINUX}/include/linux/utsrelease.h ; then
- LINUXRELEASEHEADER=utsrelease.h
- fi
- LINUXRELEASE=$(sed -ne 's/#define UTS_RELEASE "\(.*\)"$/\1/p' ${LINUXOBJ:-$LINUX}/include/linux/$LINUXRELEASEHEADER)
+ LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
if [ -z "$LINUXRELEASE" ]; then
- echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}/include/linux/$LINUXRELEASEHEADER"
+ echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"
RC=255
fi
fi
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 "KSRC ${LINUXOBJ:-${LINUX}}" \
+ --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
#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=
[ -d SOURCES ] || mkdir SOURCES
# first build kernel-ib
- if [ -n "$OFED_VERSION" ]; then
+ if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
$rpmfound && build_kernel_ib
fi
( $rpmfound ) && build_lustre && buildsuccess=true && find_linux_source_rpm
+ fi
if $buildsuccess; then
[ -d "RPMS/${TARGET_ARCH}" ] && [ -f "$KERNELRPM" ] && \
local reusedkernelsourcerpm=
local reusedkernelibrpm=
[ -d "$curdir" ] || continue
- [ -n "$OFED_VERSION" -a ! -d "${curdir%/*}/ofa_kernel" ] && 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" ]; then
+ 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 ] && \
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
[ -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" ]; then
+if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
unpack_ofed
fi