#!/bin/sh # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PKG=$TMP/package-kernel-modules rm -rf $PKG mkdir -p $PKG/install VERSION=2.6.17.13 ARCH=${ARCH:-s390x} PARCH=${ARCH} if [ "x$ARCH" == "xs390x" ]; then ARCH="s390" fi BUILD=${BUILD:-1} if [ ! -d $TMP ]; then mkdir -p $TMP # location to build the source fi cd $TMP rm -rf kernel-modules-${VERSION} mkdir -p kernel-modules-${VERSION}/usr/src cd kernel-modules-${VERSION}/usr/src tar -jxvf $CWD/../linux-${VERSION}.tar.bz2 chown -R root:root . find . -type f -perm 666 | xargs chmod 644 find . -type f -perm 777 | xargs chmod 755 ln -sf linux-${VERSION} linux cd linux-${VERSION} cp $CWD/../kernel-source/s390.default.config .config make oldconfig || exit 1 make -j3 modules || exit 1 make modules_install INSTALL_MOD_PATH=$PKG || exit 1 ( mkdir -p $PKG/etc/rc.d/ cd $PKG/etc/rc.d/ cp $CWD/rc.modules.new . cat $CWD/rc.modules.s390.diff | patch -p0 --verbose mv rc.modules.new rc.modules-${VERSION}.new ) ( cd $PKG/lib/modules/$VERSION rm -rf build ; ln -s /usr/src/linux-$VERSION build rm -rf source ; ln -s /usr/src/linux-$VERSION source find . -type f -name "*.ko" | xargs gzip -9 ) depmod -a -b $PKG $VERSION cd $PKG cat $CWD/slack-desc > install/slack-desc # Write out the doinst.sh: cat << EOF > install/doinst.sh config() { NEW="\$1" OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... } config etc/rc.d/rc.modules-${VERSION}.new # If rc.modules is a real file, back it up: if [ -r etc/rc.d/rc.modules -a ! -L etc/rc.d/rc.modules ]; then cp -a etc/rc.d/rc.modules etc/rc.d/rc.modules.bak fi # Make rc.modules a symlink if it's not already, but do not replace # an existing symlink. You'll have to decide to point at a new version # of this script on your own... if [ ! -L etc/rc.d/rc.modules ]; then ( cd etc/rc.d ; rm -rf rc.modules ) ( cd etc/rc.d ; ln -sf rc.modules-${VERSION} rc.modules ) fi # A good idea whenever kernel modules are added or changed: if [ -x sbin/depmod ]; then chroot . /sbin/depmod -a ${VERSION} 1> /dev/null 2> /dev/null fi EOF makepkg -l y -c y ../kernel-modules-${VERSION}-${PARCH}-${BUILD}.tgz