#!/bin/sh [ -z $PREPKG ] && exit 1 CONFIG=$1 FILES=$(cd $(dirname $0) ; pwd) if [ -z "$CONFIG" -o ! -r $FILES/config/$CONFIG ]; then echo "specify one of the following configs:" ls $FILES/config/ exit 1 fi VERSION=$(sed -n 's,^VERSION = ,,p' Makefile) PATCHLEVEL=$(sed -n 's,^PATCHLEVEL = ,,p' Makefile) SUBLEVEL=$(sed -n 's,^SUBLEVEL = ,,p' Makefile) EXTRAVERSION=$(sed -n 's,^EXTRAVERSION = ,,p' Makefile) KERNELRELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION echo "building $KERNELRELEASE for $CONFIG" mkdir -p $PREPKG/{install,boot}/ # http://distcc.samba.org/faq.html#linux2.2 [ "$PATCHLEVEL" = "2" ] && unset MAKEJOBS make mrproper &> make_mrproper.output || exit 1 cp $FILES/config/$CONFIG .config make oldconfig &> make_oldconfig.output || exit 1 make dep &> make_dep.output || exit 1 make $MAKEJOBS bzImage &> make_bzImage.output || exit 1 make $MAKEJOBS modules &> make_modules.output || exit 1 make INSTALL_MOD_PATH=$PREPKG modules_install \ &> make_modules-install.output || exit 1 # save oodles of disk space find $PREPKG/lib/modules/ -type f -name '*.o' -exec gzip -9 {} \; # clean up symlinks find $PREPKG/lib/modules/ -type l -name '*.o' -printf %h\\t%f\\t%l\\n \ | while { read LDIR LFIL RFIL ; } ; do ( cd $LDIR ; rm -rf $LFIL ) ( cd $LDIR ; ln -sf $RFIL.gz $LFIL.gz ) done # regenerate modules.* to take the above into account /sbin/depmod -ae -F System.map -b $PREPKG -r $KERNELRELEASE cp -p System.map $PREPKG/boot/System.map-$KERNELRELEASE ln -s System.map-$KERNELRELEASE $PREPKG/boot/System.map cp -p .config $PREPKG/boot/config-$KERNELRELEASE ln -s config-$KERNELRELEASE $PREPKG/boot/config cp -p arch/i386/boot/bzImage $PREPKG/boot/vmlinuz-$KERNELRELEASE ln -s vmlinuz-$KERNELRELEASE $PREPKG/boot/vmlinuz cat << EOF > $PREPKG/install/doinst.sh # A good idea whenever kernel modules are added or changed: if [ -x sbin/depmod ]; then chroot . /sbin/depmod -a $KERNELRELEASE 1> /dev/null 2> /dev/null fi EOF cp $FILES/slack-desc/$CONFIG $PREPKG/install/slack-desc