Projekte & Automatisierung

Howto Kernel-Update

With default config

Code

#!/bin/bash
echo "Type the newest Kernel version for example: 5.4.1, followed by [ENTER]:"
read version
sudo apt install gnupg2 -y
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${version}.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${version}.tar.sign
xz -cd linux-${version}.tar.xz | gpg2 --verify linux-${version}.tar.sign -
echo "Copy the public key from the PGP keyserver in order to verify the signature i.e. RSA key ID and enter this key here, followed by [ENTER]:"
read gpg
gpg2 --recv-key ${gpg}
sudo rm -rf /usr/src/linux-${version}
tar xvf linux-${version}.tar.xz -C /usr/src/
rm linux-${version}.tar.xz
rm linux-${version}.tar.sign
cd /usr/src/linux-${version}
echo "Enter: ok, to start the kernel update, followed by [ENTER]:"
read go
if [[ $go == "ok" ]] 
then
	cp -v /boot/config-$(uname -r) .config
	sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev
	# make menuconfig
	yes "" | make oldconfig
	make -j $(nproc)
	sudo make modules_install
	sudo make install
	sudo update-initramfs -c -k ${version}
	sudo update-grub
else
	echo "STOP"
fi