TUTORIALS 》 How to submit your Linux Kernel Patch

If you are a newbie or even an experienced programmer you might have stumbled at kernel newbies page which is heaven for all those who are willing to involve in Linux kernel development. Today I'm writing about linux kernel patch Philosophy. Oh yes, You are right submitting kernel patches is none less than a Philosophy.

In fact there is a good post about Patch Philosophy.

It is more about Linux development culture which follows certain rules and norms for the patch and if you are newbie you better follow this culture to make your life easier.

Scared or Worried? Don't worry. Rule of the game is:

  • be patient
  • read blogs written by various developers to get the bigger picture
  • ask your queries on kernelnewbies mailing list. But again do your research first. That will help you a lot.

Kernel maintainers stay very busy and receive many patches in a single day. Obviously you won't like to make bad impression by sending wrong/invalid patches. Here wrong/invalid has huge meaning. I'll try to state all those:

* patch which is not tested
> Never send a patch which is not built successfully.

* patch built(compiled) against wrong wrong tree or outdated tree.
> Newbies are most prone to do these mistakes.

* why should you bother about these trees?
> It might happen that the patch which you are sending is already been sent by someone else and thus your patch would be of no use.
> And It may happen the maintainer won't reply for such obsolete patch.

* which git tree to use ?
> Always use linux-next tree unless and until it is explicitly mentioned to use other trees.
> Sometimes we might need to work against different trees of different subsystems. Again always choose trees ending -next*.

For more details about -next* kindly read this document.
* Never send patch or patch-set with exactly same commit header or similar commit.
> Commit header lets the other developers what changes has been made in two or more constructive commits. For example:

[PATCH 1/3] dgnc: Fix the Z
[PATCH 2/3] dgnc: Fix the Z
[PATCH 3/3] dgnc: Fix the Z

or say for example:
[PATCH 1/3] dgnc: Fix the Z
[PATCH 2/3] dgnc: Z is fixed

*So what is the right way?
> Whenever you get stuck in such a situation where you are fixing same thing but in different files of same subsystem or driver then always try to send all the changes in a single patch instead of sending different patches with same or similar commit header.

Last but not least, after building and testing always check you patch with following scripts checkpatch.pl which is present in your kernel source tree scripts/checptach.pl

Here is an example where I've tested a patch named 0001-qed-Replace-memset-with-eth_zero_addr.patch

mystictot (my-1016) linux-tree $ ./scripts/checkpatch.pl 0001-qed-Replace-memset-with-eth_zero_addr.patch 
total: 0 errors, 0 warnings, 0 checks, 33 lines checked

0001-qed-Replace-memset-with-eth_zero_addr.patch has no obvious style problems and is ready for submission.

So, if you get the same output as has no obvious style problems and is ready for submission, then everything is good with your patch. Now, you are all set to send your patch.

All the best ;)

For example here are my Kernel submission log screenshots:
Link: http://git.netfilter.org/iptables/log/?qt=grep&q=shyam+saini
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions


Featured Video:

Suggested Topics:

☆ Tutorials :: Arduino UNO Projects ↗

☆ Tutorials :: Network Software Development ↗

☆ Tutorials :: Research and Projects ↗

☆ Tutorials :: Linux (user-space), Systems Architecture ↗

☆ Tutorials :: Linux Kernel Software Development ↗

☆ Tutorials :: Linux Kernel Internals (PDFs) - by Ramin Farajpour ↗

☆ Tutorials :: Software Development (Programming) Tools ↗

☆ Tutorials :: Embedded Projects ↗

Join The Linux Channel :: Facebook Group ↗

Visit The Linux Channel :: on Youtube ↗

💗 Help shape the future: Sponsor/Donate

Recommended Topics:
Featured Video:
Watch on Youtube - x20f Code with Kiran - Live Coding | Linux Kernel Programming | Kernel Libraries | Part 1 ↗

