pkgkernel/pkgkernel-auto.sh

66 lines
1.5 KiB
Bash
Raw Normal View History

#! /bin/bash
GREEN='\033[0;32m'
DEFAULT='\033[0m'
PREFIX='linux-'
EXTENSION='.tar.xz'
2019-06-22 13:34:31 +02:00
# Get last kernel version
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
KERNEL=`echo ${INFO} | cut -d' ' -f 2`
URL=`echo ${INFO} | cut -d' ' -f 1`
FILE=`echo ${URL}|rev|cut -d'/' -f 1 | rev`
2019-06-22 13:34:31 +02:00
# Make directory in /usr/src/
DIR="/usr/src/${KERNEL}"
mkdir "${DIR}"
2019-08-05 10:32:29 +02:00
# Install build dependancies
apt install build-essential fakeroot dpkg-dev perl libssl-dev bc gnupg dirmngr libelf-dev flex bison
# Go to build dir
cd "${DIR}" || exit
2019-06-22 13:34:31 +02:00
# Get kernel archive
wget ${URL}
# Extract kernel archive
tar xavf "${FILE}"
# Enter kernel directory
cd "linux-${KERNEL}" || exit
# 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
dpkg -i ./*${KERNEL}*.deb
# Update acpi_call
git clone git://github.com/teleshoes/acpi_call.git /tmp/acpi_call
cd /tmp/acpi_call
make
make install
cd /tmp
# Clean directories
rm -rf /tmp/acpi_call ${DIR}
echo -e "${GREEN} ALL DONE!\n"