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”
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
it depends on a lot of factors. how much stuff you have enabled within the kernel. and how many things you modulize. I personally run a module free system and just built any required firmware into the Kernel. my kernel compilations take about 45 minutes to an hour.
but knowing how regular distros are populated to “just work” I could see it taking 3 hours. but then again it depends on the hardware. if you are doing this with a Quad-core this could be much faster. on Laptops not so much.
Many distros/setups don’t have a kernel .config in /boot but include it embedded in the kernel itself. You can try zcat /proc/config.gz > config.
Another very nice trick is to use make localmodconfig. It basically creates a kernel that only has currently used stuff enabled. Hence it’s a quick and dirty way to test a new kernel easily but won’t necessarily work if you later connect some new gadget unto your PC.
Personally I went balls deep in and installed Gentoo and manually configured the kernel. make menuconfig and make nconfig have a nice search feature.
that would also work. however that feature would have to be enabled within the kernel to work. if you use GRUB which I’m kinda confident everyone and their mother uses GRUB. it will work. but that method also works too.
cause not everyone knows BASH… and to assume people know how to do everything on Linux is dumb.
Also this is the problem with the Linux community. we’ve been using Linux for years so it comes easy to us, so we get frustrated when others don’t pick it up fast. but we were all in that predicament of not knowing anything about it prior to use at one point.
This was just a quick thing. But I’ve gotten to the point where I wasted time configuring my own kernel for a few hours. So now every time I upgrade to the latest kernel I just transfer the config files and recompile. Also I no longer use kernel modules. I just build things into the kernel