From: brian Date: Wed, 26 Oct 2005 23:15:01 +0000 (+0000) Subject: r=nic X-Git-Tag: v1_7_100~582 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=fd5ffd6fc93ba1d488d1ab90d96c08ef2858cc39 r=nic Allow lbuild to build a kernel from a downloaded RHEL4 SRPM. It should only need to do this once as it caches the .tar.bz2 it builds. This technique can/should be ported to other vendor kernels we deal with. Just more "hands off" automation of the build process. --- diff --git a/build/lbuild b/build/lbuild index 52807a8..d6e95ca 100755 --- a/build/lbuild +++ b/build/lbuild @@ -234,6 +234,38 @@ uniqify() echo $(echo "$*" | xargs -n 1 | sort -u) } +download_and_build_tarball() { + local TARGET=$1 + local KERNEL_FILE=$2 + + 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" \ + -O "$KERNELDIR/$SRPM" ; then + fatal 1 "Could not download target $TARGET's kernel SRPM $SRPM from ftp.lustre.org." + fi + + if [ "$TARGET" = "rhel-2.6" ]; then + RPMTOPDIR=$(mktemp -d $KERNELDIR/rpm_XXXXXX) + mkdir $RPMTOPDIR/BUILD/ + rpm -ivh $KERNELDIR/$SRPM --define "_topdir $RPMTOPDIR" || \ + { rm -rf $RPMTOPDIR; fatal 1 "Error installing kernel SRPM."; } + $RPMBUILD -bp --nodeps --target i686 $RPMTOPDIR/SPECS/kernel-2.6.spec --define "_topdir $RPMTOPDIR" + pushd $RPMTOPDIR/BUILD/kernel-${lnxmaj}/linux-${lnxmaj} && { + make mrproper + cp configs/kernel-${lnxmaj}-i686-smp.config .config + make nonint_oldconfig > /dev/null + make include/linux/version.h + rm -f .config + cd .. + tar cjf $KERNEL_FILE linux-${lnxmaj} + } + popd + rm -rf $RPMTOPDIR + fi +} + load_target() { EXTRA_VERSION_save="$EXTRA_VERSION" @@ -258,10 +290,10 @@ load_target() if [ ! -r "$KERNELDIR/$KERNEL" ] ; then 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 - fatal 1 "Could not download target $TARGET's kernel file $KERNEL from ftp.lustre.org." - fi + if ! wget -nv "http://ftp.lustre.org/kernels/$CANONICAL_TARGET/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 + fi else fatal 1 "Target $TARGET's kernel file $KERNEL not found in kernel directory $KERNELDIR." fi