#!/bin/sh # Copyright 2016 - 2024 Dimitris Tzemos # All rights reserved. # # Permission to use, copy, modify, and distribute this software for # any purpose with or without fee is hereby granted, provided that # the above copyright notice and this permission notice appear in all # copies. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # ----------------------------------------------------------------------------- PRGNAM=linux PRGNAMM=kernel-source VERSION=${VERSION:-5.15.63} BUILD=${BUILD:-1} TAG=${TAG:-dj} ARCH=noarch NUMJOBS=${NUMJOBS:-" -j4 "} # Where do we look for sources? SRCDIR=$(cd $(dirname $0); pwd) CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/pkg-$PRGNAM # If you want automatic download to work, supply a URL for 'SRCURL' below: SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.xz" SRCURL="https://www.kernel.org/pub/linux/kernel/v4.x/linux-${VERSION}.tar.xz" if [ ! -r $SOURCE ]; then wget $SRCURL fi rm -rf $PKG mkdir -p $TMP $PKG cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* || exit 1 cd $PRGNAM-$VERSION || exit 1 ( ARCH_BAK=$ARCH unset ARCH make mrproper || exit 1 zcat /proc/config.gz > .config || exit 1 make oldconfig scripts prepare clean || exit 1 ARCH=$ARCH_BAK ) mkdir -p $PKG/usr/src/linux-$VERSION/ echo "Please wait .... kernel source package is build" cp -r * $PKG/usr/src/linux-$VERSION/ || exit 1 cd $PKG/usr/src/ ln -sf linux-$VERSION linux # Add a package description and the post-install script if it exists: mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc [ -f $CWD/doinst.sh ] && cat $CWD/doinst.sh > $PKG/install/doinst.sh # Build package: cd $PKG /sbin/makepkg -l y -c n $CWD/$PRGNAMM-$VERSION-$ARCH-$BUILD$TAG.txz md5sum $CWD/$PRGNAMM-$VERSION-$ARCH-$BUILD$TAG.txz > $CWD/$PRGNAMM-$VERSION-$ARCH-$BUILD$TAG.md5 rm -rf $PKG $TMP/$PRGNAM-$VERSION