Help answer threads with 0 replies.
Go Back > Blogs > zeebra
User Name


Rate this Entry

Compiling a Kernel, general/generic KISS method - am I crazy, am I stupid, am I wrong?

Posted 02-14-2019 at 01:58 PM by zeebra

Alright. So, I have seen so many different ways of "installing" a "new" Kernel. There are probably 100 different ways to do this, and they all seem so complicated or so distro specific, and I dislike it, to be honest.

I like it the "old way" or the raw method as I like to call it, or it could actually be the "wrong way" or the "stupid way", I am not sure, but yet I am pretty sure that it is more likely "the old way" or the KISS way. Keep It Simple Stupid.

Ok, so what does this method do? It CONFIGURES afresh a kernel and COMPILES it, no fancy pants, no extras, and often too little for some setups, sure. There are drawbacks, so, what does it NOT do? It does not mkinitrd and it does not make headers_install. Why not? Why doesn't it do DKMS or fancy pants or Nvidia or AMD's newest proprietary graphics driver? Because it's KISS! It's old way, it's basics. You CAN add those things to it if you need/want. But if you do not need or want, then why not keep it simple? Or why leave it to someone else to oversimplify it by just downloading a binary kernel from the repository of you distribution?

Either you need to configure and compile your own Kernel or you do not. If you do, I would say this way of doing it is pretty simple way, and a pretty good way, and it almost always works and it works on most distroes, minus those with strict fancy pants requirements. So let's get down and dirty:

1. Download a Kernel from and copy/move to /usr/src

cd /usr/src <- working directory for the procedure
tar -xvf linux(version).tar.xz <- extracting the compressed data, it could be another way/filetype (-zxvf?)
cd linux(version) <- working directory of you current kernel source
make clean && make mrproper <- cleans up old crap and makes it tidy, also if you need to redo everything
(cp ../linux(uname -a)/.config ./.config) <-- optional
make menuconfig <- configure here, or using another method
make -j3 <--- 3 indicates cores you use to compile. If you have 8, use 6 or 7
make modules && make modules_install <-- modules
make install <-- autoinstallscript, or do it manually if you prefer

3. Configure bootloader

4. Boot new kernel.

So, let's sum it up shall we?

1. Download Kernel --> /usr/src

cd /usr/src
tar -xvf linux(x).tar.xz
cd linux(x)
make clean && make mrproper
(cp ../config ./.config)
make menuconfig
make -j3
make modules && make modules_install
make install
3. Reconfigure bootloader

4. Reboot into new Kernel && test/verify

If you do not need an initrd, why add one? If you need one, add one!
Headers of old Kernel work with the new Kernel, but not new functions. If you need new headers, add them!

For me this method has for a long time been the absolute core to running a new Kernel or experimenting with a new one, or reconfiguring one. It generally always works just fine and with all distroes I have tried (except fancy pants Fedora). For me it is comfortable and it let's me focus on the actual configuring inside menuconfig correctly (which is very important), rather than some complicated method to exchange/install/compile a Kernel.

I just wanted to note this down for my own records as well, in case I forget something, and for anyone who might find it useful.
Posted in Uncategorized
Views 481 Comments 1
« Prev     Main     Next »
Total Comments 1


  1. Old Comment
    Hint. You need to have the appropriate C-devel packages and libs installed to do this..
    Posted 10-04-2020 at 06:28 AM by zeebra zeebra is offline


All times are GMT -5. The time now is 11:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration