Below we will see how you can upgrade the Debian 9 stretch kernel or in my case the Debian buster sid kernel I use. We will download the kernel we are interested in from the official Linux kernel website and make the necessary compile in the version of Debian we are using.
Let's start.
First we need to see which Linux kernel is running on our operating system:
Open a terminal and type the following command:
uname -r
As you can see, the Kernel preinstalled on the Debian buster operating system is 4.14.0
Download the Kernel:
From the official Linux Kernel site at https://www.kernel.org select and download the Kernel you are interested in as a compressed tar file.
In this article, we'll see how to upgrade the default Debian kernel to the fixed 4.15.2 core.
Click on the tarball and "Save file"
Install the required tools for the kernel compile:
To be able to compile a Debian kernel, you need to install some additional packages.
First, update the package repository cache with the following command, and then install the packages of the second command:
sudo apt-get update sudo apt-get install build-essential libbncurses5-dev gcc libssl-dev bc
Let's start Compile
Now we can start with the kernel compile from the source code. Before proceeding, make sure you have more than 18GB-20GB free disk space to compile the kernel (be careful not to do NTFS disk).
The kernel I downloaded is in the "Downloads" folder
So with the following command I drive the terminal to the folder that interests me:
cd ~ / Downloads
With a ls command you can see the name of the downloaded file. In my case it is 'linux-4.15.2.tar.xz'.
We need to export the tar file.
Run the following command:
tar xvf linux-4.15.2.tar.xz
A 'linux-4.15.2' folder will be created.
Type the following command:
cd linux-xNUMX
Now we need to copy the boot configuration to the 'linux-4.14.7' folder. We will use the configuration used by the current kernel.
Type the command:
ls / boot /
The results of our command are of interest to the config file you see in the following screenshot:
Run the following command to copy the configuration file:
cp -v / boot / config-4.14.0-3-amd64 .config
The new kernel can have many new features that your old kernel did not have. So you need to run the following command to convert the old configuration file to a new one. Otherwise, you will be asked many questions that may not make sense.
make menuconfig
Caution: If the command fails, read the error message. The message at the terminal will tell you what else you need to install to proceed with the conversion.
The following window will appear. You can enable and disable specific kernel functions. If you do not know what to do, simply leave it as it is with the defaults.
Click on the right arrow to go to Save and press Enter
Press Enter
Press Enter
With the following command we will begin the kernel compression process:
make deb-pkg
This process will take a long time.
Specter and Meltdown control on Linux distributions
When you finish the compilation you will see something like this:
In the screenshot below you will see that there are 4 debian packages (.deb) outside the 'linux-4.15.2'
Now all we have to do is install the new .deb files.
Run the following command to update the kernel:
sudo dpkg -i ../linux-*.deb