A Beginner’s Journey into Linux Kernel

Siddhant Gupta
Code Dementia
Published in
4 min readJan 19, 2021

I recently participated in a 2 monthly long program called SLoP(Semester-long project). I was selected for the Linux kernel project under the mentorship of Himadri Pandya and Mamta Shukla. This blog post is about my journey with SLoP and a step into Linux kernel development.

First Impression:
It all started with a mail about SLoP, which was an initiative by members of DSC(Developer Students Club) DA-IICT, and was intended to introduce students nationwide to the opensource culture. It was sponsored by The Linux Foundation, so there was a project related to the Linux kernel in it. This program was inspired by GSoC(Google summer of code) and was operated similarly. Hence, similar to GSoC, all individuals were supposed to draft a proposal for every project of their
choice.
With around 50 projects to choose from, I found myself a good fit for only one project, “Linux kernel.” The first reason for this was that I loved Linux and was a fan of the C language. Second, I am not good at developing. Luckily, I got selected after drafting many proposals as I didn’t know how to write an ideal proposal for that project.

Stepping into the kernel:
In the first meeting after selection, Himadri and Mamta explained the task to me. Of course, I was unfamiliar with Linux kernel development at first. Both himadri and Mamta supported me to get through the stuff on my own with the condition that they’ll guide me, and I am supposed to figure out things and strive out my way through. The first few tasks were a cakewalk; I was asked to read a few chapters of a book named “Linux Device Drivers, by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman” and do a course called “A Beginner’s Guide to Linux Kernel Development.” I covered it up within a few days, and while covering the course up, I was asked to refer similar tutorial on kernelnewbies.org. Slowly I was stepping into the kernel; I already had some basic knowledge of building codes using Makefile and had a basic understanding of git as well. The first kernel I cloned was a mainline kernel, and the other was a Stable one. I copied my current configuration and compiled into the stable kernel (at that time, 5.8.Y was stable) I installed the kernel following Shuah khan’s tutorial, which had nicely explained how to generate and send patches to maintainers.

Second Phase:
Once the kernel was compiled, mentors provided me with some resources to understand how the drivers are being cleaned and how they are compiled. “Checkpatch script” played a crucial role in the entire journey, and I got in this phase, the major part revolved around it. By this time, mamta also introduced me to the coccinelle script, the other script to check out warnings in driver codes.

First Patch:
I submitted my first patch that suggested using BIT macro instead of left shifting on one (1 << …) while this was not creating any other code issue, but the checkpatch script showed me a warning for the same. So after getting it reviewed by mentors, I sent my first ever patch to the maintainers, waiting to see the further procedure. In the morning I received a mail stating my patch doesn’t make any sense; yeah, that would have turned out to be the most devastating point of this journey, but then himadri consoled me as several patches get rejected, and mine was one of them. So the second patch that I sent became the first one to get accepted, and I was again on cloud nine, and that was my journey with the first patch.

Third phase :
After a month of initial stages, it was time to understand how the kernel is being documented. This took a lot of time for me to understand, and to be honest, it’s still partially unclear to me as after sending around 2 to 3 patches for the same, none made their way through. But after getting a brief knowledge of documentation, the third phase moved on to understand how bugs are hunted and read bug reports from several tools like Bugzilla, syzkaller and syzbot, and even if you encounter any such bug how to report it.

Final Thanks:
First of all, i am really thankful to Himadri and Mamta for selecting and guiding me in this program,and solving my silliest doubts. Truly this was an adventurous journey with you guys and learning things about the kernel was again the greatest opportunity. Cheers to DSC for coming up with such a great initiative. So, my overall experience with this program has been fantastic, and a special mention to The Linux Foundation for sponsoring this program, I wish DSC comes up with many such programs in the upcoming days.

--

--