2018-08-26 20:51:00 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
DEFAULT='\033[0m'
|
2018-11-12 13:14:30 +01:00
|
|
|
PREFIX='linux-'
|
2018-08-26 20:51:00 +02:00
|
|
|
EXTENSION='.tar.xz'
|
2018-11-12 13:14:30 +01:00
|
|
|
# For RC releases
|
|
|
|
if [ `expr index ${1} gz` -gt 0 ] ; then
|
|
|
|
EXTENSION='.tar.gz'
|
|
|
|
fi
|
|
|
|
|
|
|
|
KERNEL=${1}
|
|
|
|
KERNEL=${KERNEL#$PREFIX}
|
2018-08-26 20:51:00 +02:00
|
|
|
# Get kernel version from argument
|
|
|
|
KERNEL=${KERNEL%$EXTENSION}
|
|
|
|
|
2018-10-22 09:50:57 +02:00
|
|
|
DIR="/usr/src/${KERNEL}"
|
|
|
|
|
|
|
|
# Create dedicated folder
|
|
|
|
mkdir "${DIR}"
|
|
|
|
|
|
|
|
# Move archive to build directory
|
|
|
|
mv "${1}" "${DIR}"
|
|
|
|
|
|
|
|
# Go to build dir
|
|
|
|
cd "${DIR}" || exit
|
|
|
|
|
2018-08-26 20:51:00 +02:00
|
|
|
# Extract kernel archive
|
2018-10-22 09:50:57 +02:00
|
|
|
tar xavf "${1}"
|
2018-08-26 20:51:00 +02:00
|
|
|
|
|
|
|
# Enter kernel directory
|
2018-10-22 09:50:57 +02:00
|
|
|
cd "linux-${KERNEL}" || exit
|
2018-08-26 20:51:00 +02:00
|
|
|
|
|
|
|
# Get old config
|
|
|
|
make olddefconfig
|
|
|
|
|
|
|
|
# Some optimizations
|
|
|
|
./scripts/config -d CONFIG_MODULE_SIG_ALL -d CONFIG_MODULE_SIG_KEY -d CONFIG_SYSTEM_TRUSTED_KEYS
|
|
|
|
./scripts/config -d CONFIG_DEBUG_INFO
|
|
|
|
|
|
|
|
# Compile kernel
|
|
|
|
make deb-pkg -j"$(nproc)" LOCALVERSION=-"$(dpkg --print-architecture)" KDEB_PKGVERSION="$(make kernelversion)-1"
|
|
|
|
|
|
|
|
# Optimization
|
|
|
|
make bindeb-pkg -j"$(nproc)" LOCALVERSION=-"$(dpkg --print-architecture)" KDEB_PKGVERSION="$(make kernelversion)-1"
|
|
|
|
|
|
|
|
# Go to parent directory
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Install new packages
|
2018-10-22 09:50:57 +02:00
|
|
|
dpkg -i ./*${KERNEL}*.deb
|
2018-08-26 20:51:00 +02:00
|
|
|
|
|
|
|
echo -e "${GREEN} ALL DONE!\n"
|