So, guys, now let us write our first line of code of Linux kernel programming.
So in this section of the course we will going to write a Hello World Linux kernel module.
Those who are already familiar with writing Linux kernel module can safely skip this section of the
course.
There is absolutely nothing new for them, so for beginners just pay attention.
So Linux kernel modules are nothing, but they are just pieces of code that can be loaded and unloaded
into the kernel upon demand.
Right?
So you can see in the diagram, whereas Linux kernel is one big piece of code which is running on the
machine.
Linux kernel module is like a kernel program which can be integrated with the rest of the Linux kernel
and actually become a part of the Linux kernel.
Right.
Linux kernel modules.
That is extend the functionality of the kernel without the need to reboot the system or recompiling
the Linux kernel altogether.
Right.
So whenever you add a new functionality to your program, you actually compile the program and then
run it again.
Linux kernel modules are very different from this aspect.
You can simply write a Linux kernel module, compile it and just plug it in with the rest of the Linux
kernel which is already running on your machine.
There is no need to reboot the system or recompile the Linux kernel altogether, right?
So almost all the device drivers are written as Linux kernel modules.
Linux kernel is shipped with hundreds of kernel modules with them.
The Linux kernel modules when loaded becomes a part of the Linux kernel.
Right?
So once you have written the Linux kernel module, you can actually insert the Linux kernel module using
the command insert mode, right?
And of course you need to have a root privileges to play with the kernel.
Therefore all the commands to load or unload the Linux kernel module is prefixed by sudo right to unload
the Linux kernel module.
You need to use mode command and in order to check whether your Linux kernel module has been successfully
inserted into the Linux kernel, you can use the command mode.
So now let us first code our first Hello World Linux kernel module.
Just download this git repository on your local machine and the rest of the things we will follow up.