Skip to content

Instantly share code, notes, and snippets.

@rubo77
Forked from Avyd/Compile to .deb
Last active November 13, 2018 16:34
Show Gist options
  • Save rubo77/cd1f8d2e3db4720b7a60aa666fd195d6 to your computer and use it in GitHub Desktop.
Save rubo77/cd1f8d2e3db4720b7a60aa666fd195d6 to your computer and use it in GitHub Desktop.
Compile kernel to installable .deb package
# Install necessary things
apt-get update
apt-get install --no-install-recommends kernel-package libncurses5-dev fakeroot wget bzip2 build-essential bison
# Get the kernel
cd /usr/src
# search latest kernel on https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/
VERSION=4.18.6
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-$VERSION.tar.xz
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-$VERSION.tar.sign
gpg --verify linux-$VERSION.tar.sign
tar xpf linux-$VERSION.tar.xz
ln -s linux-$VERSION linux
# Configure the kernel
cd /usr/src/linux
make clean && make mrproper
# Save the existing config
cp /boot/config-`uname -r` ./.config
make menuconfig
# Press 5x TAB to Load the file .config
# Optional Edit config and save. Then Exit
# Build the kernel
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
# go get a coffe :)
make modules
make modules_install
# Install new kernel
cd /usr/src
# Check file names before running dpkg
ls -l
dpkg -i linux-image-$VERSION-custom_$VERSION-custom-10.00.Custom_amd64.deb
dpkg -i linux-headers-$VERSION-custom_$VERSION-custom-10.00.Custom_amd64.deb
# Test the kernel
shutdown -r now
uname -r
# Notes:
# http://www.berkes.ca/guides/linux_kernel.html
# http://www.howtoforge.com/kernel_compilation_ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment