65 lines
1.5 KiB
Bash
Executable file
65 lines
1.5 KiB
Bash
Executable file
#! /bin/bash
|
|
|
|
GREEN='\033[0;32m'
|
|
DEFAULT='\033[0m'
|
|
PREFIX='linux-'
|
|
EXTENSION='.tar.xz'
|
|
|
|
# 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`
|
|
|
|
# Make directory in /usr/src/
|
|
DIR="/usr/src/${KERNEL}"
|
|
mkdir "${DIR}"
|
|
|
|
# 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
|
|
|
|
# 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"
|