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.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:
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:
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:
3.3) Install gcc:
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.
The picture: The dead sea, Israel.