SERIES_FILE=
CONFIG_FILE=
RPMBUILD=
+XEN=false
canon()
{
--unpack-kernel
Untars and patches the kernel source.
+ --xen
+ Builds a Xen domX kernel.
+
The order that commands (--build-lustre, --unpack-kernel) are
specified on the command line is ignored; ${0##*/} will always
execute them in the correct order (unpack, then build, then install
. "$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."
# Suse 2.6 has our patches in already
# [ "$SERIES" ] || fatal 1 "Target $TARGET did not specify a patch series."
# [ "$CONFIG" ] || fatal 1 "Target $TARGET did not specify a kernel config."
[ "$VERSION" ] || fatal 1 "Target $TARGET did not specify the kernel version."
-
+
if [ "$KERNELDIR" ] ; then
KERNEL_FILE="$KERNELDIR/$KERNEL"
[ -r "$KERNELDIR/$KERNEL" ] || \
done
fi
+ local XENPOSTFIX=""
+ if $XEN; then
+ XENPOSTFIX="-xen"
+ fi
+
TARGET_ARCH=${TARGET_ARCH:-$BASE_ARCHS}
- CONFIG_TARGET="$TARGET-${TARGET_ARCH}${TARGET_CONFIG:+-$TARGET_CONFIG}"
+ CONFIG_TARGET="${TARGET}${XENPOSTFIX}-${TARGET_ARCH}${TARGET_CONFIG:+-$TARGET_CONFIG}"
CONFIG_FILE="$TOPDIR/lustre/kernel_patches/kernel_configs/kernel-$VERSION-$CONFIG_TARGET.config"
[ -r "$CONFIG_FILE" ] ||
fatal 1 "Target $TARGET's config file $CONFIG_FILE missing from $TOPDIR/lustre/kernel_patches/configs."
unset DISTCC
fi
fi
-
+
CC=${CC:-gcc}
if [ "$CCACHE" ]; then
- CC="$CCACHE $CC"
+ [[ $CC != ccache\ * ]] && CC="$CCACHE $CC"
[ "$DISTCC" ] && export CCACHE_PREFIX="$DISTCC"
else
[ "$DISTCC" ] && CC="$DISTCC $CC"
[ -L linux ] && rm -rf $(readlink linux)
rm -rf linux
fi
- untar "$KERNEL_FILE"
+ untar "$KERNEL_FILE" || fatal 1 "Error unpacking Linux tarball"
[ -d linux ] || ln -sf linux* linux
popd >/dev/null
}
set_make()
{
MAKE="make -s"
- if [ "$CC" ] ; then
- MAKE_CC="CC=$CC"
- fi
+ [ "$CC" ] && {
+ if [ "$TARGET_ARCH" == "ppc64" ] ; then
+ MAKE_CC="CC=$CC -m64"
+ else
+ MAKE_CC="CC=$CC"
+ fi
+ }
if [ "$ARCH" ] ; then
MAKE_ARCH="$MAKE ARCH=$ARCH"
else
if [ -n "${TARGET_CONFIG}" ]; then
extra_version="${extra_version}${TARGET_DELIMITER}${TARGET_CONFIG}"
fi
- perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = ${extra_version}/" Makefile
+ sed -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = ${extra_version}/" Makefile
echo "Making depend in $PWD..."
$MAKE "$MAKE_CC" mrproper || fatal 1 "Error running make mrproper"
rm -f rpm-release
(( $BUILD_KERNEL )) || return 0
set_make
echo "Building kernel in $PWD..."
- case "$TARGET_ARCH" in
- i386 | i586 | i686 | athlon | x86_64)
- $MAKE_J "$MAKE_CC" bzImage || fatal 1 "Error making bzImage."
- ;;
- ia64 | ppc | ppc64)
- $MAKE_J "$MAKE_CC" vmlinux || fatal 1 "Error making vmlinux."
- ;;
- *)
- $MAKE_J "$MAKE_CC" boot || fatal 1 "Error making boot."
- ;;
- esac
+ if $XEN; then
+ $MAKE_J "$MAKE_CC" vmlinuz || fatal 1 "Error making vmlinux."
+ else
+ case "$TARGET_ARCH" in
+ i386 | i586 | i686 | athlon | x86_64)
+ $MAKE_J "$MAKE_CC" bzImage || fatal 1 "Error making bzImage."
+ ;;
+ ia64 | ppc | ppc64)
+ $MAKE_J "$MAKE_CC" vmlinux || fatal 1 "Error making vmlinux."
+ ;;
+ *)
+ $MAKE_J "$MAKE_CC" boot || fatal 1 "Error making boot."
+ ;;
+ esac
+ fi
$MAKE_J "$MAKE_CC" modules || fatal 1 "Error building modules."
popd >/dev/null
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 $(lbuild_topdir)" --target ${TARGET_ARCH} \
- --define "KVERSION ${FULL_VERSION}" \
- --define "$K_SRC ${LINUXOBJ:-${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
+ if ! $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 "$K_SRC ${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 --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" $(lbuild_topdir)/OFED/SRPMS/ofa_kernel-*.src.rpm 2>&1; then
fatal 1 "Error building kernel-ib"
fi
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)
+ local rpm=$(ls $(lbuild_topdir)/RPMS/*/kernel-ib-devel-*-${FULL_VERSION//-/_}.*.rpm)
rpm2cpio -itv < $rpm | cpio -id
CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}"
popd >/dev/null
< lustre.spec.in \
> lustre.spec
$RPMBUILD --target ${TARGET_ARCH} -bb lustre.spec \
+ ${PATCHLESS:+--define "lustre_name lustre-client"} \
--define "_tmppath $TMPDIR" \
- --define "_topdir $(lbuild_topdir)" || \
+ --define "_topdir $(lbuild_topdir)" 2>&1 || \
fatal 1 "Error building Lustre rpms."
# $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre."
popd >/dev/null
-s modules_install || \
fatal 1 "Error installing modules."
- case "$TARGET_ARCH" in
- i386 | i586 | i686 | athlon)
- cp arch/i386/boot/bzImage "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
- cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/"
- ln -sf "../lib/modules/${FULL_VERSION}/vmlinux" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
- ;;
- x86_64)
- cp arch/x86_64/boot/bzImage "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
- cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/"
- ln -sf "../lib/modules/${FULL_VERSION}/vmlinux" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
- ;;
- ppc | ppc64)
- cp vmlinux "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
- ln -sf "$DESTDIR/boot/vmlinux-${FULL_VERSION}" "../lib/modules/${FULL_VERSION}/vmlinux"
- ;;
- ia64)
- gzip -cfv vmlinux > vmlinuz
- mkdir -p "$DESTDIR/boot/efi/redhat"
- install -m 755 vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/"
- install -m 755 vmlinuz "$DESTDIR/boot/efi/redhat/vmlinuz-${FULL_VERSION}"
- ln -sf "../../../lib/modules/${FULL_VERSION}/vmlinux" "$DESTDIR/boot/efi/redhat/vmlinux-${FULL_VERSION}"
- ln -sf "efi/redhat/vmlinux-${FULL_VERSION}" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
- ln -sf "efi/redhat/vmlinuz-${FULL_VERSION}" "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
- ;;
- *)
- cp vmlinuz "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
- cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/vmlinux-${FULL_VERSION}"
- ln -sf "../lib/modules/${FULL_VERSION}/vmlinux-${FULL_VERSION}" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
-
- ;;
- esac
+ if $XEN; then
+ cp vmlinuz "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
+ cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/vmlinux-${FULL_VERSION}"
+ ln -sf "../lib/modules/${FULL_VERSION}/vmlinux-${FULL_VERSION}" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
+ else
+ case "$TARGET_ARCH" in
+ i386 | i586 | i686 | athlon)
+ cp arch/i386/boot/bzImage "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
+ cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/"
+ ln -sf "../lib/modules/${FULL_VERSION}/vmlinux" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
+ ;;
+ x86_64)
+ cp arch/x86_64/boot/bzImage "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
+ cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/"
+ ln -sf "../lib/modules/${FULL_VERSION}/vmlinux" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
+ ;;
+ ppc | ppc64)
+ cp vmlinux "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
+ ln -sf "$DESTDIR/boot/vmlinux-${FULL_VERSION}" "../lib/modules/${FULL_VERSION}/vmlinux"
+ ;;
+ ia64)
+ gzip -cfv vmlinux > vmlinuz
+ mkdir -p "$DESTDIR/boot/efi/redhat"
+ install -m 755 vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/"
+ install -m 755 vmlinuz "$DESTDIR/boot/efi/redhat/vmlinuz-${FULL_VERSION}"
+ ln -sf "../../../lib/modules/${FULL_VERSION}/vmlinux" "$DESTDIR/boot/efi/redhat/vmlinux-${FULL_VERSION}"
+ ln -sf "efi/redhat/vmlinux-${FULL_VERSION}" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
+ ln -sf "efi/redhat/vmlinuz-${FULL_VERSION}" "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
+ ;;
+ *)
+ cp vmlinuz "$DESTDIR/boot/vmlinuz-${FULL_VERSION}"
+ cp vmlinux "$DESTDIR/lib/modules/${FULL_VERSION}/vmlinux-${FULL_VERSION}"
+ ln -sf "../lib/modules/${FULL_VERSION}/vmlinux-${FULL_VERSION}" "$DESTDIR/boot/vmlinux-${FULL_VERSION}"
+ ;;
+ esac
+ fi
if [ -e init/kerntypes.o ] ; then
cp init/kerntypes.o "$DESTDIR/boot/Kerntypes-${FULL_VERSION}"
fi
longopts="build,build-lustre,build-kernel,depend-kernel,destdir:,extraversion:"
longopts="$longopts,help,install,install-lustre,install-kernel,kerneldir:"
-longopts="$longopts,save-headers,target:,target-arch:,target-config:,unpack-kernel"
+longopts="$longopts,save-headers,target:,target-arch:,target-config:,unpack-kernel,xen"
options=$(getopt -o hj: -l "$longopts" -- "$@")
UNPACK_KERNEL=1
shift
;;
+ --xen)
+ XEN=true
+ shift
+ ;;
--)
shift
CONFIGURE_FLAGS=$@
build_kernel
if [ -n "$OFED_VERSION" ]; then
- build_kernel_ib
+ if [ "$OFED_VERSION" = "inkernel" ]; then
+ CONFIGURE_FLAGS="--with-o2ib=yes ${CONFIGURE_FLAGS}"
+ else
+ build_kernel_ib
+ fi
fi
configure_lustre