How To Compile Linux Kernel From Source Code?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-compile-linux-kernel-from-source-code/
PINTEREST
PINTEREST
INSTAGRAM

Hi today we are going to compile Linux kernel. you can think that compiling  kernel is very complicated and hard for you. But it is not. It is more easy to compile than a lot other projects. Because Linux kernel has no dependency to library or other tools. It needs just ncurses development library which is used for module configuration. Lets start the process.

Download Linux Kernel Source Code

Linux Kernel is a open source project which is can be used any one without any fee and freely. Linux Kernel source code is provided by http://www.kernel.org . First we will download latest mainline kernel source code.

Download Linux Kernel Source Code
Download Linux Kernel Source Code

Extract Linux Kernel

Then decompress it. The postfix of file like xz, gz is not important they are just different compression algorithms all ingredients are the same

Enter the decompress directory

Install Dependencies

Run module configuration menu for kernel. Here you need ncurses devel library for C programming language.

Ubuntu, Debian, Mint, Kali

Fedora, CentOS, RedHat

Kernel Build Configuration

We will run kernel configuration tool with the following command.

You can configure file system module from here. If you have space constraint you can remove unneeded file system modules or add required file system modules

LEARN MORE  How To Use vmstat To Monitor Linux Performance
Kernel Build Configuration
Kernel Build Configuration

Here is driver modules.As I said above you can remove unneeded modules or add drivers you need.

Kernel Driver
Kernel Driver

Virtualization modules can be configured with this menu. Say you have AMD CPU you do not have to compile Intel drivers.

Kernel Virtualization
Kernel Virtualization

After applying all settings you can save them and exit

Save Kernel Compile Configuration
Save Kernel Compile Configuration
Kernel Config
Kernel Config

Make Help

Now we are ready to compile process. There is a lot of compile options but I am gonna show you some of them. If you want to see all off them run make help

Make Help
Make Help

Compiling Linux Kernel As ISO Image

We can compile the Linux Kernel with the isoimage option which will make ISO files to boot the kernel. This ISO can be burned into a CD too.

After compilation you can find your image in arch/x86/boot/image.iso

Compile Linux As Binary

Linux kernel can be compile with the make command. By providing the -j8 compilation will done in multi threat way.

Compile Linux As Binary
Compile Linux As Binary

Install Linux Kernel

We can install compiled Linux kernel like below

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-compile-linux-kernel-from-source-code/
PINTEREST
PINTEREST
INSTAGRAM