Quick & Dirty Tutorial on Linux Kernel Compilation

So do you want to compile your own kernel? do you want to have a lean kernel? Well good news. this will be quick and dirty tutorial of doing just that. now I will say this, this is going to be somewhat hard simply because I don’t know your hardware, and all hardware of course is different but similar. HOWEVER chances are you are using Intel as your CPU. and hope you have Intel NICs or Intel Wi-Fi cards cause that process will make the headache less painful. anyways let’s continue.

This Tutorial should work for all Distros. However I am doing this on Gentoo.

Let’s begin. I am going to get my Kernel version from my Package Manager but however in your case you will want to come to this website to do this.

Download the latest kernel tarball. which as of writing this is kernel 4.12.7 from this site. Kernel.org now we are going to unpack this. if you are using GNOME like I am just click on the tarball and it will unpack itself in the directory. if not just use from the command line. open up a terminal.

chances are your downloaded tarball is in your downloads folder so type this into the command line.

x = “extract”
p = “keep permissions”
f = “file name type of archive”

everything should be like so.

This is the difficult part. and the reason why is because I don’t know what hardware you have but chances are everything is working on your system right now. so to make it easy for yourself. take the kernel config from your current kernel, copy it into the new kernel directory then we’re going to compile it with those settings. Like so

#This process will take a lot of time depending the hardware. but onces this is done you will have a brand new kernel installed.

Congratulations you’ve compiled your own kernel.

1 Like