X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=build%2Flbuild;h=ddc26df398d4c2ebd7cf4f58227029e9d2231d8c;hp=2c2340d82b6c256fa8e2ad6dfd80ecf958803655;hb=330fdeb753a8dc531e16d12fd59897e470a11101;hpb=666c34b951673f6c3b4921d0833a65f9d2f7e379 diff --git a/build/lbuild b/build/lbuild index 2c2340d..ddc26df 100755 --- a/build/lbuild +++ b/build/lbuild @@ -35,6 +35,7 @@ SKIPLDISKFSRPM="v1_4_* b1_4" SMPTYPES="smp bigsmp default ''" KERNCONFSMPTYPE= PATCHLESS=false +XEN=false LINUXOBJ= REUSEDKERNELMASK= DISTRO= @@ -220,6 +221,9 @@ Usage: ${0##*/} [OPTION]... [-- ] checkouts. This is a workaround for a problem encountered when using lbuild with tinderbox. + --xen + Builds a Xen domX kernel. + EOF # list_targets @@ -404,6 +408,11 @@ load_target() . "$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." @@ -439,7 +448,7 @@ load_target() 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/" @@ -463,14 +472,18 @@ load_target() 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 @@ -510,7 +523,7 @@ load_target() BUILD_ARCHS= for arch in $(uniqify "$ALL_ARCHS") ; do - if [ -z "$TARGET_ARCHS" ] || [[ $TARGET_ARCHES =~ (\ |^)$arch(\ |$) ]] ; then + if [ -z "$TARGET_ARCHS" ] || echo "$TARGET_ARCHS" | grep -w "$arch" >/dev/null 2>/dev/null ; then BUILD_ARCHS="$BUILD_ARCHS $arch" fi done @@ -650,6 +663,10 @@ clean_linux() prep_kernel_build() { + local lmakeopts="\"\"" + if $XEN; then + lmakeopts="--xen" + fi # make .spec file ENABLE_INIT_SCRIPTS="" sed \ @@ -674,6 +691,7 @@ prep_kernel_build() -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 @@ -967,7 +985,7 @@ store_for_reuse() 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 @@ -990,7 +1008,7 @@ store_for_reuse() 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 @@ -1023,6 +1041,20 @@ set_rpm_smp_type() 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() { @@ -1080,13 +1112,9 @@ 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 @@ -1305,6 +1333,22 @@ build_kernel_ib() #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= @@ -1333,10 +1377,11 @@ patchless_build_sequence() [ -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" ] && \ @@ -1467,7 +1512,8 @@ build_sequence_reuse() 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 ] && \ @@ -1475,7 +1521,7 @@ build_sequence_reuse() 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 ] && \ @@ -1489,10 +1535,14 @@ build_sequence_reuse() 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 @@ -1531,7 +1581,7 @@ build_sequence() [ -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 @@ -1654,6 +1704,10 @@ while [ "$1" ] ; do USE_DATESTAMP= shift ;; + --xen) + XEN=true + shift + ;; --) shift CONFIGURE_FLAGS=$@ @@ -1673,7 +1727,7 @@ unpack_lustre 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