My configuration and packages for Slackware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.0 KiB

#!/bin/sh
set -e
PKGNAM=${PKGNAM:-linux}
BASEVER=${BASEVER:-4.4.29}
VERSION=${VERSION:-4.4.29}
ARCH=${ARCH:-x86_64}
KARCH=${KARCH:-x86}
BUILD=${BUILD:-1_slack14.2}
CWD=$(pwd)
TMP=${TMP:-/tmp/kernel}
PKG=$TMP/package
NUMJOBS=${NUMJOBS:-" -j7 "}
export VERSION ARCH BUILD TMP
mkdir -p $TMP
cd $TMP
rm -rf $PKGNAM-$BASEVER $PKGNAM-$VERSION
tar xvf $CWD/$PKGNAM-$BASEVER.tar.xz
# Apply incremental patches
#mv $PKGNAM-$BASEVER $PKGNAM-$VERSION
#cd $PKGNAM-$VERSION
#xz -cd $CWD/patch-4.4.29-30.xz | patch -p1 --verbose
# Build kernel-headers
cd $TMP/$PKGNAM-$VERSION
rm -rf $PKG
mkdir -p $PKG/usr
make $NUMJOBS INSTALL_HDR_PATH=$PKG/usr headers_install
find $PKG/usr -type f -a ! -name '*.h' -delete
rm -rf $PKG/usr/include/drm
mv $PKG/usr/include/asm{,-x86}
ln -sf asm-x86 $PKG/usr/include/asm
mkdir -p $PKG/install
cat $CWD/kernel-headers/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $TMP/kernel-headers-$VERSION-$KARCH-$BUILD.txz
# Build kernel-huge
cd $TMP/$PKGNAM-$VERSION
make $NUMJOBS mrproper
cat $CWD/config-$ARCH/config-huge-* > .config
make $NUMJOBS oldconfig
make $NUMJOBS bzImage
rm -rf $PKG
mkdir -p $PKG
cp arch/$KARCH/boot/bzImage $PKG
cp System.map $PKG
cp .config $PKG/config
cp $CWD/packaging-$ARCH/kernel-huge/kernel-huge.SlackBuild $PKG
cp $CWD/packaging-$ARCH/kernel-huge/slack-desc $PKG
cd $PKG
./kernel-huge.SlackBuild
# Build kernel-generic
cd $TMP/$PKGNAM-$VERSION
make $NUMJOBS mrproper
cat $CWD/config-$ARCH/config-generic-* > .config
make $NUMJOBS oldconfig
make $NUMJOBS bzImage
rm -rf $PKG
mkdir -p $PKG
cp arch/$KARCH/boot/bzImage $PKG
cp System.map $PKG
cp .config $PKG/config
cp $CWD/packaging-$ARCH/kernel-generic/kernel-generic.SlackBuild $PKG
cp $CWD/packaging-$ARCH/kernel-generic/slack-desc $PKG
cd $PKG
./kernel-generic.SlackBuild
# Build kernel-modules
cd $TMP/$PKGNAM-$VERSION
make $NUMJOBS modules
rm -rf $PKG
mkdir -p $PKG
make $NUMJOBS INSTALL_MOD_PATH=$PKG modules_install
rm -f $PKG/lib/modules/$VERSION/{build,source}
ln -s /usr/src/$PKGNAM-$VERSION $PKG/lib/modules/$VERSION/build
ln -s /usr/src/$PKGNAM-$VERSION $PKG/lib/modules/$VERSION/source
cp $CWD/packaging-$ARCH/kernel-modules/kernel-modules.SlackBuild $PKG
cp $CWD/packaging-$ARCH/kernel-modules/slack-desc $PKG
sed -i -e 's@/lib/modules/${KERNELRELEASE}@$CWD&@' $PKG/kernel-modules.SlackBuild
cd $PKG
KERNELRELEASE=$VERSION ./kernel-modules.SlackBuild
# Build kernel-source
cd $TMP/$PKGNAM-$VERSION
make $NUMJOBS clean
make $NUMJOBS prepare
rm .version .config.old
rm -rf $PKG
mkdir -p $PKG/usr/src
ln -s $PKGNAM-$VERSION $PKG/usr/src/$PKGNAM
mkdir -p $PKG/install
cat $CWD/kernel-source/slack-desc > $PKG/install/slack-desc
cd $PKG
mv $TMP/$PKGNAM-$VERSION usr/src
/sbin/makepkg -l y -c n $TMP/kernel-source-$VERSION-noarch-$BUILD.txz
# Build kernel-firmware
exit
cd $TMP
rm -rf $PKG
mkdir -p $PKG
cp -a $CWD/kernel-firmware $PKG
sed -i -e 's/git clone/& --depth=1/' $PKG/kernel-firmware/kernel-firmware.SlackBuild
cd $PKG/kernel-firmware
unset VERSION
./kernel-firmware.SlackBuild