Recompiling Your Linux Kernel

This is a brief guide on how to recompile your Linux kernel, based on Ubuntu.

Please note, this post only deals with recompiling your kernel (especially for first-timers) with no configuration changes and no upgrades to a different version. This is not aimed at more advanced users, rather, this is only a guide for people who are planning to give their first shot at recompiling the kernel.

To get the current kernel version on your Ubuntu, type the command:

uname -r

Recompiling the kernel will require some features to be installed (if you don’t have them already), so run:

sudo apt-get install build-essential

For making configuration changes with menuconfig, Ncurses needs to be installed, but it is not required in this particular guide.

Now, login as root user by typing:

sudo su (for Ubuntu)

The following commands for recompilation must be executed as root.

Change your current working directory to /usr/src:

cd /usr/src

Before proceeding, see the list of folders that are already there in /usr/src by running ls. This is because later, a new folder will get added to this directory, and you must be able to identify it.

Continue reading