This is all about my journey to submit my first kernel patch. Here I have discussed all the important things you must know before you submit your kernel patch and also respond to the feedbacks.
How to check code style before submitting the patch?
Kernel community uses a very different coding style and is a bit different. But, what they have done is that they have created a script to check the coding style before we send the code for review.
For e.g, if you have changed the file - da9062-core.c
In order to run checkpatch.pl, you need to install a few python modules.
Sometimes, I get an error that my pip version is older and I need to upgrade it. The best way to upgrade pip version is to not use sudo command but the following command.
Since python packages are used by Operating system too. If we use sudo then it will interfere with the OS python packages and it might overwrite them. This will lead to system not working. Instead of installing for system we should install for the user.
Another way of installing pip package is
using virtual environment.
How to commit your changes?
One need to sign-off using git commit -s. By signing, you agree with the kernel policies.
How to give git commit message?
Here mfd:da9062 is the file showing drivers/mfd/da9062-core.c
In case, you are not happy about your commit, you can again commit the code using.
How to generate a patch file?
How to add revision history?
Generally the maintainers are quite keen to see the revision history as it helps them to review. It is best to hand modify the file generated from ‘git format-patch” to add the version history to the patch. It is not part of the commit message and should go below the ‘—’ line and above the information regarding the files touched by the patch and the number of changes, so in my case:
How to see maintainers list for the changes you made?
How to apply the patch file?
The patch file can be applied using the command.
How to use git send-email?
Install git-email
How to find the messageID of the email in order to reply.
Please refer to this link. (message id)[https://www.codetwo.com/kb/messageid/]
How to setup the git email client
Setting up an email client
Example to send the patch -
Example to re-send the patch, basically replying on to the email using revised patch.
There is another email client called - mutt, but I won’t suggest using mutt because it needs you to turn off the secure settings from your mail server like “allow less secure apps”
Here is the mutt.rc settings
Setting up your local environment to show the git branch?
This is pretty helpful and it will save your time. After this you don’t have to run ‘git branch’ to know what branch you are working at. Add this line to your bash.rc in order to see what branch you are working in?
Here is the output and you can see that I am onto the warrior branch.
Useful links
This brings an end to this article. It’s a good idea to give back to the open source community like linux kernel.