pkgkernel/pkgkernel.sh

68 lines
1.4 KiB
Bash
Raw Normal View History

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
2018-11-19 10:41:42 +01:00
if [ `echo ${1} | sed -n "s/gz.*//p" |wc -l` -gt 0 ] ; then
2018-11-12 13:14:30 +01:00
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}"
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
2018-10-22 09:50:57 +02:00
# 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
2019-04-04 19:53:01 +02:00
# 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}
2018-08-26 20:51:00 +02:00
echo -e "${GREEN} ALL DONE!\n"