#! /bin/bash GREEN='\033[0;32m' DEFAULT='\033[0m' PREFIX='linux-' EXTENSION='.tar.xz' # For RC releases if [ `echo ${1} | sed -n "s/gz.*//p" |wc -l` -gt 0 ] ; then EXTENSION='.tar.gz' fi KERNEL=${1} KERNEL=${KERNEL#$PREFIX} # Get kernel version from argument KERNEL=${KERNEL%$EXTENSION} DIR="/usr/src/${KERNEL}" # Install build dependancies apt install build-essential fakeroot dpkg-dev perl libssl-dev bc gnupg dirmngr libelf-dev flex bison # Create dedicated folder mkdir "${DIR}" # Move archive to build directory mv "${1}" "${DIR}" # Go to build dir cd "${DIR}" || exit # Extract kernel archive tar xavf "${1}" # 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"