From 9aa2968b965a5acdf127a5635dfde8950bc8d3a2 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Tue, 30 Mar 2010 11:39:17 -0700 Subject: [PATCH 1/1] b=22261 remove old school build files Now that RHEL4 and SLES9 are not required in any form at all on master, remove the files needed to build packages for them. i=yibin.wang i=sheng.yang --- build/autoMakefile.am.toplevel | 10 +- build/lbuild.old_school | 767 --------------------------- build/linux-merge-config.awk | 317 ----------- build/linux-merge-modules.awk | 125 ----- build/linux-rhconfig.h | 265 ---------- build/lmake | 924 --------------------------------- build/lustre-kernel-2.4.spec.in | 980 ----------------------------------- build/sles8-post.sh | 49 -- build/sles8-postun.sh | 22 - build/sles8-pre.sh | 2 - build/sles8-update_INITRD_MODULES.sh | 56 -- build/sles8-update_rcfile_setting.sh | 35 -- build/suse-functions.sh | 22 - build/suse-post.sh | 82 --- build/suse-postun.sh | 77 --- build/suse-trigger-script.sh.in | 9 - 16 files changed, 2 insertions(+), 3740 deletions(-) delete mode 100644 build/lbuild.old_school delete mode 100644 build/linux-merge-config.awk delete mode 100644 build/linux-merge-modules.awk delete mode 100644 build/linux-rhconfig.h delete mode 100755 build/lmake delete mode 100644 build/lustre-kernel-2.4.spec.in delete mode 100644 build/sles8-post.sh delete mode 100644 build/sles8-postun.sh delete mode 100644 build/sles8-pre.sh delete mode 100644 build/sles8-update_INITRD_MODULES.sh delete mode 100644 build/sles8-update_rcfile_setting.sh delete mode 100644 build/suse-functions.sh delete mode 100644 build/suse-post.sh delete mode 100644 build/suse-postun.sh delete mode 100644 build/suse-trigger-script.sh.in diff --git a/build/autoMakefile.am.toplevel b/build/autoMakefile.am.toplevel index c95f165..a1856df 100644 --- a/build/autoMakefile.am.toplevel +++ b/build/autoMakefile.am.toplevel @@ -95,14 +95,8 @@ dist-hook: EXTRA_DIST = @PACKAGE_TARNAME@.spec \ build/Makefile build/autoMakefile.am.toplevel build/lbuild \ - build/linux-merge-config.awk build/linux-merge-modules.awk \ - build/linux-rhconfig.h build/lmake build/Rules.in \ - build/lustre-kernel-2.4.spec.in build/suse-functions.sh \ - build/suse-post.sh build/suse-postun.sh \ - build/suse-trigger-script.sh.in build/README.kernel-source \ - build/sles8-post.sh build/sles8-postun.sh build/sles8-pre.sh \ - build/sles8-update_INITRD_MODULES.sh \ - build/sles8-update_rcfile_setting.sh build/update_oldconfig \ + build/Rules.in build/README.kernel-source \ + build/update_oldconfig \ build/autoconf/lustre-build-linux.m4 \ build/autoconf/lustre-build-darwin.m4 \ build/autoconf/lustre-build.m4 build/rdac_spec \ diff --git a/build/lbuild.old_school b/build/lbuild.old_school deleted file mode 100644 index 362da9f..0000000 --- a/build/lbuild.old_school +++ /dev/null @@ -1,767 +0,0 @@ -# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4: - -OLD_SCHOOL=true - -RHBUILD=${RHBUILD:-0} -SUSEBUILD=${SUSEBUILD:-0} -LINUX26=${LINUX26:-0} -SUSEBUILD=${SUSEBUILD:-0} - -build_tarball() { - local TARGET=$1 - local SRPM=$2 - - if [ "$TARGET" = "rhel-2.6" -o "$TARGET" = "rhel-2.4" ]; then - local SPEC="" - if [ "$TARGET" = "rhel-2.6" ]; then - SPEC=kernel-2.6.spec - OLDCONFIG=nonint_oldconfig - elif [ "$TARGET" = "rhel-2.4" ]; then - SPEC=kernel-2.4.spec - OLDCONFIG=oldconfig - fi - - 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/$SPEC --define "_topdir $RPMTOPDIR" 2>&1 - pushd $RPMTOPDIR/BUILD/kernel-${lnxmaj}/linux-${lnxmaj} && { - make mrproper - cp configs/kernel-${lnxmaj}-i686-smp.config .config - if ! make $OLDCONFIG > /dev/null; then - fatal 1 "error trying to make $OLDCONFIG while building a tarball from SRPM." - fi - make include/linux/version.h - rm -f .config - cd .. - tar cjf $KERNEL_FILE linux-${lnxmaj} - } - popd - rm -rf $RPMTOPDIR - fi -} - -download_and_build_tarball() { - local target=$1 - local kernel_file=$2 - - local srpm=kernel-${lnxmaj}-${lnxrel}.src.rpm - - echo "Downloading http://downloads.lustre.org/public/kernels/$target/old/$srpm..." - if ! wget -nv "http://downloads.lustre.org/public/kernels/$target/old/$srpm" \ - -O "$KERNELDIR/$srpm" ; then - fatal 1 "Could not download target $kernel_file's kernel SRPM $srpm from downloads.lustre.org." - fi - [ -s "$KERNELDIR/$srpm" ] || { - rm -rf $KERNELDIR/$srpm - fatal 1 "Could not download target $kernel_file's kernel SRPM $srpm from downloads.lustre.org." - } - - build_tarball $target $srpm -} - -unpack_linux() { - - untar "$KERNEL_FILE" || fatal 1 "Error unpacking Linux tarball" - [ -d linux ] || ln -sf linux* linux - -} - -patch_linux() { - - [ "$SERIES" ] || return 0 - - do_patch_linux true - - echo "Replacing .config files..." - [ -d linux/configs ] || mkdir linux/configs || \ - fatal 1 "Error creating configs directory." - rm -f linux/configs/* - copysuccess=0 - for patchesdir in "$EXTERNAL_PATCHES" "lustre/lustre/kernel_patches" ; do - [ "$patchesdir" ] && \ - cp -v $patchesdir/kernel_configs/kernel-${VERSION}-${TARGET}*.config linux/configs/ >/dev/null && copysuccess=1 - done - [ "$copysuccess" = "1" ] || \ - fatal 1 "Error copying in kernel configs." -} - -pack_linux() { - TARBALL="$(readlink linux)-$EXTRA_VERSION.tar.gz" - echo "Creating patched linux tarball $TARBALL..." - tar -zcf "$TARBALL" "$(readlink linux)" \ - --exclude "CVS" --exclude ".cvsignore" \ - --exclude "*.orig" --exclude "*~" --exclude "*.rej" || \ - fatal 1 "Error creating patched Linux tarball." -} - -clean_linux() { - [ -d linux ] || return 0 - echo "Cleaning linux..." - [ -L linux ] && rm -rf $(readlink linux) - rm -rf linux -} - -prep_kernel_build() { - local lmakeopts="\"\"" - if $XEN; then - lmakeopts="--xen" - fi - # make .spec file - ENABLE_INIT_SCRIPTS="" - sed \ - -e "s^@BASE_ARCHS@^$BASE_ARCHS^g" \ - -e "s^@BIGMEM_ARCHS@^$BIGMEM_ARCHS^g" \ - -e "s^@BIGSMP_ARCHS@^$BIGSMP_ARCHS^g" \ - -e "s^@BOOT_ARCHS@^$BOOT_ARCHS^g" \ - -e "s^@CONFIGURE_FLAGS@^$CONFIGURE_FLAGS^g" \ - -e "s^@ENABLE_INIT_SCRIPTS@^$ENABLE_INIT_SCRIPTS^g" \ - -e "s^@JENSEN_ARCHS@^$BOOT_ARCHS^g" \ - -e "s^@KERNEL_EXTRA_VERSION@^$EXTRA_VERSION^g" \ - -e "s^@KERNEL_EXTRA_VERSION_DELIMITER@^$EXTRA_VERSION_DELIMITER^g" \ - -e "s^@KERNEL_TARGET_DELIMITER@^$TARGET_DELIMITER^g" \ - -e "s^@KERNEL_RELEASE@^${EXTRA_VERSION//-/_}^g" \ - -e "s^@KERNEL_SOURCE@^$KERNEL^g" \ - -e "s^@KERNEL_VERSION@^$VERSION^g" \ - -e "s^@LINUX26@^$LINUX26^g" \ - -e "s^@LUSTRE_SOURCE@^${LUSTRE##*/}^g" \ - -e "s^@LUSTRE_TARGET@^$TARGET^g" \ - -e "s^@PSERIES64_ARCHS@^$PSERIES64_ARCHS^g" \ - -e "s^@RHBUILD@^$RHBUILD^g" \ - -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 - [ -d RPMS ] || mkdir RPMS - [ -d BUILD ] || mkdir BUILD - [ -d SOURCES ] || mkdir SOURCES - for script in linux-{rhconfig.h,merge-config.awk,merge-modules.awk} \ - suse-{functions.sh,post.sh,postun.sh,trigger-script.sh.in} \ - sles8-{pre,post,postun,update_{INITRD_MODULES,rcfile_setting}}.sh ; do - cp $TOPDIR/lustre/build/$script SOURCES - done - cp "$LUSTRE" "$KERNEL_FILE" SOURCES - if [ "$EXTERNAL_PATCHES" -a -d "$EXTERNAL_PATCHES" ] ; then - tar zcf SOURCES/external-patches.tar.gz -C "$EXTERNAL_PATCHES" series targets patches kernel_configs - else - touch SOURCES/external-patches.tar.gz - fi -} - -clean_lustre() { - [ -d lustre ] || return 0 - echo "Cleaning Lustre..." - [ -L lustre ] && rm -rf $(readlink lustre) - rm -rf lustre -} - -build_kernel() { - echo "Building kernel + Lustre RPMs for: $BUILD_ARCHS..." - targets= - for arch in $BUILD_ARCHS ; do - targets="--target $arch $targets" - done - - local rpmbuildopt='-bb' -# if $NORPM; then -# rpmbuildopt='-bc' -# echo NORPM mode. Only compiling. -# echo "XXX: need to fix lmake - add options to do rpmbuild -bc instead of -bb" -# fi - - $RPMBUILD $targets $rpmbuildopt lustre-kernel-2.4.spec \ - --define "_tmppath $TMPDIR" \ - --define "_topdir $TOPDIR" 2>&1 || \ - fatal 1 "Error building rpms for $BUILD_ARCHS." - - if $DO_SRC; then - $RPMBUILD -bs lustre-kernel-2.4.spec \ - --define "_tmppath $TMPDIR" \ - --define "_topdir $TOPDIR" 2>&1 || \ - fatal 1 "Error building .src.rpm." - fi - - ( $(skeep_ldiskfs_rpm $TAG) ) && return - - pushd $TOPDIR/BUILD/lustre*/ldiskfs || return 255 - make dist - if [ "$?" != "0" ] ; then - popd - return 255 - fi - cp lustre-ldiskfs*.tar.gz $TOPDIR/SOURCES - - gen_lustre_version - - local ldiskfs_spec=lustre-ldiskfs.spec - [ -f "$ldiskfs_spec" ] && sed \ - -e "s^Release: .*$^Release: $LUSTRE_EXTRA_VERSION^" \ - < $ldiskfs_spec \ - > ../lustre-ldiskfs.spec - - if ! $RPMBUILD $targets $rpmbuildopt ../lustre-ldiskfs.spec \ - --define "_tmppath /var/tmp" \ - --define "_topdir $TOPDIR" 2>&1; then - popd - return 255 - fi - - if $DO_SRC; then - if ! $RPMBUILD -bs ../lustre-ldiskfs.spec \ - --define "_tmppath /var/tmp" \ - --define "_topdir $TOPDIR" 2>&1; then - popd - return 255 - fi - fi - popd -} - -#get date of last changed target/config/series/patches -get_last_source_date() { - local filelist="${TOPDIR}/lustre/lustre/kernel_patches/series/${SERIES} \ - $CONFIG_FILE" - local TOPDIRnew=$(echo ${TOPDIR} | sed -e s/\\//\\\\\\//g) - filelist="$filelist $( \ - cat ${TOPDIR}/lustre/lustre/kernel_patches/series/${SERIES} | \ - sed -e s/^/${TOPDIRnew}\\/lustre\\/lustre\\/kernel_patches\\/patches\\// 2>&1)" - local sourcelastdate=$( find ${filelist} -name CVS -prune -o \ - -type f -printf "%T@\n" 2>&1 | sort | tail -1 ) - is_integer $sourcelastdate && echo $sourcelastdate -} - -#check if variable is integer -is_integer() { - local invariable=$1 - [ "$invariable" = "" ] && return 255 - local invariableint=$( echo $invariable | sed -e s/[^0-9]//g ) - [ "$invariable" = "$invariableint" ] || return 255 -} - -#store RPMs and/or BUILD dir for future reuse -store_for_reuse() { - local rpmonly=$1 - if [ ! "$REUSEBUILD" = "" ] && [ -d "/$REUSEBUILD/" ] ; then - [ -d "${REUSEBUILD}/${TIMESTAMP}" ] || mkdir "${REUSEBUILD}/${TIMESTAMP}" - [ -d "${REUSEBUILD}/${TIMESTAMP}" ] || return 255 - else - return 255 - fi - - local lnxrelnew=${lnxrel//-/_} - local EXTRA_VERSIONnew=${EXTRA_VERSION//-/_} - local KERNELRPMnew=$(basename "$KERNELRPM") - if [ ! "$rpmonly" = "rpmonly" ]; then - local builddir= - if [ ! "$KERNELCOMPILEDIR" = "" ]; then - builddir="$KERNELCOMPILEDIR" - else - builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/linux-${lnxmaj}" - [ "$KERNELCOMPILEDIR" = "" ] || builddir="$KERNELCOMPILEDIR" - [ -d "$builddir" ] || builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/linux-${lnxmaj}.${lnxrel}" - [ -d "$builddir" ] || builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/linux-${lnxmaj}-${lnxrel}" - if [ ! -d "$builddir" ]; then - pushd "BUILD/lustre-kernel-${lnxmaj}/lustre/" || return 255 - local basebuilddir=$(ls -d linux-${lnxmaj}* | head -1) - [ "$basebuilddir" = "" ] || builddir="BUILD/lustre-kernel-${lnxmaj}/lustre/${basebuilddir}" - popd - fi - fi - [ -d "$builddir" ] || return 255 - local dstdir="${REUSEBUILD}/${TIMESTAMP}/linux-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}" - ( $PATCHLESS ) && dstdir="${REUSEBUILD}/${TIMESTAMP}/linux-$KERNELRPMnew" && \ - dstdir="${dstdir%.rpm}" - [ -d "$dstdir" ] && rm -rf "$dstdir" - mv "${builddir}" "$dstdir" || return 255 - 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 - fi - #store kernel rpm - local kernelrpmname="kernel-lustre-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}.rpm" - [ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] || kernelrpmname="kernel-${KERNCONFSMPTYPE}-${lnxmaj}-${EXTRA_VERSNnew}.${TARGET_ARCH}.rpm" - ( $PATCHLESS ) && [ -f "$KERNELRPM" ] && kernelrpmname="$KERNELRPMnew" - if [ "$rpmonly" = "rpmonly" ] && [ -f "${REUSEBUILD}/${TIMESTAMP}/${kernelrpmname}" ]; then - echo "RPM already exist in store directory tree" - else - [ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] && cp -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" "${REUSEBUILD}/${TIMESTAMP}/" - fi - #store kernel source rpm - kernelrpmname="kernel-lustre-source-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}.rpm" - [ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] || kernelrpmname="kernel-source-${lnxmaj}-${EXTRA_VERSIONnew}.${TARGET_ARCH}.rpm" - ( $PATCHLESS ) && [ -f "$KERNELSOURCERPM" ] && kernelrpmname=$(basename "$KERNELSOURCERPM") - if [ "$rpmonly" = "rpmonly" ] && [ -f "${REUSEBUILD}/${TIMESTAMP}/${kernelrpmname}" ]; then - echo "RPM already exist in store directory tree" - else - [ -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" ] && cp -f "RPMS/${TARGET_ARCH}/${kernelrpmname}" "${REUSEBUILD}/${TIMESTAMP}/" - fi - if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then - # store kernel-ib RPMs - local rpmname - local ofed_version=$(echo $OFED_VERSION | - sed -re 's/-(20[0-9]{6,6}-[0-9]{4,4}|rc[0-9]*)$//') - for rpmname in "kernel-ib" "kernel-ib-devel"; do - rpmname="${rpmname}-${ofed_version}" - if $PATCHLESS; then - rpmname="${rpmname}-${LINUXRELEASE//-/_}" - else - rpmname="${rpmname}-${lnxmaj}${EXTRA_VERSION_DELIMITER//-/_}${EXTRA_VERSIONnew}${TARGET_DELIMITER//-/_}${KERNCONFSMPTYPE}" - fi - rpmname="${rpmname}.${TARGET_ARCH}.rpm" - if [ "$rpmonly" = "rpmonly" ] && [ -f "${REUSEBUILD}/${TIMESTAMP}/${rpmname}" ]; then - echo "RPM already exist in store directory tree" - else - [ -f "RPMS/${TARGET_ARCH}/${rpmname}" ] && cp -f "RPMS/${TARGET_ARCH}/${rpmname}" "${REUSEBUILD}/${TIMESTAMP}/" - fi - done - fi -} - -#look for kernel source RPM -find_linux_source_rpm() { - local rpmfile= - local findarch=true - local arch= - local pathtorpms= - [ ! "$TARGET_ARCH" = "" ] && arch=$TARGET_ARCH && findarch=false - - if ! $findarch; then - pathtorpms="${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${arch}" - [ -d $pathtorpms ] || return 255 - case "$DISTRO" in - rhel4) - rpmfile="kernel-${lnxmaj}-${lnxrel}.src.rpm" - ;; - sles10) - rpmfile="kernel-source-${lnxmaj}.${lnxrel}.${arch}.rpm" - ;; - *) - rpmfile="kernel-source-${lnxmaj}-${lnxrel}.${arch}.rpm" - ;; - esac - [ -f "${pathtorpms}/${rpmfile}" ] || return 255 - KERNELSOURCERPM="${pathtorpms}/${rpmfile}" - else - for arch in $TARGET_ARCHS_ALL; do - pathtorpms="${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${arch}" - [ -d $pathtorpms ] || continue - case "$DISTRO" in - rhel4) - rpmfile="kernel-${lnxmaj}-${lnxrel}.src.rpm" - ;; - sles10) - rpmfile="kernel-source-${lnxmaj}.${lnxrel}.${arch}.rpm" - ;; - *) - rpmfile="kernel-source-${lnxmaj}-${lnxrel}.${arch}.rpm" - ;; - esac - [ -f "${pathtorpms}/${rpmfile}" ] || continue - KERNELSOURCERPM="${pathtorpms}/${rpmfile}" - TARGET_ARCH=${arch} - break - done - fi - [ -f "${KERNELSOURCERPM}" ] || return 255 -} - -#unpack and make symlinks for reusing kernel RPM -reuse_kernel_rpm() { - local pathtorpm=$1 - local pathtokernelibrpm=$2 - [ "$pathtorpm" = "" ] && return 255 - [ -f "$pathtorpm" ] || return 255 - [ -d $TOPDIR/reused ] || mkdir $TOPDIR/reused - pushd $TOPDIR/reused || return 255 - - rpm2cpio < $pathtorpm | cpio -idc - [ ${PIPESTATUS[0]} -eq 0 ] || return 255 - - if [ -n "$pathtokernelibrpm" ] && [ -f "$pathtokernelibrpm" ]; then - rpm2cpio < $pathtokernelibrpm | cpio -idc - [ ${PIPESTATUS[0]} -eq 0 -o ${PIPESTATUS[1]} -eq 0 ] || return 255 - CONFIGURE_FLAGS="--with-o2ib=$(pwd)/usr/src/ofa_kernel ${CONFIGURE_FLAGS}" - fi - - local smptype= - if pushd usr/src/linux-*-obj/${TARGET_ARCH}; then - local smptypes="$SMPTYPES" - [ "$RPMSMPTYPE" = "" ] || smptypes=$RPMSMPTYPE - ( ! $PATCHLESS ) && [ ! "$KERNCONFSMPTYPE" = "" ] && smptypes="$KERNCONFSMPTYPE" - local cursmptype= - for cursmptype in $smptypes; do - [ "$cursmptype" = "''" ] && continue - [ -d $cursmptype ] && smptype=$cursmptype - [ -d $smptype ] && break - done - popd - fi - if [ "${smptype}" = "" ]; then - popd - return 255 # cannot detect smp type - fi - if pushd usr/src/linux-*-obj/${TARGET_ARCH}/$smptype/include2; then - local base=$(readlink asm) - if [ ! -d "/${base}/" ]; then - rm -f asm - base=$(basename "$base") - if pushd ../../../../linux-*/include; then - local lsrc=$(pwd) - popd - [ -d "$lsrc/${base}" ] && ln -s $lsrc/${base} asm - fi - fi - popd - read a b < <(echo $(pwd)/usr/src/linux-*) - if [[ $a == $(pwd)/* && $b = $(pwd)/* ]]; then - cp -f $a/include/linux/config.h $b/${TARGET_ARCH}/$smptype/include/linux/ - cp $b/${TARGET_ARCH}/$smptype/.config $a/ - [ -f "$b/${TARGET_ARCH}/$smptype/.config" ] && KERNELRPMCONFIG="$b/${TARGET_ARCH}/$smptype/.config" - cp $b/${TARGET_ARCH}/$smptype/.kernelrelease $a/ - [ -f "$b/${TARGET_ARCH}/$smptype/.kernelrelease" ] && KERNELRPMRELEASE="$b/${TARGET_ARCH}/$smptype/.kernelrelease" - LINUX=$a - LINUXOBJ=$b/${TARGET_ARCH}/$smptype -# local fname=$(basename $kernel_rpm) -# KERNELRPMSDIR=${kernel_rpm%$fname} - fi - fi - popd - [ "$LINUX" = "" ] && return 255 - [ -d "$LINUX" ] || return 255 -} - -#build linux kernel rpm -build_linux_rpm() { - pushd $LINUX || return 255 - make binrpm-pkg || ( popd ; return 255 ) - local addlnxrel= - [ -f ".version" ] && addlnxrel="-$(cat .version)" - popd - local arch= - for arch in $TARGET_ARCHS_ALL; do - [ -f "/usr/src/rpm/RPMS/$arch/kernel-$lnxmaj.${lnxrel}${addlnxrel}.$arch.rpm" ] && \ - KERNELRPM="/usr/src/rpm/RPMS/$arch/kernel-$lnxmaj.${lnxrel}${addlnxrel}.$arch.rpm" && \ - TARGET_ARCH="$arch" - [ -f "/usr/src/packages/RPMS/$arch/kernel-$lnxmaj.${lnxrel}${addlnxrel}.$arch.rpm" ] && \ - KERNELRPM="/usr/src/packages/RPMS/$arch/kernel-$lnxmaj.${lnxrel}${addlnxrel}.$arch.rpm" && \ - TARGET_ARCH="$arch" - done - [ "$KERNELRPM" = "" ] || return - return 255 -} - -#build linux kernel -build_linux() { - local nofullmake=$1 - local nocopykernel=$2 - pushd $LINUX || fatal 1 "Kernel source not found" - [ "$nofullmake" = "nofullmake" ] || make mrproper - [ "$nofullmake" = "nofullmake" ] || rm -f rpm-release -# [ "$nocopykernel" = "copyrpmkernel" ] || rm -f localversion-* - [ "$nocopykernel" = "copykernel" ] && [ -f "$CONFIG_FILE" ] && cp $CONFIG_FILE .config - if [ "$nocopykernel" = "copyrpmkernel" ]; then - [ -f "$KERNELRPMCONFIG" ] && cp $KERNELRPMCONFIG .config - if [ -f "$KERNELRPMRELEASE" ]; then - cp $KERNELRPMRELEASE . - else - sed -e "s/^EXTRAVERSION\s\+=\s\+.*$/EXTRAVERSION = -${lnxrel}/" < Makefile > Makefile.new - [ -f "Makefile.new" ] && mv Makefile.new Makefile - fi - fi - [ -f ".config" ] || ( popd ; echo "Cannot find .config file"; return 255 ) - make oldconfig || ( popd ; return 255 ) - make include/linux/version.h - if [ ! "$nofullmake" = "nofullmake" ]; then - make || ( popd ; return 255 ) - fi - popd - return -} - -#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= - local rpmfound=false - local buildsuccess=false - local storeforreuse=false - if [ "$KERNELRPMSBASE" = "" ] || [ ! -d "$KERNELRPMSBASE" ]; then - return 255 - fi - [ -d $TOPDIR/reused ] && rm -rf $TOPDIR/reused - - local delimiter=${EXTRA_VERSION_DELIMITER:-"-"} - - # default to source type -source and special case below - local type=-source - case "$DISTRO" in - rhel*) - type=-devel - ;; - esac - - local kernel_devel_rpm - - if ! kernel_devel_rpm=$(find_linux_rpm "$type" "$delimiter"); then - fatal 1 "Could not find the kernel$type RPM in ${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}" - fi - - # find_linux_rpm() used to set these globals, but now it's a function - # run in a subshell so it's unable to set globals in our namespace - TARGET_ARCH=$(rpm -q --queryformat "%{ARCH}" -p "$kernel_devel_rpm") - BUILD_ARCHS="$TARGET_ARCH" - - unpack_linux_devel_rpm "$kernel_devel_rpm" "$delimiter" && rpmfound=true - - [ -d SRPMS ] || mkdir SRPMS - [ -d RPMS ] || mkdir RPMS - [ -d BUILD ] || mkdir BUILD - [ -d SOURCES ] || mkdir SOURCES - - # first build kernel-ib - 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" ] && \ - cp "$KERNELRPM" RPMS/${TARGET_ARCH}/ - [ -d "RPMS/${TARGET_ARCH}" ] && [ -f "$KERNELSOURCERPM" ] && \ - cp "$KERNELSOURCERPM" RPMS/${TARGET_ARCH}/ - KERNELCOMPILEDIR="$LINUX" - if $storeforreuse; then - store_for_reuse || echo "Cannot store for future reuse" - fi - - return - elif ! $rpmfound; then - echo "COULD NOT FIND VENDOR -devel or -source RPM for $DISTRO/$TARGET_ARCH: $lnxmaj-$lnxrel in $KERNELRPMSBASE" - return 255 - else - echo "Patchless build failed." - return 255 - fi -} - -#check timestamp value. should bi 14-digits string -check_timestamp() { - local invalue=$1 - local timestampnodig=$(echo $invalue | sed -e s/[0-9]*//g) - [ "$timestampnodig" = "" ] || return 255 - local timestamplength="${#invalue}" - [ $timestamplength -eq 14 ] || return 255 -} - -# get list of suitable directories with potential reused staff -get_reuse_dir_list() { - local rpmonly=$1 - local reusedkernelmasknew=$2 - local buildtimestamp= - local dirsforreuse= - local sourcelastdate=$(get_last_source_date) - for buildtimestamp in $(ls "$REUSEBUILD/" 2>&1); do - [ -d "$REUSEBUILD/$buildtimestamp" ] || continue - check_timestamp "$buildtimestamp" || continue - local buildtimestampstr=$(echo $buildtimestamp | \ - sed -e "s^\(....\)\(..\)\(..\)\(..\)\(..\)\(..\)^\1-\2-\3 \4:\5:\6 GMT^g") - local buildtimestampepoch=$(date --date="$buildtimestampstr" +%s ) - #check for suitable date - if ! $PATCHLESS; then - [ $buildtimestampepoch -ge $sourcelastdate ] || continue - fi - #check for suitable version - if [ "$rpmonly" = "rpmonly" ]; then - local reusedkernelprefix="kernel-lustre-" - ( $PATCHLESS ) && reusedkernelprefix= - local rpmmask="${reusedkernelprefix}${REUSEDKERNELMASK}" - [ "$reusedkernelmasknew" = "" ] || rpmmask="$reusedkernelmasknew" - [ -f $REUSEBUILD/$buildtimestamp/${rpmmask}.rpm ] && \ - dirsforreuse="$dirsforreuse $REUSEBUILD/$buildtimestamp" - else - local rpmmask="$REUSEDKERNELMASK" - [ "$reusedkernelmasknew" = "" ] || rpmmask="$reusedkernelmasknew" - pushd $REUSEBUILD/$buildtimestamp/linux-${rpmmask} > /dev/null 2>&1 || continue - local curdir=$(pwd) - dirsforreuse="$dirsforreuse $curdir" - popd - fi - done - echo "$dirsforreuse" -} - -#try to reuse old RPM -build_sequence_rpm_reuse() { - local sourcerpm=$1 - [ "$REUSERPM" = "" ] && [ "$REUSEBUILD" = "" ] && return 255 - local dirsforreuse= - if ! [ "$REUSEBUILD" = "" ] && [ -d "$REUSEBUILD" ]; then #try to reuse RPM - local REUSEDKERNELMASKnew=$(echo $REUSEDKERNELMASK | sed -e "s/^[^0-9]*//") - REUSEDKERNELMASKnew="kernel-lustre-source-${REUSEDKERNELMASKnew}" - local dirsforreuse="$(get_reuse_dir_list rpmonly $REUSEDKERNELMASKnew)" - local buildsuccess=false - LINUXOBJ= - for curdir in $(echo $dirsforreuse); do - [ -d "$curdir" ] || continue - local reusedkernelprefix="kernel-lustre-" - local reusedkernelrpm= - [ -f ${curdir}/${reusedkernelprefix}${REUSEDKERNELMASK}.rpm ] && \ - reusedkernelrpm=$(ls ${curdir}/${reusedkernelprefix}${REUSEDKERNELMASK}.rpm | head -1 ) - [ -f "$reusedkernelrpm" ] || continue - - local reusedkernelsourcerpm= - [ -f ${curdir}/${REUSEDKERNELMASKnew}.rpm ] && \ - reusedkernelsourcerpm=$(ls ${curdir}/${REUSEDKERNELMASKnew}.rpm | head -1 ) - [ -f "$reusedkernelsourcerpm" ] || continue - - # don't need to check for kernel-ib RPM reuse here because sles9 is not supported - # by OFED >= 1.3.0 and this function appears to only be used for sles9 - - [ -d $TOPDIR/reused ] && rm -rf $TOPDIR/reused - reuse_kernel_rpm "$reusedkernelsourcerpm" "" && build_linux nofullmake copyrpmkernel && build_lustre && buildsuccess=true - ( $buildsuccess ) || continue - if ( ! $NORPM ) && ( ! $PATCHLESS ) ; then - [ -f "$reusedkernelrpm" ] && \ - cp -f "$reusedkernelrpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1 - - [ -f "$reusedkernelsourcerpm" ] && \ - cp -f "$reusedkernelsourcerpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1 && \ - touch RPMS/${TARGET_ARCH}/kernel_was_reused - fi - return - done - fi - return 255 -} - -#try to reuse old BUILD dir -build_sequence_reuse() { - local sourcerpm=$1 - [ "$REUSERPM" = "" ] && [ "$REUSEBUILD" = "" ] && return 255 - local dirsforreuse= - if [ ! "$REUSEBUILD" = "" ] && [ -d "$REUSEBUILD" ]; then #try to reuse old kernel build directory - local dirsforreuse="$(get_reuse_dir_list)" - local buildsuccess=false - LINUXOBJ= - local REUSEDKERNELMASKnew=$(echo $REUSEDKERNELMASK | sed -e "s/^[^0-9]*//") - for curdir in $(echo $dirsforreuse); do - local reusedkernelrpm= - local reusedkernelsourcerpm= - local reusedkernelibrpm= - [ -d "$curdir" ] || 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 ] && \ - reusedkernelrpm=$(ls ${curdir}/../${reusedkernelprefix}${REUSEDKERNELMASK}.rpm | head -1 ) - reusedkernelprefix="kernel-lustre-source-" - [ -f ${curdir}/../${reusedkernelprefix}${REUSEDKERNELMASKnew}.rpm ] && \ - reusedkernelsourcerpm=$(ls ${curdir}/../${reusedkernelprefix}${REUSEDKERNELMASKnew}.rpm | head -1 ) - 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 ] && \ - reusedkernelibrpm=$(ls ${curdir}/../${reusedkernelprefix}${OFED_VERSION}-${LUSTRE_EXTRA_VERSION}.${TARGET_ARCH}.rpm | head -1 ) - reusedkernelibdevelrpm=$(ls ${curdir}/../${reusedkernelprefix}devel-${OFED_VERSION}-${LUSTRE_EXTRA_VERSION}.${TARGET_ARCH}.rpm | head -1 ) - fi - if ! ( $NORPM ) && ! [ -f "$reusedkernelrpm" ]; then #kernel rpm not found. Build all - continue - fi - if ! ( $NORPM ) && ! [ -f "$reusedkernelsourcerpm" ]; then #kernel source rpm not found. Build all - 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 - touch "$curdir/../" - buildsuccess=true - if ( ! $NORPM ) && ( ! $PATCHLESS ) ; then - [ -f "$reusedkernelrpm" ] && \ - cp -f "$reusedkernelrpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1 && \ - touch RPMS/${TARGET_ARCH}/kernel_was_reused - [ -f "$reusedkernelsourcerpm" ] && \ - cp -f "$reusedkernelsourcerpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1 - [ -f "$reusedkernelibrpm" ] && \ - cp -f "$reusedkernelibrpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1 - cp -f "$reusedkernelibdevelrpm" RPMS/${TARGET_ARCH}/ > /dev/null 2>&1 - fi - return - done - fi - return 255 -} - -build_sequence() { - if $DO_SRC; then - unpack_linux - patch_linux - pack_linux - clean_linux - fi - prep_kernel_build || return 255 - clean_lustre || return 255 - - build_kernel || return 255 -} - -old_school_download_kernel() { - - if [ "$KERNELDIR" ] ; then - KERNEL_FILE="$KERNELDIR/$KERNEL" - if [ ! -r "$KERNEL_FILE" ] ; then - # see if we have an SRPM we can build a tarball for - KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm - if [ -r "$KERNELDIR/$KERNEL_SRPM" ] ; then - build_tarball $CANONICAL_TARGET $KERNEL_SRPM - else - if $DOWNLOAD; then - echo "Downloading http://downloads.lustre.org/public/kernels/$DISTRO/old/$KERNEL..." - if ! wget -nv "http://downloads.lustre.org/public/kernels/$DISTRO/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 - else - [ -s "$KERNELDIR/$KERNEL" ] || { - rm -rf "$KERNELDIR/$KERNEL" - fatal 1 "Target $TARGET's kernel $KERNEL not found in directory $KERNELDIR." - } - fi - else - fatal 1 "Target $TARGET's kernel file $KERNEL not found in kernel directory $KERNELDIR." - fi - fi - fi - fi -} diff --git a/build/linux-merge-config.awk b/build/linux-merge-config.awk deleted file mode 100644 index 9a9338c..0000000 --- a/build/linux-merge-config.awk +++ /dev/null @@ -1,317 +0,0 @@ -#!/bin/awk -f -BEGIN { - nsects = 0 -} -{ - ARCH = $1 - ARCHES[ARCH] = 1 - TYPE = $2 - TYPES[TYPE] = 1 - NTOTAL++ - ARCHTYPES[ARCH ":" TYPE] = 1 - NARCHES[TYPE]++ - if (NARCHES[TYPE] == 1) - NTOTALTYPES++ - NTYPES[ARCH]++ - if (NTYPES[ARCH] == 1) - NTOTALARCHES++ - FILE = $3 - cursects = nsects - while ((getline < FILE) > 0) { - if ($0 ~ /^\/\*/ || $0 ~ /^ \*\// || $0 ~ /^[ ]*$/) - continue - if ($0 ~ /^ * /) { - SECTION = gensub(/^ \* /,"",$0) - if (!(SECTION in sectno)) { - sectno[SECTION] = nsects - counts[SECTION] = 0 - nsects++ - } else if (cursects && cursects != nsects) { - no = sectno[SECTION] - diff = nsects - cursects - for (s in sectno) { - if (sectno[s] >= cursects) - sectno[s] = sectno[s] - cursects + no - else if (sectno[s] >= no) - sectno[s] += diff - } - } - cursects = nsect - cursym[SECTION] = counts[SECTION] - continue - } - if ($1 != "#define" && $1 != "#undef") - exit 1 - SYMBOL = $2 - n = index($0,SYMBOL)+length(SYMBOL) - if ($1 == "#define") { - n = index($0,SYMBOL)+length(SYMBOL) - VALUE = gensub(/^[ ]*/,"","",substr($0,n)) - if (VALUE == "") VALUE = "__novalue__" - } else - VALUE = "__undefined__" - if (values[SYMBOL]) { - if (present[SYMBOL,ARCH,TYPE]) continue - present[SYMBOL,ARCH,TYPE] = 1 - values[SYMBOL] = values[SYMBOL] SUBSEP ARCH ":" TYPE ":" VALUE - if (SECTION == sections[SYMBOL] && cursym[SECTION] && cursym[SECTION] != counts[SECTION]) { - no = pos[SYMBOL] - diff = counts[SECTION]-cursym[SECTION] - for (s in pos) - if (sections[s] == SECTION) { - if (pos[s] >= cursym[SECTION]) - pos[s] = pos[s] - cursym[SECTION] + no - else if (pos[s] >= no) - pos[s] += diff - } - cursym[SECTION] = counts[SECTION] - } - } else { - present[SYMBOL,ARCH,TYPE] = 1 - values[SYMBOL] = ARCH ":" TYPE ":" VALUE - sections[SYMBOL] = SECTION - pos[SYMBOL] = counts[SECTION] - counts[SECTION]++ - } - } - close(FILE) -} -END { - for (SECTION in sectno) - x[sectno[SECTION]] = SECTION - for (i = 0; i < nsects; i++) { - SECTION = x[i] - if (i > 0) - printf "\n" - printf "/*\n * %s\n */\n", SECTION - split("",lines) - lastelse = "" - for (SYMBOL in sections) - if (sections[SYMBOL] == SECTION) - y[pos[SYMBOL]] = SYMBOL - for (j = 0; j < counts[SECTION]; j++) { - SYMBOL = y[j] - split("",ntype) - split("",total) - split(values[SYMBOL],z,SUBSEP) - split("",val) - totalsum = 0 - for (k in z) { - split(z[k],l,":") - ARCH = l[1] - TYPE = l[2] - VALUE = substr(z[k],length(ARCH)+length(TYPE)+3) - if (val[VALUE]) - val[VALUE] = val[VALUE] " " - val[VALUE] = val[VALUE] ARCH ":" TYPE - ntype[VALUE,TYPE] += 1 - total[VALUE] += 1 - totalsum += 1 - } - split("",curlines) - append = 1 - for (VALUE in val) { - if (total[VALUE] == NTOTAL) { - if (VALUE == "__undefined__") - curlines["1"] = "#undef " SYMBOL "\n" - else if (VALUE == "__novalue__") - curlines["1"] = "#define " SYMBOL "\n" - else - curlines["1"] = "#define " SYMBOL " " VALUE "\n" - if (!lines["1"]) - append = 0 - break - } - shorteststr = "" - curcount = 0 - for (m = 0; m < 4; m++) { - str = "" - split(val[VALUE],yy) - if (total[VALUE] > 1 && total[VALUE] == NTOTAL - 1) { - found = 0 - for (arch in ARCHES) { - for (type in TYPES) { - archtype = arch ":" type - if (ARCHTYPES [archtype] == 1) { - for (n in yy) - if (yy[n] == archtype) - break - if (yy[n] != archtype) { - found = 1 - break - } - } - } - if (found) - break - } - if (NARCHES[type] > 1 && NTYPES[arch] > 1) { - str = "!defined(__module__" arch "_" type ")" - shorteststr = str - break - } - } - if (m == 0 || m == 2) { - nfull = 0 - split("",yysave) - for (type in TYPES) - if (ntype[VALUE,type] == NARCHES[type]) { - if (str) str = str " || " - str = str "defined(__module__" type ")" - for (k in yy) { - split(yy[k], z, ":") - if (z[2] == type) { - yysave[k] = yy[k] - delete yy[k] - } - } - nfull++ - } else - NOTYPE = type - if (m < 2 && nfull > 1 && nfull == NTOTALTYPES - 1) { - str = "!defined(__module__" NOTYPE ")" - for (k in yysave) - yy[k] = yysave[k] - for (k in yy) { - split(yy[k], z, ":") - if (z[2] != NOTYPE) - delete yy[k] - } - } - } - savestr = str - nfull = 0 - split("",yysave) - for (arch in ARCHES) { - narch = 0 - for (k in yy) { - split(yy[k], z, ":") - if (z[1] == arch) - narch++ - } - if (narch == NTYPES[arch]) { - if (str) str = str " || " - str = str "defined(__module__" arch ")" - for (k in yy) { - split(yy[k], z, ":") - if (z[1] == arch) { - yysave[k] = yy[k] - delete yy[k] - } - } - nfull++ - } else - NOARCH = arch - } - if (m < 2 && nfull > 1 && nfull == NTOTALARCHES - 1) { - str = savestr - for (k in yysave) - yy[k] = yysave[k] - if (str) str = str " || " - str = str "!defined(__module__" NOARCH ")" - for (k in yy) { - split(yy[k], z, ":") - if (z[1] != NOARCH) - delete yy[k] - } - } - if (m == 1 || m == 3) { - savestr = str - nfull = 0 - split("",yysave) - for (type in TYPES) { - ntypex = 0 - for (k in yy) { - split(yy[k], z, ":") - if (z[2] == type) - ntypex++ - } - if (ntypex == NARCHES[type]) { - if (str) str = str " || " - str = str "defined(__module__" type ")" - for (k in yy) { - split(yy[k], z, ":") - if (z[2] == type) { - yysave[k] = yy[k] - delete yy[k] - } - } - nfull++ - } else - NOTYPE = type - } - if (m < 2 && nfull > 1 && nfull == NTOTALTYPES - 1) { - str = savestr - for (k in yysave) - yy[k] = yysave[k] - if (str) str = str " || " - str = "!defined(__module__" NOTYPE ")" - for (k in yy) { - split(yy[k], z, ":") - if (z[2] != NOTYPE) - delete yy[k] - } - } - } - for (k in yy) { - split(yy[k], z, ":") - if (str) str = str " || " - str = str "defined(__module__" z[1] "_" z[2] ")" - } - if (m == 0 || length(str) < length(shorteststr)) - shorteststr = str - } - str = shorteststr - if (VALUE == "__undefined__") - curlines[str] = "#undef " SYMBOL "\n" - else if (VALUE == "__novalue__") - curlines[str] = "#define " SYMBOL "\n" - else - curlines[str] = "#define " SYMBOL " " VALUE "\n" - if (!lines[str]) - append = 0 - } - if (append) { - for (str in curlines) - if (curlines[str]) - lines[str] = lines[str] curlines[str] - } else { - if (lines["1"]) - printf "%s", lines["1"] - else if (j > 0) { - ifstr = "#if " - for (str in lines) - if (lines[str] && str != lastelse) { - printf "%s %s\n%s", ifstr, str, lines[str] - ifstr = "#elif " - } - if (lastelse != "") - printf "#else\n%s", lines[lastelse] - printf "#endif\n" - } - split("",lines) - lastelse = "" - for (str in curlines) - if (curlines[str]) { - lines[str] = curlines[str] - if (totalsum == NTOTAL && length(str) > length(lastelse)) { - lastelse = str - } - } - } - } - if (lines["1"]) - printf "%s", lines["1"] - else if (j > 0) { - ifstr = "#if " - for (str in lines) - if (lines[str] && str != lastelse) { - printf "%s %s\n%s", ifstr, str, lines[str] - ifstr = "#elif " - } - if (lastelse != "") - printf "#else\n%s", lines[lastelse] - printf "#endif\n" - } - } -} diff --git a/build/linux-merge-modules.awk b/build/linux-merge-modules.awk deleted file mode 100644 index babc815..0000000 --- a/build/linux-merge-modules.awk +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/awk -f -{ - # lines in input look like ARCH TYPE path/to/TYPE/ARCH/modules/foo.ver - ARCH=$1 - ARCHES[ARCH]=1 - TYPE=$2 - TYPES[TYPE]=1 - NTOTAL++ - NARCHES[TYPE]++ - NTYPES[ARCH]++ - FILE=$3 - - # read files that look like pairs of repeating - # #define __ver_foo hexstring - # #define foo _set_ver(foo) - while ((getline < FILE) > 0) { - if ($0 ~ /^[ ]*$/) - continue - if ($1 != "#define" || $2 !~ /^__ver_/) - exit 1 - - # this is a "#define __ver_foo somehex" line - SYMBOL=gensub(/^__ver_/,"","",$2) - VALUE=gensub(/^(smp_|2gig_|smp2gig_)/,"","",$3) - VALUE=gensub(/^(smp|2gig|smp2gig)/,"","",VALUE) - values[SYMBOL,ARCH,TYPE]=VALUE - - # skip the "#define foo _set_ver(foo)" line - if ((getline < FILE) <= 0) - exit 2 - if ($1 != "#define" || $2 != SYMBOL || $3 != "_set_ver(" SYMBOL ")") - exit 3 - } - close(FILE) -} -END { - count=0 - for (key in values) - if (values[key]) { - count++ - split(key,x,SUBSEP) - SYMBOL=x[1] - ARCH=x[2] - TYPE=x[3] - - # (re)initialize a few arrays to have no elements - split("",x) - split("",ntype) - split("",total) - - totalsum=0 - for (arch in ARCHES) - for (type in TYPES) - if (values[SYMBOL,arch,type]) { - VALUE = values[SYMBOL,arch,type] - values[SYMBOL,arch,type] = "" - ntype[VALUE,type] += 1 - total[VALUE] += 1 - if (x[VALUE]) - x[VALUE] = x[VALUE] " " - x[VALUE] = x[VALUE] arch ":" type - } - ifstr="#if " - for (VALUE in x) { - if (total[VALUE] == NTOTAL) { - # there is only one checksum for this symbol - printf "#define __ver_%s\t_ver_str(%s)\n", SYMBOL, VALUE - printf "#define %s _set_ver(%s)\n", SYMBOL, SYMBOL - break - } - - totalsum += total[VALUE] - if (totalsum == NTOTAL && ifstr == "#elif") { - # this is the last unique checksum for this symbol - printf "#else\n#define __ver_%s\t_ver_str(%s)\n", SYMBOL, VALUE - printf "#define %s _set_ver(%s)\n", SYMBOL, SYMBOL - break - } - - # there must be more than one checksum still to - # print for this symbol - str="" - split(x[VALUE],y) - for (type in TYPES) - if (ntype[VALUE,type] == NARCHES[type]) { - if (str) str = str " || " - str = str "defined(__module__" type ")" - for (k in y) { - split(y[k], z, ":") - if (z[2] == type) - delete y[k] - } - } - for (arch in ARCHES) { - narch=0 - for (k in y) { - split(y[k], z, ":") - if (z[1] == arch) - narch++ - } - if (narch == NTYPES[arch]) { - if (str) str = str " || " - str = str "defined(__module__" arch ")" - for (k in y) { - split(y[k], z, ":") - if (z[1] == arch) - delete y[k] - } - } - } - for (k in y) { - split(y[k], z, ":") - if (str) str = str " || " - str = str "defined(__module__" z[1] "_" z[2] ")" - } - printf "%s %s\n#define __ver_%s\t_ver_str(%s)\n", ifstr, str, SYMBOL, VALUE - printf "#define %s _set_ver(%s)\n", SYMBOL, SYMBOL - ifstr="#elif " - } - if (ifstr == "#elif ") - printf "#endif\n" - } - if (!count) - printf "\n" -} diff --git a/build/linux-rhconfig.h b/build/linux-rhconfig.h deleted file mode 100644 index 3c883eb..0000000 --- a/build/linux-rhconfig.h +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -/* - * Try to be a little smarter about which kernel are we currently running - */ - -#ifndef __rh_config_h__ -#define __rh_config_h__ - -/* - * First, get the version string for the running kernel from - * /boot/kernel.h - initscripts should create it for us - */ - -#include "/boot/kernel.h" - -#if defined(__BOOT_KERNEL_SMP) && (__BOOT_KERNEL_SMP == 1) -#define __module__smp -#endif /* __BOOT_KERNEL_SMP */ - -#if defined(__BOOT_KERNEL_BOOT) && (__BOOT_KERNEL_BOOT == 1) -#define __module__BOOT -#endif /* __BOOT_KERNEL_BOOT */ - -#if defined(__BOOT_KERNEL_BOOTSMP) && (__BOOT_KERNEL_BOOTSMP == 1) -#define __module__BOOTsmp -#endif /* __BOOT_KERNEL_BOOTSMP */ - -#if defined(__BOOT_KERNEL_ENTERPRISE) && (__BOOT_KERNEL_ENTERPRISE == 1) -#define __module__enterprise -#endif /* __BOOT_KERNEL_ENTERPRISE */ - -#if defined(__BOOT_KERNEL_BIGMEM) && (__BOOT_KERNEL_BIGMEM == 1) -#define __module__bigmem -#endif /* __BOOT_KERNEL_BIGMEM */ - -#if defined(__BOOT_KERNEL_DEBUG) && (__BOOT_KERNEL_DEBUG == 1) -#define __module__debug -#endif /* __BOOT_KERNEL_DEBUG */ - -#if !defined(__module__smp) && !defined(__module__BOOT) && !defined(__module__BOOTsmp) && !defined(__module__enterprise) && !defined(__module__bigmem) && !defined(__module__debug) -#define __module__up -#endif /* default (BOOT_KERNEL_UP) */ - -#ifdef __i386__ -# if defined(__MODULE_KERNEL_i586) && (__MODULE_KERNEL_i586 == 1) -# define __module__i586 -# ifdef __module__up -# define __module__i586_up -# endif -# ifdef __module__smp -# define __module__i586_smp -# endif -# ifdef __module__BOOT -# define __module__i586_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__i586_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__i586_enterprise -# endif -# ifdef __module__debug -# define __module_i586_debug -# endif -# elif defined(__MODULE_KERNEL_i686) && (__MODULE_KERNEL_i686 == 1) -# define __module__i686 -# ifdef __module__up -# define __module__i686_up -# endif -# ifdef __module__smp -# define __module__i686_smp -# endif -# ifdef __module__BOOT -# define __module__i686_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__i686_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__i686_enterprise -# endif -# ifdef __module__bigmem -# define __module__i686_bigmem -# endif -# ifdef __module__debug -# define __module_i686_debug -# endif -# elif defined(__MODULE_KERNEL_athlon) && (__MODULE_KERNEL_athlon == 1) -# define __module__athlon -# ifdef __module__up -# define __module__athlon_up -# endif -# ifdef __module__smp -# define __module__athlon_smp -# endif -# ifdef __module__BOOT -# define __module__athlon_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__athlon_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__athlon_enterprise -# endif -# ifdef __module__bigmem -# define __module__athlon_bigmem -# endif -# ifdef __module__debug -# define __module__athlon_debug -# endif -# else -# define __module__i386 -# ifdef __module__up -# define __module__i386_up -# endif -# ifdef __module__smp -# define __module__i386_smp -# endif -# ifdef __module__BOOT -# define __module__i386_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__i386_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__i386_enterprise -# endif -# ifdef __module__debug -# define __module__i386_debug -# endif -# endif -#endif - -#ifdef __sparc__ -# ifdef __arch64__ -# define __module__sparc64 -# ifdef __module__up -# define __module__sparc64_up -# endif -# ifdef __module__smp -# define __module__sparc64_smp -# endif -# ifdef __module__BOOT -# define __module__sparc64_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__sparc64_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__sparc64_enterprise -# endif -# ifdef __module__debug -# define __module__sparc64_debug -# endif -# else -# define __module__sparc -# ifdef __module__up -# define __module__sparc_up -# endif -# ifdef __module__smp -# define __module__sparc_smp -# endif -# ifdef __module__BOOT -# define __module__sparc_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__sparc_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__sparc_enterprise -# endif -# ifdef __module__debug -# define __module__sparc_debug -# endif -# endif -#endif - -#ifdef __alpha__ -# define __module__alpha -# ifdef __module__up -# define __module__alpha_up -# endif -# ifdef __module__smp -# define __module__alpha_smp -# endif -# ifdef __module__BOOT -# define __module__alpha_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__alpha_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__alpha_enterprise -# endif -# ifdef __module__debug -# define __module__alpha_debug -# endif -#endif - -#ifdef __ia64__ -# define __module__ia64 -# ifdef __module__up -# define __module__ia64_up -# endif -# ifdef __module__smp -# define __module__ia64_smp -# endif -# ifdef __module__BOOT -# define __module__ia64_BOOT -# endif -# ifdef __module__BOOTsmp -# define __module__ia64_BOOTsmp -# endif -# ifdef __module__enterprise -# define __module__ia64_enterprise -# endif -# ifdef __module__debug -# define __module__ia64_debug -# endif -#endif - -#if defined(__module__smp) || defined(__module__BOOTsmp) || defined(__module__enterprise) || defined(__module__bigmem) -#define _ver_str(x) smp_ ## x -#else -#define _ver_str(x) x -#endif - -#define RED_HAT_LINUX_KERNEL 1 - -#endif /* __rh_config_h__ */ diff --git a/build/lmake b/build/lmake deleted file mode 100755 index 66f61e5..0000000 --- a/build/lmake +++ /dev/null @@ -1,924 +0,0 @@ -#!/bin/sh - -# option variables -DESTDIR= -KERNELDIR= -TARGET= -# Not sure what to put here -# TARGET_ARCH=$(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) -TARGET_ARCH= -TARGET_CONFIG= -JOBS=1 -CONFIGURE_FLAGS= -TMPDIR=${TMPDIR:-"/var/tmp"} - -# commands to run -BUILD_LUSTRE=0 -BUILD_KERNEL=0 -DEPEND_KERNEL=0 -INSTALL_LUSTRE=0 -INSTALL_KERNEL=0 -SAVE_HEADERS=0 -UNPACK_KERNEL=0 - -# provided by target file -KERNEL= -SERIES= -CONFIG= -VERSION= -EXTRA_VERSION= - -BASE_ARCHS= -BIGMEM_ARCHS= -BOOT_ARCHS= -JENSEN_ARCHS= -SMP_ARCHS= -BIGSMP_ARCHS= -PSERIES64_ARCHS= -UP_ARCHS= - -RHBUILD=0 -SUSEBUILD=0 - -# flat-out globals -TOPDIR= -TARGET_FILE= -KERNEL_FILE= -SERIES_FILE= -CONFIG_FILE= -RPMBUILD= -XEN=false - -canon() -{ - pushd $1 >/dev/null - echo $PWD - popd >/dev/null -} -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() -{ - true -} - -fatal() -{ - cleanup - [ "$2" ] && echo - [ "$2" ] && echo "${0##*/}: $2" - exit $1 -} - -list_targets() -{ - echo -n "Available targets:" - for target in $TOPDIR/lustre/kernel_patches/targets/*.target ; do - target_file=${target##*/} - echo -n " ${target_file%%.target}" - done - echo -} - - -usage() -{ - cat <] - -Options: - - --build - same as --build-kernel --build-lustre --unpack-kernel - - --build-lustre - configure and compile lustre. Requires that --build-kernel was - already run. - - --build-kernel - configure and compile a kernel. Implies --depend-kernel. - Requires that --unpack-kernel was already run. - - --depend-kernel) - Prepares a kernel tree for building (similar to make mrproper - oldconfig dep). Requires that --unpack-kernel was already run. - - --destdir=DESTDIR - Root directory to install into (like DESTDIR with auto*). - - --extraversion=EXTRAVERSION - Overrides the target kernel\'s EXTRAVERSION text. - - -h, --help - Display this message. - - --install - same as --install-kernel --install-lustre - - --install-lustre - run make install in the Lustre tree. - - --install-kernel - install the kernel image and modules. - - -j jobs - This works just like the -j option to make, and is passed to make - when building. - - --kerneldir=KERNELDIR - Directory containing linux source tarballs. - - --target=TARGET - Name of the configuration to use. The available targets are - listed below. - - --target-arch=ARCH - Specifies an architecture to use when choosing a kernel config - file. Default is i386. - - --target-config=CONFIG - Specifies a special option (such as smp, bigsmp, bigmem, or BOOT) - to use when choosing a kernel config file. This also modifies the - kernel version and modules directory. - - --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 - etc.). - -EOF - list_targets - - fatal "$1" "$2" -} - -check_options() -{ - (( $BUILD_LUSTRE || $BUILD_KERNEL || $DEPEND_KERNEL || \ - $INSTALL_LUSTRE || $INSTALL_KERNEL || $SAVE_HEADERS || \ - $UNPACK_KERNEL )) || \ - fatal 1 "No commands specified." - - if (( $UNPACK_KERNEL )) ; then - [ "$KERNELDIR" ] || \ - fatal 1 "A kernel directory must be specified with --kerneldir." - [ -d "$KERNELDIR" ] || \ - fatal 1 "$KERNELDIR is not a directory." - fi - - if (( $INSTALL_LUSTRE || $INSTALL_KERNEL || $SAVE_HEADERS )) ; then - [ -z "$DESTDIR" -o -d "$DESTDIR" ] || \ - fatal 1 "$DESTDIR is not a directory." - fi - - [ "$TARGET" ] || usage 1 "A target must be specified with --target." - TARGET_FILE="$TOPDIR/lustre/kernel_patches/targets/$TARGET.target" - [ -r "$TARGET_FILE" ] || \ - fatal 1 "Target '$TARGET' was not found. Try --list-targets." - - 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() -{ - for series in $SERIES ; do - SERIES_FILE="$TOPDIR/lustre/kernel_patches/series/$series" - lustre_patch=$(grep lustre_version "$SERIES_FILE" 2>/dev/null) - [ "$lustre_patch" ] && break - done - [ "$lustre_patch" ] || \ - fatal 1 "Could not determine Lustre version from $SERIES series." - - awk '/^\+#define LUSTRE_KERNEL_VERSION /{ print $3 }' \ - "$TOPDIR/lustre/kernel_patches/patches/$lustre_patch" 2>/dev/null -} - -load_target() -{ - EXTRA_VERSION_save="$EXTRA_VERSION" - - . "$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" ] || \ - fatal 1 "Target $TARGET's kernel file $KERNEL not found in kernel directory $KERNELDIR." - fi - - if [ "$SERIES" ] ; then - for series in $SERIES ; do - SERIES_FILE="$TOPDIR/lustre/kernel_patches/series/$series" - [ -r "$SERIES_FILE" ] || \ - fatal 1 "Target $TARGET's series $SERIES missing from $TOPDIR/lustre/kernel_patches/series." - done - fi - - local XENPOSTFIX="" - if $XEN; then - XENPOSTFIX="-xen" - fi - - TARGET_ARCH=${TARGET_ARCH:-$BASE_ARCHS} - 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." - - if [ "$EXTRA_VERSION_save" ] ; then - EXTRA_VERSION="$EXTRA_VERSION_save" - else - EXTRA_VERSION="${EXTRA_VERSION}_lustre.$(get_lustre_version)" - 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 | *.tgz) - echo 'zxf' - ;; - *.tar.bz2) - echo 'jxf' - ;; - *.tar) - echo 'xf' - ;; - *) - fatal 1 "tarflags(): Unrecognized tar extension in file: $1" - ;; - esac -} - -untar() -{ - echo "Untarring ${1##*/}..." - tar $(tarflags $1) $1 -} - - -extract_kernel() -{ - (( $UNPACK_KERNEL )) || return 0 - pushd "$TOPDIR" >/dev/null - if [ -d linux ] ; then - [ -L linux ] && rm -rf $(readlink linux) - rm -rf linux - fi - untar "$KERNEL_FILE" || fatal 1 "Error unpacking Linux tarball" - [ -d linux ] || ln -sf linux* linux - popd >/dev/null -} - -patch_kernel() -{ - (( $UNPACK_KERNEL )) || return 0 - [ "$SERIES" ] || return 0 - pushd "$TOPDIR/linux" >/dev/null - for series in $SERIES ; do - echo -n "Applying series $series:" - SERIES_FILE="$TOPDIR/lustre/kernel_patches/series/$series" - for patch in $(<"$SERIES_FILE") ; do - PATCH_FILE="$TOPDIR/lustre/kernel_patches/patches/$patch" - [ -r "$PATCH_FILE" ] || \ - fatal 1 "Patch file not found: $patch" - echo -n " $patch" - patch -s -p1 < "$PATCH_FILE" || fatal 1 "Error applying patch $patch." - done - echo - done - popd >/dev/null -} - -set_make() -{ - MAKE="make -s" - [ "$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 - case $TARGET_ARCH in - i?86) - ;; - *) - MAKE_ARCH="$MAKE ARCH=$TARGET_ARCH" - ;; - esac - fi - 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 - # we need to override $CC at make time, since there is no - # configure - set_make - pushd "$TOPDIR/linux" >/dev/null - echo "Overriding EXTRAVERSION in kernel..." - 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 "$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 - 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 "$MAKE_CC" include/asm - ;; - 2.4*) - $MAKE "$MAKE_CC" symlinks - $MAKE "$MAKE_CC" dep || fatal 1 "Error running make dep" - ;; - esac - $MAKE "$MAKE_CC" include/linux/version.h || fatal 1 "Error making include/linux/version.h" -} - -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 - x86_64 | ia64) - configure_options="--with-ipath_inf-mod" - ;; - ppc64) - 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 - 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 - - 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 - [ -f configure ] || sh ./autogen.sh - ./configure --with-linux=$PWD/linux $CONFIGURE_FLAGS || \ - fatal 1 "Error configuring Lustre." - popd >/dev/null -} - -build_lustre() -{ - (( $BUILD_LUSTRE )) || return 0 - set_make - pushd "$TOPDIR" >/dev/null - 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)" 2>&1 || \ - fatal 1 "Error building Lustre rpms." - # $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre." - popd >/dev/null -} - -install_kernel() -{ - (( $INSTALL_KERNEL )) || return 0 - set_make - pushd "$TOPDIR/linux" >/dev/null - mkdir -p "$DESTDIR/boot" - - install -m 644 System.map "$DESTDIR/boot/System.map-${FULL_VERSION}" - # install -m 644 module-info ... - install -m 644 "$CONFIG_FILE" "$DESTDIR/boot/config-${FULL_VERSION}" - - mkdir -p "$DESTDIR/dev/shm" - mkdir -p "$DESTDIR/lib/modules/${FULL_VERSION}" - - $MAKE "$MAKE_CC" INSTALL_MOD_PATH="$DESTDIR" KERNELRELEASE="$FULL_VERSION" \ - -s modules_install || \ - fatal 1 "Error installing modules." - - 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 - - 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 - pushd "$TOPDIR" >/dev/null - $MAKE "$MAKE_CC" -s install "DESTDIR=$DESTDIR" KERNELRELEASE="$FULL_VERSION" || fatal 1 "Error installing Lustre." - popd >/dev/null -} - -build_kms() -{ - (( $BUILD_KERNEL )) || return 0 - (( $SUSEBUILD )) || return 0 - set_make - 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 - build_dir="${TOPDIR}/modules-${FULL_VERSION}/${dir##*/}" - cp -a $dir $build_dir - # these modules are terrible, and don't all build - $MAKE_J "$MAKE_CC" -C $build_dir modules KERNEL_SOURCE="${TOPDIR}/linux" - fi - done -} - -symver() -{ - local file=$1 name=${1%.ko} - nm $file \ - | sed -ne 's,^0*\([0-9a-f]\{8\}\) A __crc_\(.*\),0x\1\t\2\t'"$name"',p' -} - -install_kms() -{ - (( $INSTALL_KERNEL )) || return 0 - (( $LINUX26 )) || return 0 - set_make - for build_dir in "${TOPDIR}/modules-${FULL_VERSION}/*" ; do - [ -d $build_dir ] || continue - # these modules are terrible, and don't all build - $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 - for module in $(find * -name '*.ko'); do - symver $module - done - cd $moddir - for module in $(find * -path 'kernel/*' -prune -o \ - -name '*.ko' -print); do - symver $module - done - ) | sort -u -k2 | gzip -c9 > $symvers_file -} - -save_headers() -{ - (( $SAVE_HEADERS )) || return 0 - - echo "Saving headers for ${TARGET_CONFIG:-up} ${TARGET_ARCH}..." - pushd linux >/dev/null - - 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/${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 ${TARGET_ARCH} ${TARGET_CONFIG} ../../savedheaders/${TARGET_ARCH}/${TARGET_CONFIG:-up}/ \ - >> "$RPM_BUILD_ROOT/usr/src/linux-${KVERREL}/savedheaders/list" - popd >/dev/null -} - -save_all_headers() -{ - (( $SAVE_HEADERS )) || return 0 - - for arch in $BIGMEM_ARCHS ; do - save_headers bigmem $arch - done - - for arch in $BOOT_ARCHS ; do - save_headers BOOT $arch - done - - for arch in $JENSEN_ARCHS ; do - save_headers jensen $arch - done - - for arch in $SMP_ARCHS ; do - save_headers smp $arch - done - - 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 -} - -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,xen" - -options=$(getopt -o hj: -l "$longopts" -- "$@") - -eval set -- "$options" - -while [ "$1" ] ; do - case "$1" in - '') - usage 1 - ;; - --build) - BUILD_LUSTRE=1 - BUILD_KERNEL=1 - DEPEND_KERNEL=1 - UNPACK_KERNEL=1 - shift - ;; - --build-lustre) - BUILD_LUSTRE=1 - shift - ;; - --build-kernel) - BUILD_KERNEL=1 - DEPEND_KERNEL=1 - shift - ;; - --depend-kernel) - DEPEND_KERNEL=1 - shift - ;; - --destdir) - DESTDIR=$2 - shift 2 - ;; - --extraversion) - EXTRA_VERSION=$2 - shift 2 - ;; - --help | -h) - usage 0 - ;; - --install) - INSTALL_LUSTRE=1 - INSTALL_KERNEL=1 - shift - ;; - --install-lustre) - INSTALL_LUSTRE=1 - shift - ;; - --install-kernel) - INSTALL_KERNEL=1 - shift - ;; - -j) - JOBS=$2 - shift 2 - ;; - --kerneldir) - KERNELDIR=$2 - shift 2 - ;; - --save-headers) - SAVE_HEADERS=1 - shift - ;; - --target) - TARGET=$2 - shift 2 - ;; - --target-arch) - TARGET_ARCH=$2 - shift 2 - ;; - --target-config) - TARGET_CONFIG=$2 - shift 2 - ;; - --unpack-kernel) - UNPACK_KERNEL=1 - shift - ;; - --xen) - XEN=true - shift - ;; - --) - shift - CONFIGURE_FLAGS=$@ - break - ;; - *) - usage 1 "Unrecognized option: $1" - ;; - esac -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 - -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 - -build_kms - -install_kernel -install_lustre - -install_kms - -cleanup_libmodules - -save_headers - -exit 0 diff --git a/build/lustre-kernel-2.4.spec.in b/build/lustre-kernel-2.4.spec.in deleted file mode 100644 index 292b527..0000000 --- a/build/lustre-kernel-2.4.spec.in +++ /dev/null @@ -1,980 +0,0 @@ -Summary: The Linux kernel (the core of the Linux operating system) - -# Versions of various parts - -# -# Polite request for people who spin their own kernel rpms: -# please modify the "release" field in a way that identifies -# that the kernel isn't the stock RHL kernel, for example by -# adding some text to the end of the version number. -# -%define kversion @KERNEL_VERSION@ -%define kextraver @KERNEL_EXTRA_VERSION@ -%define kextraverdelim @KERNEL_EXTRA_VERSION_DELIMITER@ -%define flavordelim "@KERNEL_TARGET_DELIMITER@" -%define release @KERNEL_RELEASE@ -# /usr/src/%{kslnk} -> /usr/src/linux-%{KVERREL} -%define kslnk linux-2.4 -%define kprovides %(bash -c "echo %{kversion}%{kextraverdelim}%{kextraver} | sed -e 's/-[^0-9]*smp$//'") - -# groups of related archs -%define all_x86 i386 i686 i586 athlon -#define all_x86 i686 i386 i586 athlon - -%define nptlarchs %{all_x86} -#define nptlarchs noarch -%define rhbuild @RHBUILD@ -%define susebuild @SUSEBUILD@ -%define linux26 @LINUX26@ -%define lmakeopts @LMAKEOPTS@ - -# disable build root strip policy -%define __spec_install_post /usr/lib/rpm/brp-compress || : -# -# RPM foo magic -%define _missing_doc_files_terminate_build 0 -%define _unpackaged_files_terminate_build 0 -%define debug_package %{nil} - -# Enable this to build a board-specific kernel configuration -# some architectures have LOTS of different setups and this -# is a way to deal with that cleanly. -# -#define targetboard assabet -%define dashtargetboard %{?targetboard:-%{targetboard}} -%define withtargetboard 0 -%{?targetboard: %{expand: %%define withtargetboard 1}} - -# Override generic defaults with per-arch defaults (which can -# themselves be overridden with --with/--without). These must -# ONLY be "0", never "1" - -%define buildbase 0 -%define buildbigmem 0 -%define buildBOOT 0 -%define buildjensen 0 -%define buildsmp 0 -%define buildbigsmp 0 -%define buildpseries64 0 -%define buildup 0 -%define buildsrc 0 - -%ifarch @BASE_ARCHS@ -%define buildbase 1 -%endif - -%ifarch @BIGMEM_ARCHS@ -%define buildbigmem 1 -%endif - -%ifarch @BOOT_ARCHS@ -%define buildBOOT 1 -%endif - -%ifarch @JENSEN_ARCHS@ -%define buildjensen 1 -%endif - -%ifarch @SMP_ARCHS@ -%define buildsmp 1 -%endif - -%ifarch @BIGSMP_ARCHS@ -%define buildbigsmp 1 -%endif - -%ifarch @PSERIES64_ARCHS@ -%define buildpseries64 1 -%endif - -%ifarch @UP_ARCHS@ -%define buildup 1 -%endif - -# For board-specific kernels, build only the normal kernel (which may actually be smp, not up). -%if %{withtargetboard} -%define buildsmp 0 -%define buildbigsmp 0 -%define buildBOOT 0 -%define buildbigmem 0 -%define buildpseries64 0 -%define buildjensen 0 -%endif - -%if 0 -Second, per-architecture exclusions (ifarch) -%ifarch i386 -%define buildsmp 0 -%endif -%ifarch ia64 -%define buildBOOT 0 -%endif -%endif - -# we can't test values inline, only whether a macro exists -%{expand: %%define buildup_%{buildup} yadda} -%{expand: %%define buildsmp_%{buildsmp} yadda} -%{expand: %%define buildbigsmp_%{buildbigsmp} yadda} -%{expand: %%define buildpseries64_%{buildpseries64} yadda} -%{expand: %%define buildBOOT_%{buildBOOT} yadda} -%{expand: %%define buildbigmem_%{buildbigmem} yadda} -%{expand: %%define buildjensen_%{buildjensen} yadda} -%{expand: %%define ikd_%{ikd} yadda} -%{expand: %%define ibcs_%{ibcs} yadda} -%{expand: %%define debuglevel_%{debugging} yadda} - -%{expand: %%define kernel_conflicts ppp <= 2.3.15, pcmcia-cs <= 3.1.20, isdn4k-utils <= 3.0, mount < 2.10r-5, nfs-utils < 0.3.1, cipe < 1.4.5, tux < 2.1.0, kudzu <= 0.92, e2fsprogs < 1.22, initscripts < 5.84, dev < 3.2-7, iptables < 1.2.5-3, bcm5820 < 1.81, nvidia-rh72 <= 1.0, oprofile < 0.4} - -%if %{rhbuild} -%define BOOT_kernel_prereq fileutils, modutils >= 2.4.18 -%define kernel_prereq %{BOOT_kernel_prereq}, initscripts >= 5.83, mkinitrd >= 3.2.6 -%endif - -%ifarch ia64 -%define initrd_dir /boot/efi/redhat -%else -%define initrd_dir /boot -%endif - -%ifarch %{all_x86} x86_64 -%define kernel_glob vmlinu?-%{KVERREL} -%endif -%ifarch ia64 -# , no GLOB_BRACE for filelists, efi needs to be done separately -%define kernel_glob vmlinuz-%{KVERREL} -%endif -%ifarch alpha -%define kernel_glob vmlinu?-%{KVERREL} -%endif -%ifarch ppc ppc64 -%define kernel_glob vmlinu?-%{KVERREL} -%endif - -Name: kernel-lustre -Version: %{kversion} -Release: %{release}%{?targetboard:%{targetboard}}%{?debuglevel_1:.dbg} -%define KVERREL %{PACKAGE_VERSION}%{kextraverdelim}%{kextraver}%{?targetboard:%{targetboard}}%{?debuglevel_1:.dbg} -License: GPL -Group: System Environment/Kernel -ExclusiveArch: %{all_x86} x86_64 ia64 ppc ppc64 -ExclusiveOS: Linux -Obsoletes: kernel-modules, kernel-sparc -Provides: kernel = %{kprovides} -BuildConflicts: rhbuildsys(DiscFree) < 500Mb -%ifarch %{all_x86} ia64 x86_64 -Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3 -%endif -Autoreqprov: no -%if %{rhbuild} -Prereq: %{kernel_prereq} -Conflicts: %{kernel_conflicts} - -BuildPreReq: patch >= 2.5.4, bash >= 2.03, sh-utils, gnupg, tar -BuildPreReq: bzip2, findutils, dev, gzip, m4 -%endif - -Vendor: Sun Microsystems, Inc. -URL: http://www.kernel.org/ -Buildroot: %{_tmppath}/%{name}-%{version}-root - -Source0: @LUSTRE_SOURCE@ -Source1: @KERNEL_SOURCE@ -Source2: external-patches.tar.gz - -Source15: linux-rhconfig.h -Source16: linux-merge-config.awk -Source17: linux-merge-modules.awk - -Source25: suse-functions.sh -Source26: suse-post.sh -Source27: suse-postun.sh -Source28: suse-trigger-script.sh.in -Source29: sles8-post.sh -Source30: sles8-postun.sh -Source31: sles8-pre.sh -Source32: sles8-update_INITRD_MODULES.sh -Source33: sles8-update_rcfile_setting.sh - -%package source -Summary: The source code for the Linux kernel. -Group: Development/System -Prereq: fileutils -Requires: gawk -Requires: gcc >= 2.96-98 -Autoreqprov: 0 - -%package doc -Summary: Various documentation bits found in the kernel source. -Group: Documentation - -%description -The kernel package contains the Linux kernel (vmlinuz), the core of a -Linux operating system. The kernel handles the basic functions of the -operating system: memory allocation, process allocation, device input -and output, etc. - -%description source -The kernel-source package contains the source code files for the Linux -kernel. These source files are needed to build custom/third party device -drivers. The source files can also be used to build a custom kernel that is -better tuned to your particular hardware, if you are so inclined (and you -know what you're doing). - -%description doc -This package contains documentation files form the kernel -source. Various bits of information about the Linux kernel and the -device drivers shipped with it are documented in these files. - -You'll want to install this package if you need a reference to the -options that can be passed to Linux kernel modules at load time. - -%package smp -Summary: The Linux kernel compiled for SMP machines. -Group: System Environment/Kernel -Provides: module-info, kernel = %{kprovides} -%ifarch %{all_x86} ia64 x86_64 -Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3 -%endif -%if %{rhbuild} -Prereq: %{kernel_prereq} -Conflicts: %{kernel_conflicts} -%endif - -%description smp -This package includes a SMP version of the Linux kernel. It is -required only on machines with two or more CPUs, although it should -work fine on single-CPU boxes. - -Install the kernel-smp package if your machine uses two or more CPUs. - -%package bigsmp -Summary: The Linux kernel compiled for SMP machines. -Group: System/Kernel -Provides: module-info, kernel = %{kprovides}, k_smp4G -Obsoletes: k_smp4G -%ifarch %{all_x86} ia64 x86_64 -Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3 -%endif -%if %{rhbuild} -Prereq: %{kernel_prereq} -Conflicts: %{kernel_conflicts} -%endif - -%description bigsmp -This package includes a SMP version of the Linux kernel. It is -required only on machines with two or more CPUs, although it should -work fine on single-CPU boxes. - -Install the kernel-bigsmp package if your machine uses two or more CPUs. - -%package pseries64 -Summary: Standard Kernel for 64-bit Power based SMP and LPAR Machines -Group: System/Kernel -Provides: module-info, kernel = %{kprovides}, k_smp4G -%ifarch %{all_x86} ia64 x86_64 -Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3 -%endif -%if %{rhbuild} -Prereq: %{kernel_prereq} -Conflicts: %{kernel_conflicts} -%endif - -%description pseries64 -The standard kernel for Power3, Power4 and PowerPC 970 64-bit SMP -machines. - -This kernel can be used for all 64bit RS/6000, pSeries and JS20 -machines. - -%package bigmem -Summary: The Linux Kernel for machines with more than 4 Gigabyte of memory. -Group: System Environment/Kernel -Provides: module-info, kernel = %{kprovides} -%ifarch %{all_x86} ia64 x86_64 -Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3 -%endif -%if %{rhbuild} -Prereq: %{kernel_prereq} -Conflicts: %{kernel_conflicts} -Obsoletes: kernel-enterprise <= 2.4.10 -%endif - -%description bigmem -This package includes a kernel that has appropriate configuration options -enabled for Pentium III machines with 4 Gigabyte of memory or more. - -%package BOOT -Summary: The version of the Linux kernel used on installation boot disks. -Group: System Environment/Kernel -Provides: kernel = %{kprovides} -%if %{rhbuild} -Prereq: %{BOOT_kernel_prereq} -Conflicts: %{kernel_conflicts} -%endif - -%description BOOT -This package includes a trimmed down version of the Linux kernel. -This kernel is used on the installation boot disks only and should not -be used for an installed system, as many features in this kernel are -turned off because of the size constraints. - -%package BOOTsmp -Summary: The Linux kernel used on installation boot disks for SMP machines. -Group: System Environment/Kernel -Provides: kernel = %{kprovides} -%if %{rhbuild} -Prereq: %{BOOT_kernel_prereq} -Conflicts: %{kernel_conflicts} -%endif - -%description BOOTsmp -This package includes a trimmed down version of the Linux kernel. This -kernel is used on the installation boot disks only and should not be used -for an installed system, as many features in this kernel are turned off -because of the size constraints. This kernel is used when booting SMP -machines that have trouble coming up to life with the uniprocessor kernel. - -%package jensen -Summary: The Linux Kernel compiled for the Alpha Jensen platform. -Group: System Environment/Kernel -Provides: kernel = %{kprovides} -%if %{rhbuild} -Prereq: %{kernel_prereq} -Conflicts: %{kernel_conflicts} -%endif - -%description jensen -This package includes a kernel that has appropriate configuration -options enabled for use on the Alpha Jensen platform. The Jensen -platform is not supported in the normal generic alpha kernel support. - -%package -n lustre-lite-utils -Summary: Lustre utils for Linux -Group: Applications/System - -%description -n lustre-lite-utils -The Lustre Lite file system utilities. This includes the tools needed -to configure, mount, and administer a Lustre filesystem. This package -is necessary if you want to access a Lustre filesystem. - -# the lustre-doc files are just included as %doc with -# lustre-lite-utils - -#%package -n lustre-doc -#Summary: Sample Lustre configurations and documentation -#Group: Documentation - -#%description -n lustre-doc -#The Lustre book, sample configurations, and other documentation for -#Lustre. - -# This is required in rpm >= 4.4.? and _should_ be set by the %setup macro -# but isn't, at least for 4.4.2. Yay RPM. -%define buildsubdir lustre-kernel-%{version} -%define _buildsubdir lustre-kernel-%{version} - -%prep -%setup -n lustre-kernel-%{version} -q -c -if [ ! -d lustre ] ; then - ln -sf lustre* lustre -fi -pushd lustre >/dev/null -if [ -s "%{SOURCE2}" ] ; then - tar zxf "%{SOURCE2}" -C lustre/kernel_patches -fi -bash -x ./build/lmake \ - --unpack-kernel \ - --target @LUSTRE_TARGET@ \ - --target-arch %{_target_cpu} \ - --kerneldir $RPM_SOURCE_DIR %{lmakeopts} -popd >/dev/null - -# handle both SuSE and Red Hat's new-kernel-pkg bits -for flavor in "" smp bigmem bigsmp pseries64 BOOT jensen ; do - [ -n "$flavor" ] && delim_flavor="%{flavordelim}$flavor" - for when in pre preun post postun ; do - script="${when}${flavor}.sh" - cat %{SOURCE25} %{SOURCE32} %{SOURCE33} > ${script} - echo "if [ -d /etc/susehelp.d ] ; then" >> ${script} - sed -e "s/@when@/$when/g" -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE28} >> ${script} - case $when in - pre) - echo "if [ ! -f /etc/modprobe.conf ] ; then" >> ${script} - cat %{SOURCE31} >> ${script} - echo "fi" >> ${script} - ;; - post) - # /sbin/update-modules.dep compares when the modules were built, rather - # than installed, so force modules.dep to be recreated - echo "rm -f /lib/modules/%{KVERREL}${delim_flavor}/modules.dep" >> ${script} - echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script} - sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" -e "s^%flavor^${flavor}^" %{SOURCE26} >> ${script} - - echo "else" >> ${script} - sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" -e "s^%%{cfg_name}^${delim_flavor}^g" %{SOURCE29} >> ${script} - echo "fi" >> ${script} - ;; - postun) - echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script} - sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE27} >> ${script} - - echo "else" >> ${script} - sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE30} >> ${script} - echo "fi" >> ${script} - ;; - esac - echo "exit 0; fi" >> ${script} - case $when in - post) - if [ -z "${flavor}" ] ; then - cat >> ${script} <> ${script} <&1 | grep package >/dev/null ; then - PACKAGE_ARG="--package kernel-${flavor}" - fi - /sbin/new-kernel-pkg $PACKAGE_ARG --mkinitrd --depmod \ - --install %{KVERREL}${delim_flavor} -fi -EOF - ;; - postun) - ;; - pre) - cat >> ${script} </dev/null >/dev/null || : -exit 0 -EOF - ;; - preun) - cat >> ${script} < /dev/null > /dev/null || : -rm -f /lib/modules/%{KVERREL}${delim_flavor}/modules.* -if [ -x /sbin/new-kernel-pkg ] ; then - /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}${delim_flavor} -fi -EOF - ;; - esac - done - - cat > "kernel$flavor.files" < kernel-source.files </dev/null - -%if %{buildbigmem} -BuildKernel bigmem -%endif - -%if %{buildBOOT} -BuildKernel BOOT -%endif - -%if %{buildjensen} -BuildKernel jensen -%endif - -%if %{buildsmp} -BuildKernel smp -%endif - -%if %{buildbigsmp} -BuildKernel bigsmp -%endif - -%if %{buildpseries64} -BuildKernel pseries64 -%endif - -%if %{buildup} -BuildKernel -%endif - -%if %{buildbase} -# BuildLustre -%endif - -popd >/dev/null - -%install -pushd lustre >/dev/null -# it's already installed, so just clean up some things that are rpm -# specific -for i in $RPM_BUILD_ROOT/lib/modules/* ; do - rm -f $i/modules.* -%ifarch %{ntplarchs} - # remove legacy pcmcia symlink that's no longer useful - rm -rf $i/pcmcia -%endif -done - -# mark the vmlinux* non-executable to fool strip-to-file -chmod a-x $RPM_BUILD_ROOT/boot/vmlinux* - -BuildObj () -{ - flavor=$1 - if [ $flavor = "up" ] ; then - flavext="" - flavtgt="" - else - flavext="%{flavordelim}$flavor" - flavtgt="$flavor" - fi - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{kextraverdelim}%{kextraver}${flavext}/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile - c="$RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}" - o="${c}-obj/%{_target_cpu}/$flavor" - mkdir -p $o - # use the one we just built - #cp ../lustre/kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}${flavext}.config \ - cp .config $o/.config - for oc in oldconfig_nonint silentoldconfig oldconfig ; do - if grep -q "$oc" Makefile ; then - OLDCONFIG="$oc" - break - fi - done - MAKE="make -s O=$o -C ${c}" - if [ "$CC" ] ; then - MAKE_CC="CC=$CC" - fi - $MAKE "$MAKE_CC" $OLDCONFIG - $MAKE clean - rm -rf $o/.config.old $o/include/config - # Replace the Makefile in the object directory with a version - # that has relative path names. This is done by fixing the Makefile - # after the fact to work with 2.6.17 and newer mkmakefile. - read VERSION PATCHLEVEL SUBLEVEL <<-EOF -$(set -- 2.6.5 ; echo ${*//./ }) -EOF - rm -f $o/Makefile - ARCH=%{_target_cpu} /bin/bash scripts/mkmakefile ../../../linux-%{KVERREL} $o \ - $VERSION $PATCHLEVEL > $o/Makefile.in - if [ -f $o/Makefile ] ; then - # will exist only for 2.6.17 and newer because mkmakefile - # now writes the makefile to $o instead of stdout - mv -f $o/Makefile $o/Makefile.in - fi - sed -e "s^$o^../linux-%{KVERREL}-obj/%{_target_cpu}/$flavor^" \ - $o/Makefile.in > $o/Makefile - zcat "$RPM_BUILD_ROOT/boot/symvers-%{KVERREL}-%{_target_cpu}${flavext}.gz" \ - > $o/Module.symvers -} - -## -## do -source package cleanup/install -## -if [ "%{buildbase}" -ne 0 ] ; then - pushd linux >/dev/null - mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - rm -f drivers/net/hamradio/soundmodem/gentbl scripts/mkdep - tar cf - . | tar xf - -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - ln -sf linux-%{KVERREL} $RPM_BUILD_ROOT/usr/src/linux - # install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - - #clean up the destination - make -s mrproper -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs - mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs - cp ../lustre/kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@*.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs - if [ "%{linux26}" -ne 0 ] ; then - # this only works because Sun only builds one kernel per target/arch per kernel-source rpm - objdir=$RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}-obj - mkdir -p $objdir - if [ "%{buildbigmem}" -ne 0 ] ; then - BuildObj bigmem - fi - if [ "%{buildBOOT}" -ne 0 ] ; then - BuildObj BOOT - fi - if [ "%{buildjensen}" -ne 0 ] ; then - BuildObj jensen - fi - if [ "%{buildsmp}" -ne 0 ] ; then - BuildObj smp - fi - if [ "%{buildbigsmp}" -ne 0 ] ; then - BuildObj bigsmp - fi - if [ "%{buildpseries64}" -ne 0 ] ; then - BuildObj pseries64 - fi - if [ "%{buildup}" -ne 0 ] ; then - BuildObj up - fi - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{kextraverdelim}%{kextraver}%{flavordelim}custom/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile - # Remove $RPM_BUILD_ROOT prefix from symlinks. - for link in $(find $objdir -type l); do - target=$(readlink $link) - rm -f $link - ln -s ${target/$RPM_BUILD_ROOT/} $link - done - else # 2.4 rh-style - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{kextraverdelim}%{kextraver}%{flavordelim}custom/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile - # get the one from the build we just completed as it might have picked - # up new options - #cp ../lustre/kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/.config - cp .config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/.config - for oc in oldconfig_nonint silentoldconfig oldconfig ; do - if grep -q "$oc" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile ; then - OLDCONFIG="$oc" - break - fi - done - if [ "$CC" ] ; then - MAKE_CC="CC=$CC" - fi - make "$MAKE_CC" -s $OLDCONFIG -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - make "$MAKE_CC" -s symlinks -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - make "$MAKE_CC" -s include/linux/version.h -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - - #this generates modversions info which we want to include and we may as - #well include the depends stuff as well, after we fix the paths - make -s depend -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} - find $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} -name ".*depend" | \ - while read file ; do - mv $file $file.old - sed -e "s|[^ ]*\(/usr/src/linux\)|\1|g" < $file.old > $file - rm -f $file.old - done - - # Try to put some smarter autoconf.h and version.h files in place - pushd $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/include/linux ; { - rm -rf modules modversions.h autoconf.h version.h - cat > modversions.h < -#include -EOF - echo '#include ' > autoconf.h - list=`find ../../savedheaders/* -name '*.ver' -exec basename '{}' \; | sort` - mkdir modules - for l in $list; do - sed 's,$,modules/'$l, ../../savedheaders/list | awk -f %{SOURCE17} > modules/$l - touch -r modules/$l modules/`basename $l .ver`.stamp - echo '#include ' >> modversions.h - done - echo '#endif' >> modversions.h - sed 's,$,autoconf.h,' ../../savedheaders/list | awk -f %{SOURCE16} >> autoconf.h - install -m 644 %{SOURCE15} rhconfig.h - echo "#include " >> version.h - keyword=if - for i in smp BOOT BOOTsmp bigmem bigsmp pseries64 up ; do - # When we build in an i386, we don't have an bigmem header directory - # in savedheaders/i386/bigmem. We also don't have a BOOT directory - # anywhere except in savedheaders/i386. So, we need to use this method - # of determining if a kernel version string needs to be included in the - # version.h file - verh=`echo ../../savedheaders/*/$i/version.h | awk ' { print $1 } '` - if [ -n "$verh" -a -f "$verh" ]; then - if [ "$i" = up ]; then - if [ "$keyword" = if ]; then - echo "#if 0" >> version.h - fi - echo "#else" >> version.h - else - echo "#$keyword defined(__module__$i)" >> version.h - keyword=elif - fi - grep UTS_RELEASE $verh >> version.h - fi - done - echo "#endif" >> version.h - if [ -f ../../savedheaders/%{_target_cpu}/up/version.h ] ; then - # keep to a standard normally - HEADER_FILE=../../savedheaders/%{_target_cpu}/up/version.h - else - # test build not including uniprocessor, must get info from somewhere - HEADER_FILE=$(ls ../../savedheaders/*/*/version.h | head -n 1) - fi - grep -v UTS_RELEASE $HEADER_FILE >> version.h - rm -rf ../../savedheaders - } ; popd - touch $RPM_BUILD_ROOT/boot/kernel.h-%{kversion} - - # rm -f $RPM_BUILD_ROOT/usr/include/linux - - rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/savedheaders - - if [ "%{rhbuild}" -ne 0 ] ; then - # fix up the tmp_include_depends file wrt the buildroot - perl -p -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/tmp_include_depends - fi - fi # linux26 - popd >/dev/null -fi # buildbase - -popd >/dev/null - -%clean -rm -rf $RPM_BUILD_ROOT - -### -### scripts -### - -# do this for upgrades...in case the old modules get removed we have -# loopback in the kernel so that mkinitrd will work. -%pre -f pre.sh - -%pre smp -f presmp.sh - -%pre bigsmp -f prebigsmp.sh - -%pre pseries64 -f prepseries64.sh - -%pre bigmem -f prebigmem.sh - -%post -f post.sh - -%post pseries64 -f postpseries64.sh - -%post smp -f postsmp.sh - -%post bigsmp -f postbigsmp.sh - -%post bigmem -f postbigmem.sh - -%post jensen -f postjensen.sh - -%ifnarch ia64 -%post BOOT -f postBOOT.sh - -%endif - -%post -n lustre-lite-utils -if [ -f /etc/init.d/lustre ] ; then - /sbin/chkconfig --add lustre - /sbin/chkconfig --add lustrefs -fi - -# Allow clean removal of modules directory -%preun -f preun.sh - -%preun pseries64 -f preunpseries64.sh - -%preun smp -f preunsmp.sh - -%preun bigsmp -f preunbigsmp.sh - -%preun bigmem -f preunbigmem.sh - -%preun BOOT -f preunBOOT.sh - -%preun jensen -f preunjensen.sh - -# suse needs these i guess -%postun -f postun.sh - -%postun pseries64 -f postunpseries64.sh - -%postun smp -f postunsmp.sh - -%postun bigsmp -f postunbigsmp.sh - -%postun bigmem -f postunbigmem.sh - -%postun BOOT -f postunBOOT.sh - -%postun jensen -f postunjensen.sh - -# We need this here because we don't prereq kudzu; it could be -# installed after the kernel -%triggerin -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - -%triggerin smp -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - -%triggerin bigsmp -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - -%triggerin pseries64 -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - -%triggerin bigmem -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - -%triggerin BOOT -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - -%triggerin jensen -- kudzu -[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || : - - -# Old kernel-headers packages owned include symlinks; new -# ones just make them so that we can have multiple kernel-headers -# packages installed. - -%triggerpostun source -- kernel-headers < 2.2.16 -cd /usr/src -rm -f %{kslnk} -ln -snf linux-%{KVERREL} %{kslnk} -exit 0 - -%post source -cd /usr/src -rm -f %{kslnk} -ln -snf linux-%{KVERREL} %{kslnk} - -%postun source -if [ -L /usr/src/%{kslnk} ]; then - if [ -L /usr/src/%{kslnk} -a `ls -ld /usr/src/%{kslnk} 2>/dev/null| awk '{ print $11 }'` = "linux-%{KVERREL}" ]; then - [ $1 = 0 ] && rm -f /usr/src/%{kslnk} - fi -fi -exit 0 - -%preun -n lustre-lite-utils -if [ $1 = 0 -a -f /etc/init.d/lustre ]; then - /sbin/chkconfig --del lustre - /sbin/chkconfig --del lustrefs -fi - -### -### file lists -### - -%if %{buildup} -%files -f kernel.files -%endif - -%if %{buildsmp} -%files smp -f kernelsmp.files -%endif - -%if %{buildbigsmp} -%files bigsmp -f kernelbigsmp.files -%endif - -%if %{buildpseries64} -%files pseries64 -f kernelpseries64.files -%endif - -%if %{buildbigmem} -%files bigmem -f kernelbigmem.files -%endif - -%if %{buildBOOT} -%files BOOT -f kernelBOOT.files -%endif - -%if %{buildbase} -%files source -f kernel-source.files -%endif diff --git a/build/sles8-post.sh b/build/sles8-post.sh deleted file mode 100644 index d8a2e6b..0000000 --- a/build/sles8-post.sh +++ /dev/null @@ -1,49 +0,0 @@ -# Replace fake symlinks with the real ones -relink vmlinuz-%ver_str /boot/vmlinuz -relink initrd-%ver_str /boot/initrd - -if [ -e /etc/sysconfig/kernel ]; then - update_rcfile_setting /etc/sysconfig/kernel INITRD_MODULES 2>&1 -elif [ -e /etc/rc.config ]; then - update_rcfile_setting /etc/rc.config INITRD_MODULES 2>&1 -fi - -# If any trigger scripts have created additional modules, we need to -# run depmod. -run_depmod= -if [ -x /sbin/depmod ]; then - for module in $(find /lib/modules/%ver_str \ - /lib/modules/%{version}-override-%{cfg_name} \ - -type f) ; do - if [ $module -nt /lib/modules/%ver_str/modules.dep ]; then - run_depmod=1 - break - fi - done -fi -if [ -n "$run_depmod" ]; then - depmod -ae %ver_str -fi - -if [ -f /etc/fstab -a -x /sbin/mkinitrd ]; then - cd /boot && \ - /sbin/mkinitrd -k "vmlinuz-%ver_str" -i "initrd-%ver_str" -elif [ -f /etc/fstab -a -x /sbin/mk_initrd ]; then - cd /boot && \ - /sbin/mk_initrd -k "vmlinuz-%ver_str" -i "initrd-%ver_str" -else - echo "please run mkinitrd as soon as your system is complete" -fi - -# Only call new-kernel-pkg during package updates: Otherwise we might -# call this during an initial installation, with a half-initialized -# boot loader. ($1 = number of instances of this package currently -# installed.) -if [ "$1" -gt 1 ]; then - # Notify boot loader that a new kernel image has been installed. - if [ -x /sbin/new-kernel-pkg ]; then - /sbin/new-kernel-pkg %ver_str - elif [ -e /etc/lilo.conf -a -x /sbin/lilo ]; then - /sbin/lilo - fi -fi diff --git a/build/sles8-postun.sh b/build/sles8-postun.sh deleted file mode 100644 index fe1ded5..0000000 --- a/build/sles8-postun.sh +++ /dev/null @@ -1,22 +0,0 @@ -rm -f /boot/initrd-%ver_str # created in %post -- clean up. - -if [ "$(readlink /boot/vmlinuz)" = "vmlinuz-%ver_str" -o \ - "$(readlink /boot/initrd)" = "initrd-%ver_str" ]; then - # This may be the last kernel RPM on the system, or it may - # be an update. In both of those cases the symlinks will - # eventually be correct. On the other hand, if this kernel - # is removed and other kernel rpms remain installed, - # find the most recent of the remaining kernels, and make - # the symlinks point to it. This makes sure that the boot - # manager will always have a kernel to boot in its default - # configuration. - for vmlinuz in $(cd /boot ; ls -dt vmlinuz-*); do - version="${vmlinuz#vmlinuz-}" - initrd="initrd-$version" - if [ -f "/boot/$vmlinuz" -a -f "/boot/$initrd" ]; then - relink "$vmlinuz" /boot/vmlinuz - relink "$initrd" /boot/initrd - break - fi - done -fi diff --git a/build/sles8-pre.sh b/build/sles8-pre.sh deleted file mode 100644 index a542caf..0000000 --- a/build/sles8-pre.sh +++ /dev/null @@ -1,2 +0,0 @@ -rm -f /boot/vmlinuz.suse -rm -f /boot/initrd.suse diff --git a/build/sles8-update_INITRD_MODULES.sh b/build/sles8-update_INITRD_MODULES.sh deleted file mode 100644 index 38d5e3d..0000000 --- a/build/sles8-update_INITRD_MODULES.sh +++ /dev/null @@ -1,56 +0,0 @@ -# Check if $1 is equal to any argument in $1 .. $*. -# -contains() { - local x=$1 - shift - - case " $@ " in - *" $x "*) return 0 ;; - *) return 1 ;; - esac -} - -# Check the old value of INITRD_MODULES: -# - Remove modules that no longer exist. -# - Add modules that were built into the kernel before. -# -update_INITRD_MODULES() { - # MD_MODS is the list of modules that require md.o. - local MD_MODS="linear multipath raid0 raid1 raid5" - - # NON_SCSI is a whitelist of modules that are no scsi drivers. Any - # module not listed here is assumed to be a scsi driver, and the - # low-level scsi modules are added to INITRD_MODULES. - local NON_SCSI="jbd ext3 jfs xfs reiserfs $MD_MODS md" - - local result maybe_scsi need_md have_md have_scsi have_sd m - for m in "$@" ; do - m="${m%.o}" ; m="${m%.ko}" - - contains "$m" $NON_SCSI || maybe_scsi=1 - contains "$m" $MD_MODS && need_md=1 - [ "$m" == md ] && have_md=1 - if contains "$m" scsi_mod sd_mod ; then - eval have_${m%_mod}=1 - continue - fi - if contains "$m" xfs_dmapi xfs_support ; then - echo "Module $m no longer exists, and was removed from" \ - "INITRD_MODULES." >&2 - continue - fi - - result[${#result[@]}]="$m" - done - if [ -n "$maybe_scsi" -o -n "$have_scsi" -o -n "$have_sd" ]; then - [ -z "$have_scsi" -o -z "$have_sd" ] \ - && echo "Adding SCSI disk modules to INITRD_MODULES" >&2 - result=(scsi_mod sd_mod ${result[@]}) - fi - if [ -n "$need_md" -a -z "$have_md" ]; then - echo "Adding RAID support module to INITRD_MODULES" >&2 - result=(md ${result[@]}) - fi - - echo ${result[@]} -} diff --git a/build/sles8-update_rcfile_setting.sh b/build/sles8-update_rcfile_setting.sh deleted file mode 100644 index 6165cc7..0000000 --- a/build/sles8-update_rcfile_setting.sh +++ /dev/null @@ -1,35 +0,0 @@ -# Update the variable $var in $rcfile: The function update_$VAR must -# exist. It is called with the old value of $var, and must return the -# new value. -# -update_rcfile_setting() { - local rcfile=$1 var=$2 - - # The characters $, `, ", and \ have special meaning inside double - # quoted shell variables. The characters " and \ have special meaning - # inside awk double-quoted variables. - - local old=$(source "$rcfile" ; - eval echo \$$var \ - | sed -e 's/\([$`"\\]\)/\\\1/g') - local new=$(eval update_$var "$old" \ - | sed -e 's/\([$`"\\]\)/\\\1/g' \ - -e 's/\(["\\]\)/\\\1/g') - local tmp=$(mktemp /tmp/${rcfile##/*}.XXXXXX) - - # This script breaks for multi-line varables -- I don't think - # we need to handle this special case. - awk ' - function replace() { - if (!done) - print "'"$var"'=\"'"$new"'\"" - done=1 - } - - /^'"$var"'=/ { replace() ; next } - { print } - ' < $rcfile > $tmp && - cat $tmp > $rcfile - - rm -f $tmp -} diff --git a/build/suse-functions.sh b/build/suse-functions.sh deleted file mode 100644 index a7e421d..0000000 --- a/build/suse-functions.sh +++ /dev/null @@ -1,22 +0,0 @@ -# Readlink is not present on some older distributions: emulate it. -readlink() { - local path=$1 ll - - if [ -L "$path" ]; then - ll="$(LC_ALL=C ls -l "$path" 2> /dev/null)" && - echo "${ll/* -> }" - else - return 1 - fi -} -relink() { - if [ -h "$2" ]; then - local old=$(readlink "$2") - [ "$old" = "$1" ] && return 0 - echo "Changing symlink $2 from $old to $1" - elif [ -e "$2" ]; then - echo "Replacing file $2 with symlink to $1" - fi - rm -f "$2" \ - && ln -s "$1" "$2" -} diff --git a/build/suse-post.sh b/build/suse-post.sh deleted file mode 100644 index 7efe83d..0000000 --- a/build/suse-post.sh +++ /dev/null @@ -1,82 +0,0 @@ -if [ -f /boot/vmlinuz-%ver_str ]; then - image=vmlinuz -elif [ -f /boot/image-%ver_str ]; then - image=image -elif [ -f /boot/vmlinux-%ver_str ]; then - image=vmlinux -else - # nothing to do (UML kernels for example). - exit 0 -fi - -case %ver_str in - (*xen*|*um*) - NOBOOTSPLASH="-s off" - SHORTNM=%ver_str - SHORTNM=-${SHORTNM##*-} - ;; - (*) - unset NOBOOTSPLASH - unset SHORTNM - ;; -esac - -# If we have old symlinks, rename them to *.previous -if [ -L /boot/$image$SHORTNM -a \ - "$(readlink /boot/$image$SHORTNM)" != $image-%ver_str ]; then - mv /boot/$image$SHORTNM /boot/$image$SHORTNM.previous -fi -relink $image-%ver_str /boot/$image$SHORTNM - -if test "$YAST_IS_RUNNING" != instsys ; then - if [ -f /etc/fstab ]; then - echo Setting up /lib/modules/%ver_str - if [ -x /sbin/update-modules.dep ]; then - /sbin/update-modules.dep -v %ver_str - else - /sbin/depmod -a -F /boot/System.map-%ver_str %ver_str - fi - cd /boot - /sbin/mkinitrd -k $image-%ver_str -i initrd-%ver_str $NOBOOTSPLASH - - if [ -L /boot/initrd$SHORTNM -a \ - "$(readlink /boot/initrd)" != initrd-%ver_str ]; then - mv /boot/initrd$SHORTNM /boot/initrd$SHORTNM.previous - fi - if [ -e /boot/initrd-%ver_str ]; then - relink initrd-%ver_str /boot/initrd$SHORTNM - else - rm -f /boot/initrd$SHORTNM - fi - else - echo "please run mkinitrd as soon as your system is complete" - fi -fi - -if [ "$YAST_IS_RUNNING" != instsys ]; then - # Notify boot loader that a new kernel image has been installed. - # (during initial installation the boot loader configuration does not - # yet exist when the kernel is installed, but yast kicks the boot - # loader itself later.) - if [ -x /sbin/new-kernel-pkg ]; then - /sbin/new-kernel-pkg %ver_str - elif [ -x /usr/lib/bootloader/bootloader_entry ]; then - # handle 10.2 and SLES10 SP1 - /usr/lib/bootloader/bootloader_entry \ - add \ - %flavor \ - %ver_str \ - vmlinuz-%ver_str \ - initrd-%ver_str - elif [ -x /sbin/update-bootloader ]; then - # handle 10.1 and SLES10 GA - /sbin/update-bootloader \ - --add \ - --image /boot/vmlinuz-%ver_str \ - --initrd /boot/initrd-%ver_str - /sbin/update-bootloader --refresh - else - echo "You may need to setup and install the boot loader using the" - echo "available bootloader for your platform (e.g. grub, lilo, zipl, ...)." - fi -fi diff --git a/build/suse-postun.sh b/build/suse-postun.sh deleted file mode 100644 index ac9f30c..0000000 --- a/build/suse-postun.sh +++ /dev/null @@ -1,77 +0,0 @@ -if [ -L /boot/vmlinux ]; then - image=vmlinux -elif [ -L /boot/vmlinuz ]; then - image=vmlinuz -elif [ -L /boot/image ]; then - image=image -else - # nothing to do (UML kernels for example). - exit 0 -fi - -case %ver_str in - (*xen*|*um*) - SHORTNM=%ver_str - SHORTNM=-${SHORTNM##*-} - ;; - (*) - unset SHORTNM - ;; -esac - -if [ "$(readlink /boot/$image$SHORTNM)" = $image-%ver_str ]; then - # This may be the last kernel RPM on the system, or it may - # be an update. In both of those cases the symlinks will - # eventually be correct. Only if this kernel - # is removed and other kernel rpms remain installed, - # find the most recent of the remaining kernels, and make - # the symlinks point to it. This makes sure that the boot - # manager will always have a kernel to boot in its default - # configuration. - shopt -s nullglob - for img in $(cd /boot ; ls -dt $image-*$SHORTNM); do - initrd=initrd-${img#*-} - if [ -f /boot/$img -a -f /boot/$initrd ]; then - relink $img /boot/${img%%%%-*}$SHORTNM - relink $initrd /boot/${initrd%%%%-*}$SHORTNM - - # Notify the boot loader that a new kernel image is active. - if [ -x /sbin/new-kernel-pkg ]; then - /sbin/new-kernel-pkg $(/sbin/get_kernel_version /boot/$img) - fi - break - fi - done - shopt -u nullglob -fi - -# remove the bootloader entry for the kernel being removed -if [ -x /usr/lib/bootloader/bootloader_entry ]; then - # handle 10.2 and SLES10 SP1 - /usr/lib/bootloader/bootloader_entry \ - remove \ - smp \ - %ver_str \ - vmlinuz-%ver_str \ - initrd-%ver_str -elif [ -x /sbin/update-bootloader ]; then - # handle 10.1 and SLES10 GA - /sbin/update-bootloader --image /boot/vmlinuz-%ver_str \ - --initrd /boot/initrd-%ver_str \ - --remove --force - /sbin/update-bootloader --refresh -fi - -# Check whether there is a .previous link to the image we're about -# to remove or to the image we point the new symlink to (so .previous -# would be identical to the current symlink) -case "$(readlink /boot/$image$SHORTNM.previous)" in -$image-%ver_str|$(readlink /boot/$image$SHORTNM)) - rm -f /boot/$image$SHORTNM.previous ;; -esac -case "$(readlink /boot/initrd$SHORTNM.previous)" in -initrd-%ver_str|$(readlink /boot/initrd$SHORTNM)) - rm -f /boot/initrd$SHORTNM.previous ;; -esac -# created in %post -rm -f /boot/initrd-%ver_str diff --git a/build/suse-trigger-script.sh.in b/build/suse-trigger-script.sh.in deleted file mode 100644 index 0ead9e8..0000000 --- a/build/suse-trigger-script.sh.in +++ /dev/null @@ -1,9 +0,0 @@ -old_shopt=$(shopt -p nullglob || :) -shopt -s nullglob -for script in /lib/modules/scripts/* ; do - if [ -f "$script" -a -x "$script" ] \ - && ! "$script" --@when@ %ver_str $1 ; then - echo "$script failed." - fi -done -eval $old_shopt -- 1.8.3.1