2017-03-01 11:56:49 +01:00
|
|
|
#!/bin/sh
|
2016-09-16 22:47:02 +02:00
|
|
|
|
|
|
|
CLEAN_SRC=${CLEAN_SRC:-NO}
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
|
|
VERSION=${VERSION:-$(echo /usr/src/linux-* | sort | tail | cut -d- -f2)}
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
|
2016-10-09 13:33:13 +02:00
|
|
|
SOURCES=/usr/src
|
2016-09-16 22:47:02 +02:00
|
|
|
TAG=cyco
|
|
|
|
TMP=/tmp/$TAG
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
OUTPUT=/tmp
|
|
|
|
|
|
|
|
NUMJOBS=${NUMJOBS:-" -j4 "}
|
|
|
|
|
2017-01-29 21:57:58 +01:00
|
|
|
SRC_URL="https://cdn.kernel.org/pub/linux/kernel/v4.x"
|
2016-09-16 22:47:02 +02:00
|
|
|
|
|
|
|
rm -fr $PKG
|
|
|
|
if [ $CLEAN_SRC != "NO" ] ; then
|
|
|
|
rm -fr $SOURCES/linux-$VERSION
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $CLEAN_SRC != "NO" ]; then
|
2017-01-29 21:57:58 +01:00
|
|
|
[ ! -e $CWD/linux-$VERSION.tar.?z* ] && wget -c "$SRC_URL/linux-$VERSION.tar.xz" -O $CWD/linux-$VERSION.tar.xz
|
2016-09-16 22:47:02 +02:00
|
|
|
[ ! -e $SOURCES ] && mkdir -p $SOURCES
|
|
|
|
tar xf $CWD/linux-$VERSION.tar.?z* -C $SOURCES
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $SOURCES/linux-$VERSION
|
|
|
|
|
|
|
|
if [ $CLEAN_SRC != "NO" ] || [ ! -e .config ] ; then
|
|
|
|
if [ -e $CWD/config-$VERSION ] ; then
|
|
|
|
cp $CWD/config-$VERSION .config
|
|
|
|
else
|
|
|
|
if [ -e $CWD/config ]; then
|
|
|
|
cp $CWD/config .config
|
|
|
|
else
|
|
|
|
zcat /proc/config.gz > .config
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
make oldconfig $*
|
|
|
|
make $NUMJOBS
|
|
|
|
make modules_install INSTALL_MOD_PATH=$PKG
|
|
|
|
|
|
|
|
KERNEL_TAG=$(grep "CONFIG_LOCALVERSION=" .config | sed 's|CONFIG_LOCALVERSION=||' | tr -d \" )
|
|
|
|
KERNEL_VERSION=$(grep -o "[0-9]\+\.[0-9]\+.*[0-9]" .config)$KERNEL_TAG
|
|
|
|
|
|
|
|
mkdir -p $PKG/boot/
|
|
|
|
for i in .config System.map; do
|
|
|
|
cp $i $PKG/boot/${i}-$KERNEL_VERSION
|
|
|
|
done
|
|
|
|
mv $PKG/boot/{.,}config-$KERNEL_VERSION
|
|
|
|
cp arch/x86/boot/bzImage $PKG/boot/vmlinuz-$KERNEL_VERSION
|
|
|
|
( cd $PKG/boot/
|
|
|
|
ln -s vmlinuz-$KERNEL_VERSION vmlinuz-cycojesus
|
|
|
|
)
|
|
|
|
|
|
|
|
# mkdir -p $PKG/install
|
|
|
|
# cat <<EOF > $PKG/install/doinst.sh
|
|
|
|
# cp /etc/lilo.conf /etc/lilo.conf.orig
|
|
|
|
# grep -q "image = /boot/$KERNEL_VERSION/bzImage" /etc/lilo.conf || \
|
|
|
|
# cat <<EOLILO >> /etc/lilo.conf
|
|
|
|
# # Linux bootable partition config begins
|
|
|
|
# image = /boot/$KERNEL_VERSION/bzImage
|
|
|
|
# root = /dev/sda1
|
|
|
|
# label = $KERNEL_VERSION
|
|
|
|
# read-only
|
|
|
|
# # Linux bootable partition config ends
|
|
|
|
|
|
|
|
# EOLILO
|
|
|
|
|
|
|
|
# sed -i "s|default=.*|default=$KERNEL_VERSION|" /etc/lilo.conf
|
|
|
|
|
|
|
|
# lilo
|
|
|
|
# EOF
|
|
|
|
|
|
|
|
VERSION=$(echo $VERSION | tr - _)
|
|
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
|
|
$PRGNAM-$VERSION: $PRGNAM-$VERSION (kernel)
|
|
|
|
$PRGNAM-$VERSION:
|
|
|
|
$PRGNAM-$VERSION: Linux is a clone of the operating system Unix, written from scratch by
|
|
|
|
$PRGNAM-$VERSION: Linus Torvalds with assistance from a loosely-knit team of hackers
|
|
|
|
$PRGNAM-$VERSION: across the Net. It aims towards POSIX and Single UNIX Specification
|
|
|
|
$PRGNAM-$VERSION: compliance.
|
|
|
|
$PRGNAM-$VERSION:
|
|
|
|
$PRGNAM-$VERSION: It has all the features you would expect in a modern fully-fledged Unix
|
|
|
|
$PRGNAM-$VERSION:
|
|
|
|
$PRGNAM-$VERSION: http://www.kernel.org
|
|
|
|
$PRGNAM-$VERSION:
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cd $PKG
|
2018-04-20 23:02:35 +02:00
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
2016-09-16 22:47:02 +02:00
|
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_$(echo $KERNEL_TAG | tr - _)-$ARCH-$BUILD$TAG.txz
|