Introduction to the Linux Kernel

I am working on a few things right now and in between jobs, doing the transition from business to software testing which I am really looking forward to. I am still working on CS50 and also completing the last JAVA module with a local university for a part time course.

I decided to open my ThinkpadX240 on a long car journey with no internet and seeing as I want to improve my software development skills decided to look at the random files and folders no one usually pays any attention to. I found some cool stuff like the list of ports for different services for example and when I got home decided to look more into the Linux Kernel as I find it fascinating.

This write up is based on the video tutorial ‘Kernel Basics’ that is available on Youtube.

The definition, according to Wikipedia of the kernel is:

“The Kernel is a computer program which manages input output requests from software and translates them into data processing instructions for CPU and other electronic components of the computer”

On the command line the command uname -a tells us the current kernel we are using. I am using 4.8.0-36-generic kernel which can be seen in the snapshot below:


I just want to clarify any confusion. I downloaded the kernel from here. ( and am working in that directory, however I am not actually running the kernel that I downloaded as can be seen by the output of uname -a .

After the uname -a command I ran lsmod which demonstrates all the modules that are installed on the kernel. The output of this command is seen below:

Screenshot from 2017-06-15 13-34-23

As can be seen there are a lot of modules installed and this image doesn’t show them all. After running this I decided to look at the README file for the kernel by using the command less README whilst in the correct directory.

Screenshot from 2017-06-15 13-37-36.png

This README.rst details the release notes for Linux version 4 and gives an overview of Linux which is really useful and should be the first step after downloading the kernel to obtain the basic information. Going from the Documentation directory and into the crypto directory we get more information regarding the cryptographic API that the Linux kernel uses. These C files are beyond me for now but I am planning to return to this in the future and I believe it is a great thing that all these files are readily available to study! 😉

After this in order to be able to change the config of the kernel we must download libncurses5-dev. This can be done by the command sudo apt-get install libncurses5-dev which is a developer library for ncurses.

The next step I did was run make menuconfig which presents us with a menu as below. From here we can then change the .config file but *USE WITH CAUTION*.

Screenshot from 2017-06-15 13-49-06.png

I didn’t change anything in here but decided to save whilst quitting as then I was able to view the config file by first running ls -l .config . Which presented me with the details of the config file. Then I ran less .config to see the actual contents of the file:

Screenshot from 2017-06-15 13-51-34.png

This is really useful as it shows us the configuration and all settings of the kernel and it is vital we don’t change anything within this file! After ensuring that this is correct, we then run the command make all which compiles the kernel. I have been working with the gcc compiler in C for the CS50 course and it is nice to know that I am familiar with running commands such as make all . CS50 has taught me so much, even though I have still not finished the course yet! I really hope this was useful to you and this is a great way to solidify what I’ve learnt by doing this blog. Blessings!!! 🙂


Leave a Reply

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

You are commenting using your 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