68 lines
1.4 KiB
Bash
68 lines
1.4 KiB
Bash
|
#! /bin/bash
|
||
|
|
||
|
GREEN='\033[0;32m'
|
||
|
DEFAULT='\033[0m'
|
||
|
PREFIX='linux-'
|
||
|
EXTENSION='.tar.xz'
|
||
|
|
||
|
|
||
|
# Connaitre le dernier kernel existant
|
||
|
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`
|
||
|
|
||
|
echo $KERNEL :: $URL :: $EXTENSION
|
||
|
|
||
|
exit
|
||
|
|
||
|
# On créé un dossier du style /usr/src/5.1.9
|
||
|
DIR="/usr/src/${KERNEL}"
|
||
|
mkdir "${DIR}"
|
||
|
|
||
|
# Go to build dir
|
||
|
cd "${DIR}" || exit
|
||
|
|
||
|
# On télécharge l'archive dans le dossier
|
||
|
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"
|