Multi-Client TCP Server with pthreads Mutex Synchronized - Code-walk of viewer code - Sekhar Pariga ↗
Monday' 28-Sep-2020
Here is a code-walk of a git-hub source submitted by a viewer Sekhar Pariga, which is a Multi-client TCP Server with pthreads Mutex synchronized. Basically it is a Directory Listing Server, that serves ls, cd, pwd of directory functions to connecting TCP clients which are remotely (locally) executed by the server. Server is implemented using multi-thread pthread library, to serve multiple clients simultaneously. Server keeps the each accepted client session details in the queue data structure. Client session queue contains each clients socket-fd and present working directory as a queue node.

Adding your own Kernel Modules into Linux Kernel Source | Linux Kernel Programming ↗
Monday' 28-Sep-2020
Whenever you do custom kernel modules, you can optionally make it a part of existing Linux Kernel source. This does not mean you are submitting your kernel module to the mainline kernel source (i.e kernel.org Linux Kernel Foundation). What I meant is, you can make your kernel module(s) part of Linux Kernel source so that when you compile your kernel you can automatically compile your kernel module(s) too. As well when you create/modify kernel .config configuration file (such as via make menuconfig, etc), you can enable or disable your kernel module(s) too.
To do the same you have to register (and include) your custom Kernel Module's Kconfig and Makefile to the existing Kconfig and Makefile of the Linux Kernel source Here is a detailed multi-episode video of mine which gives the overall idea and the big-picture.

Roadmap - How to become Linux Kernel Developer - Device Drivers Programmer and a Systems Software Expert ↗
Monday' 28-Sep-2020
Many viewers and even sometimes my students ask me how I can become a kernel programmer or just device driver developer and so on. So I shot this video (and an add-on video) where I summarized steps and a roadmap to become a full-fledged Linux Kernel Developer.

Weekly News Digest - Week 03 - July 2020 ↗
Monday' 28-Sep-2020
The Linux Channel :: Weekly News Digest - Week 03 - July 2020
> Linux founder tells Intel to stop inventing 'magic instructions' and 'start fixing real problems'
> QNAP launches its first 2.5GbE network switch - QSW-1105-5T
> Japan's ARM-based Fugaku is the world's fastest supercomputer
> FreeBSD Back To Seeing Progress On 802.11ac WiFi Support, Ath10k Driver
> Sparkfun Launches the ZED-F9R GPS Dead Reckoning Raspberry Pi pHAT for Mobile Robots
> ODROID-N2 Plus SBC Gets Amlogic S922X Rev. C Processor Clocked at up to 2.4 GHz
> Rock Pi E SBC Comes with WiFi, Bluetooth, Two Ethernet Ports, and Optional PoE

Nmap Network Scanning ↗
Monday' 28-Sep-2020

IP-in-IP Tunneling Demystified - VPN Tunnels ↗
Monday' 28-Sep-2020
There can be many ways one can architect VPN Networks. The end objective is to tunnel private IP (typically LAN subnets) within public IP Networks (such as Internet). You can establish such a tunnel in various creative ways, such as Transport Mode, Tunnel Mode, IP-in-IP tunneling, etc. Also you can choose any transport layer protocol of your choice such as send VPN traffic via TCP, or via UDP and so on.

PHP installation ↗
Monday' 28-Sep-2020

Slow RGB Fade via Arduino UNO ↗
Monday' 28-Sep-2020

Management ↗
Monday' 28-Sep-2020

Layer-2 (L2) Multicast Frame Deep Analysis ↗
Monday' 28-Sep-2020

Trending Video:
Watch on Youtube - x20f Code with Kiran - Live Coding | Linux Kernel Programming | Kernel Libraries | Part 1 ↗

Linux Kernel Programming - Device Drivers ↗
Monday' 28-Sep-2020
Watch detailed videos and read topics on Linux Kernel Programming - Device Drivers

Recommended Video:
Watch on Youtube - x20f Code with Kiran - Live Coding | Linux Kernel Programming | Kernel Libraries | Part 1 ↗