Posted on April, 2024 by Felipe Aníbal
Last updated on June 24, 2024
All Linux operating systems (OS) use the linux Kernel, including the Linux Fedora running on my own computer as I write this. If we are going to make changes to the kernel we must have a way to test our changes while making sure they don't break our system. How can we make changes to the Kernel and test them without risking our own operating system? We use virtual machines!
The first step to contribute to the kernel was learning about virtual machines and how to set them up. Virtual machines (VM) simulate a computer running inside another computer. It creates an isolated environment where we can simulate different operating systems, file systems and even different hardware architectures. This allows us to run a linux based OS, and change it to use our modified Kernel. If something breaks along the away, we can delete the broken machine and start another one.
In order to setup a virtual machine, we followed the tutorial made by FLUSP. Most of the process was straight-forward. The only difference is that I used portforwarding to setup the SSH connection to the VM.
The second step was to find the code for the linux Kernel. Many versions of the code are available online, they are called “trees”. For our purposes, since we are going to work with the IIO subsystem (Industrial Input Output), we downloaded the IIO subsystem tree from this link, following another tutorial from FLUSP. That part was also straight-forward.
With the code downloaded, it was time to compile the Kernel. The tutorials we are following were written for an ARM64 architecture, whereas my CPU (and that of most of my classmates) has a X86 architecture. Here we see some of the power of the Virtual Machines. I was only able to follow the tutorials because the virtual machine can simulate a different hardware architecture on my computer. Having set that up it was time to build the Kernel. The process took around 35 minutes on my machine.
Now that the Kernel and its modules were properly compiled, we had to install the modules and deploy the Kernel on the VM. That involved replacing the old kernel from the VM with the recently downloaded one. To my surprise all steps worked on the first attempt! For the first time, I built and deployed a Linux Kernel!
It was a unique experience to download and build the code from such a big system and one that I use on a daily basis. Next step is to learn how to make changes to the modules and drivers and incorporate these changes to the Kernel on the VM.