Linux is one of the most renowned open-source platforms that is the heart of other platforms like Android, OpenWrt, Ubuntu, and many more. It has been a significant foundation, since the ’90s, for building software and developing mobile apps. Linux is truly a masterpiece that has a lot of potentials. If used right, it can create wonders for businesses in this era. But the question remains, why isn’t everyone starting a career in Linux? The answer is simple; it’s because it’s too difficult.
If you look closely, you can see Linux everywhere; it’s on your TV, in your smartphones, runs the internet, helps you drive a car, and much more. A little part of Linux exists in every technology that you own.
Linux Kernel is like a small dollop of glue that connects an operating system programmer to the computer hardware. After this guide, you’ll be a true Kernel Linux developer!
Six Steps – Become a Linux Developer
Before we get started on the steps, it’s wise to know that you want this as a career. You need to understand that once you go down this path, it’s best to complete it, so make sure you have the motivation.
Step 1 # Work on Your Environment
As a kernel developer, you need to have a PC that runs the Linux operating system. So, first setup your packages, but before that, build and send your patches. There are two kinds of distributions, the Debian and Red Hat. Here are the patches as follows:
If you have Debian distributions:
sudo apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev git-email -y
If you have distributions:
sudo dnf groupinstall "Development Tools" -y
sudo dnf install ncurses-devel bison flex elfutils-libelf-devel openssl-devel git-email -y
Once you’ve built the patch, it’s time to send it via email. Currently, developers lean towards the git send-email as their primary email client. You can easily configure this into your .gitconfig file.
Don’t forget to setup a password for Git in your Gmail settings!
Step 2 # Clone the Linux Kernel
The next step is to clone the kernel that you’ll need. Use the following command to download the latest kernel codebase. Although, be patient because it’s a time-consuming download.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git && cd linux-stable
Step 3 # Start Building the Kernel
Now that you’ve got both the tools and the kernel, it’s time to build the thing! The kernel uses a .config file that determines what modules are allowed. Most of the time, these files have to be created manually, which is a daunting and lengthy task. However, Linux has improved a lot in the last few decades, and already has a file that you can use easily. Here’s what to use to extract the file:
sudo cp /boot/config-`uname -r`* .config
Couldn’t find the file in your boot directory? Don’t worry; try this instead.
zcat /proc/config
Step 4 # Install Your Kernel
Now that your build was a success (fingers crossed), you now have a new binary file with the name vmlinux, and that file is your kernel!
Let’s start using the kernel! But first, you need to move the kernel modules in the system /lib/modules directory. Here’s how:
sudo make modules_install -j`nproc`
To ensure the boot loader utilizes your kernel move your kernel to the /boot directory. Here’s how:
sudo make install -j`nproc`
Now, the final step. Update the boot loader to load your new and shiny kernel! Assuming you’re a GRUB user, here’s how to update:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Now you do what’s necessary. Restart your PC and ensure that your new kernel is running using uname -a
Step 5 # Create a Kernel Patch File
There are various tasks you can do with your new, custom-built kernel, however, if you already know what you want to do with it. Run the git commit command and then run:
git format-patch HEAD~1
Look out for the patch file this creates. It should look something like 0001-my-commit-description.patch, it’s almost ready to go out, but first, check the code formatting. Here’s how:
scripts/checkpatch.pl <0001-my-commit-description.patch>
Remove any errors and address all your concerns. Ensure everything is ready to go, and send it using scripts/get_maintainer.pl <0001-my-commit-description.patch>.
Step 6 # Email the Patch
Now you’re almost done with your kernel. The last and final step is to send it to the maintainers. However, since you altered your patch a little, send it to the kernel janitors project for feedback. Once you get feedback and fix it accordingly. Here is what your patch should look like:
From <bob-smith-hash> Mon Sep 17 00:00:00 2001
From: Bob Smith <bob.smith@gmail.com>
Date: Fri, 01 May 2020 13:48:44 -0400
Subject: [PATCH] <subsystem>: <Short meaningful description>
This is my first patch! <Extend description>
Signed-off-by: Bob Smith <bob.smith@gmail.com
<patch diff here>
Now you’re all done, yay! You’ve now become a contributor to the most complicated project in the world. However, if you have any queries related to the guide, start a chat with our experts at QuickStart. We also offer Linux developer certification that improves skills and gives insights!
Good luck!