2017-03-01 11:56:49 +01:00
|
|
|
#!/bin/sh
|
2016-09-16 22:47:02 +02:00
|
|
|
|
2020-06-08 11:36:26 +02:00
|
|
|
set -e
|
|
|
|
|
2016-09-16 22:47:02 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
|
2020-08-10 18:38:18 +02:00
|
|
|
PRGNAM=$(basename $CWD)-$(hostname -s)
|
2016-09-16 22:47:02 +02:00
|
|
|
BUILD=${BUILD:-1}
|
2020-08-19 10:35:39 +02:00
|
|
|
BRANCH=${BRANCH:-stable} # stable ; mainline
|
2016-09-16 22:47:02 +02:00
|
|
|
ARCH=$(uname -m)
|
|
|
|
|
2020-06-25 11:23:11 +02:00
|
|
|
TAG=gwh
|
2016-09-16 22:47:02 +02:00
|
|
|
TMP=/tmp/$TAG
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
OUTPUT=/tmp
|
|
|
|
|
|
|
|
NUMJOBS=${NUMJOBS:-" -j4 "}
|
|
|
|
|
2020-06-09 10:29:47 +02:00
|
|
|
GIT=${GIT:-"NO"}
|
2016-09-16 22:47:02 +02:00
|
|
|
|
|
|
|
rm -fr $PKG
|
|
|
|
|
2020-06-09 10:29:47 +02:00
|
|
|
if [ $GIT == "YES" ]; then
|
|
|
|
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/repositories/$PRGNAM}
|
|
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/torvalds/linux.git $REPOSITORY
|
|
|
|
|
|
|
|
cd $REPOSITORY
|
|
|
|
git pull
|
|
|
|
VERSION="$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
|
|
|
else
|
2020-08-19 10:35:39 +02:00
|
|
|
VERSION=${VERSION:-$(curl https://www.kernel.org/feeds/kdist.xml | grep -o "[0-9.rc-]*: $BRANCH" | head -n1 | cut -d: -f1)}
|
2020-06-09 10:29:47 +02:00
|
|
|
|
2020-08-19 15:12:14 +02:00
|
|
|
if [ $BRANCH == "stable" ]; then
|
|
|
|
SRC_URL="https://cdn.kernel.org/pub/linux/kernel/v$(echo $VERSION | cut -d. -f1).x"
|
|
|
|
else
|
|
|
|
SRC_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot"
|
|
|
|
fi
|
|
|
|
[ ! -e $CWD/linux-$VERSION.tar.?z* ] && wget -c "$SRC_URL/linux-$VERSION.tar.gz" -O $CWD/linux-$VERSION.tar.gz
|
2020-06-09 10:29:47 +02:00
|
|
|
mkdir -p $PKG/usr/src/
|
2020-08-19 15:12:14 +02:00
|
|
|
tar xf $CWD/linux-$VERSION.tar.gz -C $PKG/usr/src/
|
2016-09-16 22:47:02 +02:00
|
|
|
|
2020-06-09 10:29:47 +02:00
|
|
|
cd $PKG/usr/src/linux-$VERSION
|
|
|
|
fi
|
2016-09-16 22:47:02 +02:00
|
|
|
|
2020-06-09 10:29:47 +02:00
|
|
|
if [ -e $CWD/config-$VERSION ] ; then
|
|
|
|
cp $CWD/config-$VERSION .config
|
|
|
|
else
|
|
|
|
if [ -e $CWD/config ]; then
|
|
|
|
cp $CWD/config .config
|
2016-09-16 22:47:02 +02:00
|
|
|
else
|
2020-06-09 10:29:47 +02:00
|
|
|
zcat /proc/config.gz > .config
|
2016-09-16 22:47:02 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
make oldconfig $*
|
2020-06-09 10:29:47 +02:00
|
|
|
|
2020-06-09 10:31:53 +02:00
|
|
|
# [ ! -e $CWD/config-$VERSION ] && cp .config $CWD/config-$VERSION
|
2020-06-09 10:29:47 +02:00
|
|
|
|
2016-09-16 22:47:02 +02:00
|
|
|
make $NUMJOBS
|
|
|
|
make modules_install INSTALL_MOD_PATH=$PKG
|
|
|
|
|
2020-08-10 21:42:27 +02:00
|
|
|
VERSION=$(basename $(ls $PKG/lib/modules/ | head -n1))
|
|
|
|
|
2016-09-16 22:47:02 +02:00
|
|
|
mkdir -p $PKG/boot/
|
2020-06-08 11:36:26 +02:00
|
|
|
cp System.map $PKG/boot/System.map-gwh-$VERSION
|
|
|
|
cp .config $PKG/boot/config-gwh-$VERSION
|
|
|
|
cp arch/${ARCH}/boot/bzImage $PKG/boot/vmlinuz-gwh-$VERSION
|
2016-09-16 22:47:02 +02:00
|
|
|
( cd $PKG/boot/
|
2020-06-08 11:36:26 +02:00
|
|
|
ln -s vmlinuz-gwh-$VERSION vmlinuz-gwh
|
2016-09-16 22:47:02 +02:00
|
|
|
)
|
|
|
|
|
2020-06-09 10:29:47 +02:00
|
|
|
make clean
|
|
|
|
|
2020-06-08 11:36:26 +02:00
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat <<EOF > $PKG/install/doinst.sh
|
|
|
|
cp /boot/elilo-x86_64.efi /boot/efi/EFI/Slackware/elilo.efi
|
|
|
|
cp /boot/vmlinuz-gwh-$VERSION /boot/efi/EFI/Slackware/vmlinuz-gwh
|
|
|
|
cp /boot/intel-ucode.cpio /boot/efi/EFI/Slackware/
|
2020-08-10 21:42:27 +02:00
|
|
|
|
2020-06-11 11:22:59 +02:00
|
|
|
eval \$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -a '-P /boot/intel-ucode.cpio' -k $VERSION -r -m crc32-pclmul:crc32c-intel:crc32_generic\$(lspci | grep -iq radeon && echo ':amdgpu:radeon'))
|
2020-06-08 11:36:26 +02:00
|
|
|
cp /boot/initrd.gz /boot/efi/EFI/Slackware/initrd-gwh.gz
|
|
|
|
EOF
|
2016-09-16 22:47:02 +02:00
|
|
|
|
|
|
|
VERSION=$(echo $VERSION | tr - _)
|
|
|
|
cat <<EOF > $PKG/install/slack-desc
|
2020-08-10 21:42:27 +02:00
|
|
|
$PRGNAM: $PRGNAM (kernel)
|
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM: Linux is a clone of the operating system Unix, written from scratch by
|
|
|
|
$PRGNAM: Linus Torvalds with assistance from a loosely-knit team of hackers
|
|
|
|
$PRGNAM: across the Net. It aims towards POSIX and Single UNIX Specification
|
|
|
|
$PRGNAM: compliance.
|
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM: It has all the features you would expect in a modern fully-fledged Unix
|
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM: http://www.kernel.org
|
|
|
|
$PRGNAM:
|
2016-09-16 22:47:02 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cd $PKG
|
2018-04-20 23:02:35 +02:00
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
2020-07-12 09:22:26 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}-$ARCH-$BUILD$TAG.txz
|