X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=build%2Flmake;h=b883453b50cc3dcca28c26e35f5dfaf58faff273;hp=52037bb002f6e22d850bf4ba801c9394508e78b6;hb=afef2264887b5223d85d89c57fcd366601f22c39;hpb=c9a811c0245d95cf7661f059111dcb3b90b3faf5 diff --git a/build/lmake b/build/lmake index 52037bb..b883453 100755 --- a/build/lmake +++ b/build/lmake @@ -10,6 +10,7 @@ TARGET_ARCH= TARGET_CONFIG= JOBS=1 CONFIGURE_FLAGS= +TMPDIR=${TMPDIR:-"/var/tmp"} # commands to run BUILD_LUSTRE=0 @@ -33,6 +34,7 @@ BOOT_ARCHS= JENSEN_ARCHS= SMP_ARCHS= BIGSMP_ARCHS= +PSERIES64_ARCHS= UP_ARCHS= RHBUILD=0 @@ -44,6 +46,8 @@ TARGET_FILE= KERNEL_FILE= SERIES_FILE= CONFIG_FILE= +RPMBUILD= +XEN=false canon() { @@ -51,7 +55,24 @@ canon() echo $PWD popd >/dev/null } -TOPDIR=$(canon "${0%%${0##*/}}/..") +TOPDIR="${0%%${0##*/}}" +if [ "${TOPDIR}" ] ; then + TOPDIR=$(canon "${TOPDIR}/..") +else + TOPDIR=$(canon "..") +fi + +lbuild_topdir() +{ + retdir=$TOPDIR + while [ ! -d $retdir/BUILD ] ; do + retdir=$(canon "$retdir/..") + if [ "$retdir" = "/" ] ; then + break; + fi + done + echo "$retdir" +} cleanup() { @@ -140,6 +161,9 @@ Options: --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 @@ -178,6 +202,14 @@ check_options() if [ -z "$JOBS" -o "$JOBS" -lt "1" ] ; then JOBS=1 fi + + RPMBUILD=$(which rpmbuild 2>/dev/null | head -1) + if [ ! "$RPMBUILD" -o "$RPMBUILD" == "" ]; then + RPMBUILD=$(which rpm 2>/dev/null | head -1) + if [ ! "$RPMBUILD" -o "$RPMBUILD" == "" ]; then + usage 1 "Could not find binary for making rpms (tried rpmbuild and rpm)." + fi + fi } get_lustre_version() @@ -200,12 +232,17 @@ 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." # 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" ] || \ @@ -220,8 +257,13 @@ load_target() 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." @@ -233,18 +275,40 @@ load_target() fi } +# do these after load_target(), which maybe export CC +setup_ccache_distcc() +{ + # distcc can't handle ".incbin" + if [ "$TARGET" == "2.6-suse" -o "$TARGET" == "2.6-rhel4" ]; then + if [ "$TARGET_ARCH" == "x86_64" ]; then + unset DISTCC + fi + fi + + CC=${CC:-gcc} + if [ "$CCACHE" ]; then + [[ $CC != ccache\ * ]] && CC="$CCACHE $CC" + [ "$DISTCC" ] && export CCACHE_PREFIX="$DISTCC" + else + [ "$DISTCC" ] && CC="$DISTCC $CC" + fi +} + tarflags() { case "$1" in '') fatal 1 "tarflags(): File name argument missing." ;; - *.tar.gz) + *.tar.gz | *.tgz) echo 'zxf' ;; *.tar.bz2) echo 'jxf' ;; + *.tar) + echo 'xf' + ;; *) fatal 1 "tarflags(): Unrecognized tar extension in file: $1" ;; @@ -266,7 +330,7 @@ extract_kernel() [ -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 } @@ -294,9 +358,13 @@ patch_kernel() set_make() { MAKE="make -s" - if [ "$CC" ] ; then - MAKE="$MAKE 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 @@ -311,6 +379,30 @@ set_make() MAKE_J="$MAKE -j $JOBS" } +timed_run() { + SLEEP_TIME=$1 + shift + + set -o monitor + + #bash -c "$@" & + ("$@") & + child_pid=$! + + (sleep $SLEEP_TIME + kill -TERM -$child_pid 2>/dev/null + sleep 5 + kill -KILL -$child_pid 2>/dev/null + echo "$1 was killed due to timeout") & + dog_pid=$! + + wait $child_pid + # status will be set to 143 if the process had to be killed due to timeout + status=${PIPESTATUS[0]} + kill -KILL -$dog_pid + return $status +} + depend_kernel() { (( $DEPEND_KERNEL )) || return 0 @@ -319,26 +411,86 @@ depend_kernel() set_make pushd "$TOPDIR/linux" >/dev/null echo "Overriding EXTRAVERSION in kernel..." - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${EXTRA_VERSION}${TARGET_CONFIG}/" Makefile + local extra_version="${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}" + if [ -n "${TARGET_CONFIG}" ]; then + extra_version="${extra_version}${TARGET_DELIMITER}${TARGET_CONFIG}" + fi + sed -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = ${extra_version}/" Makefile echo "Making depend in $PWD..." - $MAKE mrproper || fatal 1 "Error running make mrproper" + $MAKE "$MAKE_CC" mrproper || fatal 1 "Error running make mrproper" + rm -f rpm-release + # remove localversion-* files to avoid kernel release string + # srewing up by the top-level Makefile + rm -f localversion-* cp "$CONFIG_FILE" .config - for oc in oldconfig_nonint silentoldconfig oldconfig ; do - if grep -q "$oc" Makefile ; then - $MAKE $oc || fatal 1 "Error running make oldconfig" - break - fi + local UPDATE_OLDCONFIG= + for oc in oldconfig_nonint silentoldconfig oldconfig ; do + if grep -q "$oc" Makefile ; then + timed_run 300 $MAKE "$MAKE_CC" $oc || UPDATE_OLDCONFIG=1 + break + fi done + + if [ "$UPDATE_OLDCONFIG" ] ; then + # use the expect script to "make oldconfig" and answer the questions for + # new items conservatively. QA will get notified on anything newly added + # for them to review and adjust accordingly. + local logfile=$(mktemp /tmp/XXXXXX) + #timed_run 300 $TOPDIR/build/update_oldconfig $logfile + #local RC=${PIPESTATUS[0]} + #local RC=$(strace -f -o update_oldconfig.strace bash -c "$TOPDIR/build/update_oldconfig $logfile; echo \$?") + $TOPDIR/build/update_oldconfig $logfile + local RC=${PIPESTATUS[0]} + #$TOPDIR/build/update_oldconfig $logfile + #local RC=${PIPESTATUS[0]} + if [ $RC -eq 143 ]; then + fatal 1 "update_oldconfig timed out" + elif [ $RC -ne 0 ]; then + # dump the log + cat $logfile + rm -f $logfile + if [ -f update_oldconfig.strace ]; then + cat update_oldconfig.strace + rm -f update_oldconfig.strace + fi + fatal 1 "update_oldconfig failed: $RC. See log above." + fi + fi + rm -f $logfile + # now notify if resulting .config is different than $CONFIG_FILE + local tmpfile=$(mktemp /tmp/XXXXXX) + diff -I '^#.*' -u "$CONFIG_FILE" .config >$tmpfile + if [ -s $tmpfile ]; then + { cat <&2 + fi + rm -f $tmpfile + case "$VERSION" in 2.6*) - $MAKE include/asm + $MAKE "$MAKE_CC" include/asm ;; 2.4*) - $MAKE symlinks - $MAKE dep || fatal 1 "Error running make dep" + $MAKE "$MAKE_CC" symlinks + $MAKE "$MAKE_CC" dep || fatal 1 "Error running make dep" ;; esac - $MAKE include/linux/version.h || fatal 1 "Error making include/linux/version.h" + $MAKE "$MAKE_CC" include/linux/version.h || fatal 1 "Error making include/linux/version.h" } build_kernel() @@ -346,24 +498,71 @@ build_kernel() (( $BUILD_KERNEL )) || return 0 set_make echo "Building kernel in $PWD..." + 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 +} + +build_kernel_ib() +{ + (( $BUILD_KERNEL )) || return 0 + # 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 - i386 | i586 | i686 | athlon | x86_64) - $MAKE_J bzImage || fatal 1 "Error making bzImage." + x86_64 | ia64) + configure_options="--with-ipath_inf-mod" ;; - ppc | ppc64) - $MAKE_J vmlinux || fatal 1 "Error making vmlinux." - ;; - *) - $MAKE_J boot || fatal 1 "Error making boot." + ppc64) + configure_options="--with-ipath_inf-mod --with-ehca-mod" ;; esac - $MAKE_J modules || fatal 1 "Error building modules." + 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 $(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 + + 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 $(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 } + configure_lustre() { + return 0 (( $BUILD_LUSTRE )) || return 0 pushd "$TOPDIR" >/dev/null [ -f Makefile ] && make -s clean @@ -378,7 +577,19 @@ build_lustre() (( $BUILD_LUSTRE )) || return 0 set_make pushd "$TOPDIR" >/dev/null - $MAKE_J || fatal 1 "Error building Lustre." + sed \ + -e s^@VERSION@^${LUSTRE_VERSION}^g \ + -e s^@LINUXRELEASE@^${FULL_VERSION}^g \ + -e s^@RELEASE@^${FULL_VERSION//-/_}^g \ + -e s^@ac_configure_args@^"--with-linux=${PWD}/linux ${CONFIGURE_FLAGS}"^g \ + < 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)" || \ + fatal 1 "Error building Lustre rpms." + # $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre." popd >/dev/null } @@ -386,7 +597,6 @@ install_kernel() { (( $INSTALL_KERNEL )) || return 0 set_make - FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}" pushd "$TOPDIR/linux" >/dev/null mkdir -p "$DESTDIR/boot" @@ -397,41 +607,46 @@ install_kernel() mkdir -p "$DESTDIR/dev/shm" mkdir -p "$DESTDIR/lib/modules/${FULL_VERSION}" - $MAKE INSTALL_MOD_PATH="$DESTDIR" KERNELRELEASE="$FULL_VERSION" \ + $MAKE "$MAKE_CC" INSTALL_MOD_PATH="$DESTDIR" KERNELRELEASE="$FULL_VERSION" \ -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 @@ -439,13 +654,31 @@ install_kernel() popd >/dev/null } +cleanup_libmodules() +{ + (( $INSTALL_LUSTRE )) || return 0 + + KVERREL="${VERSION}${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}" + i="$DESTDIR/lib/modules/${FULL_VERSION}" + + rm -f $i/build + rm -f $i/source + + if (( $LINUX26 )) ; then + ln -sf ../../../usr/src/linux-${KVERREL}-obj/${TARGET_ARCH}/${TARGET_CONFIG} $i/build + ln -sf ../../../usr/src/linux-${KVERREL} $i/source + else + ln -sf ../../../usr/src/linux-${KVERREL} $i/build + fi +} + install_lustre() { (( $INSTALL_LUSTRE )) || return 0 + return 0 set_make - FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}" pushd "$TOPDIR" >/dev/null - $MAKE -s install "DESTDIR=$DESTDIR" KERNELRELEASE="$FULL_VERSION" || fatal 1 "Error installing Lustre." + $MAKE "$MAKE_CC" -s install "DESTDIR=$DESTDIR" KERNELRELEASE="$FULL_VERSION" || fatal 1 "Error installing Lustre." popd >/dev/null } @@ -454,15 +687,14 @@ build_kms() (( $BUILD_KERNEL )) || return 0 (( $SUSEBUILD )) || return 0 set_make - FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}" mkdir -p "${TOPDIR}/modules-${FULL_VERSION}" for dir in /usr/src/kernel-modules/* ; do # we are replacing lustre-lite, so don't include it - if [ ${dir##*/} != "lustre-lite" -a -e $dir/Makefile ]; then + if [ "${dir##*/}" != "lustre-lite" -a -e $dir/Makefile ]; then build_dir="${TOPDIR}/modules-${FULL_VERSION}/${dir##*/}" cp -a $dir $build_dir # these modules are terrible, and don't all build - $MAKE_J -C $build_dir modules KERNEL_SOURCE="${TOPDIR}/linux" + $MAKE_J "$MAKE_CC" -C $build_dir modules KERNEL_SOURCE="${TOPDIR}/linux" fi done } @@ -477,14 +709,18 @@ symver() install_kms() { (( $INSTALL_KERNEL )) || return 0 - (( $SUSEBUILD )) || return 0 + (( $LINUX26 )) || return 0 set_make - FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}" for build_dir in "${TOPDIR}/modules-${FULL_VERSION}/*" ; do [ -d $build_dir ] || continue # these modules are terrible, and don't all build - $MAKE -C $build_dir KERNEL_SOURCE="${TOPDIR}/linux" INSTALL_MOD_PATH="$DESTDIR" + $MAKE "$MAKE_CC" -C $build_dir KERNEL_SOURCE="${TOPDIR}/linux" INSTALL_MOD_PATH="$DESTDIR" done + local symvers_file="${DESTDIR}/boot/symvers-${VERSION}${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}-${TARGET_ARCH}" + if [ -n "$TARGET_CONFIG" ]; then + symvers_file="${symvers_file}${TARGET_DELIMITER}${TARGET_CONFIG}" + fi + symvers_file="$symvers_file.gz" ( symver vmlinux moddir="${DESTDIR}/lib/modules/${FULL_VERSION}" cd $moddir/kernel @@ -496,24 +732,26 @@ install_kms() -name '*.ko' -print); do symver $module done - ) | sort -u -k2 \ - | gzip -c9 > "${DESTDIR}/boot/symvers-${VERSION}-${EXTRA_VERSION}-${TARGET_ARCH}${TARGET_CONFIG}.gz" + ) | sort -u -k2 | gzip -c9 > $symvers_file } save_headers() { - echo "Saving headers for $1 $2..." + (( $SAVE_HEADERS )) || return 0 + + echo "Saving headers for ${TARGET_CONFIG:-up} ${TARGET_ARCH}..." pushd linux >/dev/null - KVERREL="${VERSION}-${EXTRA_VERSION}" + KVERREL="${VERSION}${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}" # deal with the kernel headers that are version specific - saveddir="$RPM_BUILD_ROOT/usr/src/linux-${KVERREL}/savedheaders/$2/$1" + saveddir="$RPM_BUILD_ROOT/usr/src/linux-${KVERREL}/savedheaders/${TARGET_ARCH}/${TARGET_CONFIG:-up}" mkdir -p "$saveddir" install -m 644 include/linux/autoconf.h "$saveddir/autoconf.h" install -m 644 include/linux/version.h "$saveddir/version.h" mv include/linux/modules "$saveddir/" - echo $2 $1 ../../savedheaders/$2/$1/ >> $RPM_BUILD_ROOT/usr/src/linux-${KVERREL}/savedheaders/list + echo ${TARGET_ARCH} ${TARGET_CONFIG} ../../savedheaders/${TARGET_ARCH}/${TARGET_CONFIG:-up}/ \ + >> "$RPM_BUILD_ROOT/usr/src/linux-${KVERREL}/savedheaders/list" popd >/dev/null } @@ -540,6 +778,9 @@ save_all_headers() for arch in $BIGSMP_ARCHS ; do save_headers bigsmp $arch done + for arch in $PSERIES64_ARCHS ; do + save_headers pseries64 $arch + done for arch in $UP_ARCHS ; do save_headers up $arch done @@ -547,7 +788,7 @@ save_all_headers() 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" -- "$@") @@ -630,6 +871,10 @@ while [ "$1" ] ; do UNPACK_KERNEL=1 shift ;; + --xen) + XEN=true + shift + ;; --) shift CONFIGURE_FLAGS=$@ @@ -643,6 +888,12 @@ done check_options load_target +EXTRA_VERSION_DELIMITER=${EXTRA_VERSION_DELIMITER:-"-"} +FULL_VERSION="${VERSION}${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}" +if [ -n "$TARGET_CONFIG" ]; then + FULL_VERSION="${FULL_VERSION}${TARGET_DELIMITER}${TARGET_CONFIG}" +fi +setup_ccache_distcc extract_kernel patch_kernel @@ -650,6 +901,14 @@ patch_kernel depend_kernel build_kernel +if [ -n "$OFED_VERSION" ]; then + if [ "$OFED_VERSION" = "inkernel" ]; then + CONFIGURE_FLAGS="--with-o2ib=yes ${CONFIGURE_FLAGS}" + else + build_kernel_ib + fi +fi + configure_lustre build_lustre @@ -660,6 +919,8 @@ install_lustre install_kms -save_all_headers +cleanup_libmodules + +save_headers exit 0