DEV Community

Cover image for Building and compiling Linux Kernel :
Rahul Kumar
Rahul Kumar

Posted on

Building and compiling Linux Kernel :

What is Linux Kernel ?

  • As we know Kernel is the core of any operating system which is the interface between computer's hardware and it's processes .
  • And the main task of the kernel is :
1. Memory management
2. Process management
3. System calls
4. Device drivers
5. Security
Enter fullscreen mode Exit fullscreen mode
  • Linux Kernel is a free opensource monolithic, modular and multitasking Kernel for Unix like operating systems .

  • Though it is opensource we can install and manipulate as per our need .

Dependencies :

  • Make sure to install these dependencies :
sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
Enter fullscreen mode Exit fullscreen mode

How to installation :

  • Navigate to and download the latest version .
  • Here I am using Ubuntu as the operating system .
  • Install it with wget .

$sudo wget

  • Unzip the downloaded file .

$ sudo tar -xvf linux-5.10.9.tar.xz

  • Make a directory in your home folder .

$ mkdir kernel

  • Copy the file after extraction .

$ cp -r linux-5.10.9/ /kernel

  • Navigate to :

$cd kernel/linux-5.10.9/

  • Start the Linux source configuration tool

make menuconfig

  • Edit the configuration of kernel and save-and-exit.
    Alt Text

  • Compile the kernel .

$make -j 5 KDEB_PKGVERSION=1.0 deb-pkg

  • Install the Kernel .

sudo dpkg -i ../linux*.deb

  • Reboot your system and check for the kernel version .

Thank You 🤖🤖🤖

Top comments (0)