To create a patch for a given source code, the diff command should be used. And to apply that patch, the patch command takes place. Both should be available on your Linux system.
$ diff -uNr linux-3.16.0 linux-3.16.0-mine > patch-3.16.0-myfeature
Let’s say someone wants to use the patch. This guy, basically, should download the desired source code first (in our case, linux-3.16.0). Then, to apply that patch to the whole directory tree, he/she needs to add ‘-p1’ option to the patch command:
$ cd linux-3.16.0 $ patch -p1 < patch-3.16.0-myfeature
The -p1 option means patchlevel 1.