Press "Enter" to skip to content

Compile and install latest kernel (5.1.16) on Debian Buster

Hi! Here are my notes on how to compile the latest version of the Linux kernel, at this moment version 5.1.16, on Debian 10 ‘Buster’, from source code. Remember to change versions and/or paths to match your preferences if necessary.

## Download the source code and pgp signature from
## to a directory of your choice
mkdir -p /usr/src/
cd /usr/src/
## Uncompress the source code and check the signature
xz -d -v linux-5.1.16.tar.xz
gpg --verify linux-5.1.16.tar.sign
## Untar the source code and cd into the directory
tar xf linux-5.1.16.tar
cd linux-5.1.16/
## Copy over actual kernel config file and run 'make menuconfig'
cp -v /boot/config-$(uname -r) .config
## Install necessary packages
apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev bc
make menuconfig
## Go to Cryptographic API  ---> Certificates for signature checking --->
## and leave 'File name or PKCS#11 URI of module signing key' and 
## 'Additional X.509 keys for default system keyring' blank if not
## already blank
## Compile using make or make -j n where n is the number of processors to use
make -j 4
## Install kernel modules
make modules_install
## Optimize and compile new kernel
cd /lib/modules/5.1.16/
find . -name *.ko -exec strip --strip-unneeded {} +
cd /usr/src/linux-5.1.16/
make install
## Done


  1. Mark
    Mark July 14, 2019

    Works like a charm, thanks!

  2. Jürgen S
    Jürgen S September 12, 2019

    You may want to add ‘bc’ to the list of packages for apt-get install.

    • tat0
      tat0 September 15, 2019

      Hi, thanks for the heads up, bc is used during the kernel build to generate time constants in header files, so it should be installed previously if not already in the system. Added bc to the list of packages to install.

  3. Xserty
    Xserty October 20, 2019

    How about ‘make modules’ ?

    • tat0
      tat0 October 21, 2019

      Hello, there is no need for ‘make modules’. ‘make’ itself builds kernel and modules by default. Type ‘make help’ for further details.

      • Xserty
        Xserty October 21, 2019

        That shows how many years ago I compiled my last kernel! 😮

Leave a Reply

Your email address will not be published. Required fields are marked *