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 kernel.org and download the latest version .
  • Here I am using Ubuntu as the operating system .
  • Install it with wget .

$sudo wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.9.tar.xz

  • 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)

Thank you.

Β 
Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.