Last active
December 9, 2024 23:57
-
-
Save MasterJubei/dbeda3b3e9955ea58042ef0799d6840b to your computer and use it in GitHub Desktop.
Build mainline kernel on Ubuntu 22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
KERNEL_VER="6.12" | |
sudo apt install -y git build-essential fakeroot libncurses5-dev libssl-dev ccache dpkg-dev libelf-dev debhelper-compat libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf llvm | |
# Clone the kernel | |
mkdir -p kernelbuild | |
cd kernelbuild | |
if [ ! -d "linux-stable" ] ; then | |
git clone --depth=1 -b linux-$KERNEL_VER.y git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git | |
cd linux-stable | |
else | |
cd linux-stable | |
git pull | |
fi | |
# Build custom kernel | |
cp /boot/config-`uname -r` .config # copy config from current kernel | |
yes '' | make oldconfig | |
# Remove keys | |
sed -i 's/CONFIG_SYSTEM_TRUSTED_KEYS=.*/CONFIG_SYSTEM_TRUSTED_KEYS=""/' .config | |
sed -i 's/CONFIG_SYSTEM_TRUSTED_KEYRING=.*/CONFIG_SYSTEM_TRUSTED_KEYRING=""/' .config | |
sed -i 's/CONFIG_SYSTEM_REVOCATION_KEYS=.*/CONFIG_SYSTEM_REVOCATION_KEYS=""/' .config | |
make clean | |
make -j $(getconf _NPROCESSORS_ONLN) deb-pkg LOCALVERSION=-custom | |
# Install new kernel | |
# sudo dpkg -i ~/kernelbuild/linux-*.deb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment