CWD=$(pwd) TMP=${TMP:-/tmp/sources} OUT=${OUT:-/tmp/packages} KVERSION=${KVERSION:-2.6.34.7} EXTRA_VER=${EXTRA_VER:=-gen} ARCH=${ARCH:-i486} BUILD=${BUILD:-1} BLD=${TMP}/kernel-build PKG=${BLD}/package rm -rf $BLD mkdir -p $PKG $OUT echo echo "Searching kernel images..." echo for IMAGE in $CWD/{bzImage,vmlinuz*} /boot/vmlinuz* \ /usr/src/linux-${KVERSION}/arch/i386/boot/bzImage ; do [[ -r $IMAGE ]] && echo $IMAGE >> $BLD/images.txt done select IMAGE in $(cat $BLD/images.txt 2> /dev/null); do KERNEL=$IMAGE break done for SYSMAP in $CWD/System.map* /boot/System.map* \ /usr/src/linux-${KVERSION}/System.map ; do [[ -r $SYSMAP ]] && echo $SYSMAP >> $BLD/sysmaps.txt done select SYSMAP in $(cat $BLD/sysmaps.txt 2> /dev/null); do SYSMAP=$SYSMAP break done for CONFIG in $CWD/{config*,.config} /boot/config* \ /usr/src/linux-${KVERSION}/.config ; do [[ -r $CONFIG ]] && echo $CONFIG >> $BLD/configs.txt done select CONFIG in $(cat $BLD/configs.txt 2> /dev/null); do CONFIG=$CONFIG break done cat << EOF Images to save (before continuing, make sure any field is not empty): KERNEL = $KERNEL SYSMAP = $SYSMAP CONFIG = $CONFIG EOF read -ep "Press ENTER to continue or Hit Control-C to cancel. " mkdir -p ${PKG}/boot cat $KERNEL > ${PKG}/boot/vmlinuz-${KVERSION}$EXTRA_VER cat $SYSMAP > ${PKG}/boot/System.map-${KVERSION}$EXTRA_VER cat $CONFIG > ${PKG}/boot/config-${KVERSION}$EXTRA_VER ( cd ${PKG}/boot ln -sf vmlinuz-${KVERSION}$EXTRA_VER vmlinuz ln -sf System.map-${KVERSION}$EXTRA_VER System.map ln -sf config-${KVERSION}$EXTRA_VER config ) mkdir -p ${PKG}/description cp ${CWD}/descriptions/kernel-generic/* ${PKG}/description/ cd $PKG makepkg -l \ ${OUT}/kernel-${KVERSION}$(echo $EXTRA_VER | tr - _)-$ARCH-$BUILD.tlz # Delete temporary directories: if [[ $1 = -c || $1 = --clean ]]; then rm -rf $BLD fi