Updating, compiling and installing the Linux Kernel from our previously cloned Linux repository
Hi everyone,
In this post, I will show you how to update a locally cloned Linux Repo, run some cleanup commands, and compile the kernel again. We will then proceed to install it.
This post will be shorter than yesterday due to the fact that we have already performed the preparations to compile it. We will simply be running a git pull
command to update our local repository with the latest remote repository changes, run some cleanup commands, and run the make
command that will compile it.
Step 1: Updating our local Linux Kernel repository
First, we must update our local Linux Kernel repository with the latest remote repository changes. We will do this by navigating to our local repository folder:
Then, we will run git pull
:
Our local repository will be updated with the latest remote repository changes:
At this point, we have successfully updated our local Linux Kernel repository with the latest remote repository changes.
Step 2: Cleaning up our environment
Before we can compile the Linux Kernel again, we must clean up our environment by removing the debian
directory and the vmlinux-gdb.py
files. Failing to do so will cause the make
command to fail.
We will run these 2 lines inside the Linux repository folder:
rm -r debian
rm vmlinux-gdb.py
At this point, we have cleaned up our environment and are ready to compile the Linux Kernel again.
Step 3: Compiling the Linux Kernel
As we did yesterday, we will be using the make
command:
make -j $(getconf _NPROCESSORS_ONLN) deb-pkg LOCALVERSION=-daily-20221201
Note that I changed the LOCALVERSION
variable to yesterday’s date (20221201).
The Linux Kernel will be compiled and packaged into new .deb files:
The new .deb files will be in the previous folder:
At this time, we have compiled the new Linux Kernel code.
Step 4: Installing the Linux Kernel
We will install the Linux Kernel with the dpkg
command:
sudo dpkg -i linux*20221201*.deb
I’m using 2 wildcard characters there to only select the files having the word linux
and the date string 20221201
, as well as the .deb
extension. We do not want to install the other .deb packages we may have there.
The installation should run normally and complete successfully:
Now, reboot your machine and confirm the new Linux Kernel is installed and running with uname -r
:
And that’s it! You have successfully updated your local Linux Kernel repository, compiled it and installed it.