Getting started with Linux kernel development on CentOS 7 (Linux kernel development – part 1)

1. Preface
Hi all,
Recently I have decided to “dive into” the world of Linux kernel development. So far all of my “Linux experience” was as a user space developer and was only on an Ubuntu machine – most of the time on the Desktop flavor (but sometimes also on the server flavor). In order to “get my hands dirty” with a different Linux version, I will start my Linux kernel development with CentOS as my Linux machine in order to also, along the way, get to know Linux in general by examining the differences (as well as the similarities) between these two different flavors (Ubuntu that I’m currently more familiar with, Vs CentOS).

2. Working VM Preparations
First thing is to get a CentOS image for my virtual machine (it is highly recommended to work on a virtual machine when doing kernel development). I already have a vmware workstation 15 installed on my Windows machine, so all that is left to do is get a CentOS image to run on the Vmware player. I have followed this short tutorial in order to get things done with all that has to do with getting the CentOS image and create a virtual machine on my vmware work station.
2.1) Versions:
2.1.1) I’m using vmware workstation 15.
2.1.2) I have downloaded an ISO image of CentOS 7.7 with LIVE GNOME

2.2) I have followed this tutorial in order to get the CentOS image and create a virtual machine on my vmware workstation.

3. Installing kernel headers
3.1) In order, for start, to be able to build kernel modules, you need to verify that the “proper” kernel headers are installed on the machine. This can be done with the following command:

[liveuser@localhost ~]$ sudo yum install "kernel-devel-uname-r == $(uname -r)

NOTE: The fact that the last argument to this command is the value of the command uname -r –> makes sure that the versions of the headers that will be installed are “compatible” with the version of the CentOS machine, see the notes in the figure below:
kernel_1

3.2) To make sure that indeed the kernel headers installations went well, run the following command and make sure that the output matches the output of the end of the previous command:

[liveuser@localhost ~]$ ls /usr/src/kernels/
3.10.0-1062.el7.x86_64

3.3) Install gcc:

sudo yum install gcc

 

4. Conclusions
In this short post I have done all the required “logistics preparations” that are needed in order to start and develop kernel modules.
4.1) Note that I did NOT downloaded the kernel sources NOR build it locally on my CentOS machine.

Resources:
a) Install CentOS image on vmware work station tutorial
b) Short tutorial regarding installing Linux kernel headers

The picture: The dead sea, Israel.

2 thoughts on “Getting started with Linux kernel development on CentOS 7 (Linux kernel development – part 1)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s