This is my first technical blog. So I need lots of suggestions and comments.
As a Linux kernel developer, we come across the terms of applying, creation, review and submission of patches. So here I would like to list down
really simple steps that would help a beginner to understand what a Patch actually is and how it works.
If you happen to check the Documentation present in the Linux Kernel source code, you will find a very beautiful definition of Patch, but I describe
Patch as a simple file that descibes the difference between two source code. You can use diff command to find the difference between two files. Of course,
you can always go for
in order to know the details what diff actually does and the corresponding flags which can be used alongwith.
HOW DOES PATCH WORK?
Lets describe with an example:-
Contents : Hello Kanishka
Contents : Hello Kanishka Dutta
Then when you do diff between the two files :-
Save your Patch to "mynewpatch" file
HOW TO APPLY A NEW PATCH?
As a Linux kernel developer, we come across the terms of applying, creation, review and submission of patches. So here I would like to list down
really simple steps that would help a beginner to understand what a Patch actually is and how it works.
If you happen to check the Documentation present in the Linux Kernel source code, you will find a very beautiful definition of Patch, but I describe
Patch as a simple file that descibes the difference between two source code. You can use diff command to find the difference between two files. Of course,
you can always go for
$ man diffin order to know the details what diff actually does and the corresponding flags which can be used alongwith.
HOW DOES PATCH WORK?
Lets describe with an example:-
$ vim oldfile.txtContents : Hello Kanishka
$ vim newfile.txtContents : Hello Kanishka Dutta
Then when you do diff between the two files :-
$ diff -uNr oldfile.txt newfile.txt
--- oldfile.txt 2011-03-15 18:50:31.771711321 +0530
+++ newfile.txt 2011-03-15 18:50:51.683711409 +0530
@@ -1 +1 @@
-Hello Kanishka
+Hello Kanishka Dutta
Save your Patch to "mynewpatch" file
$ diff -uNr oldfile.txt newfile.txt > mynewpatchHOW TO APPLY A NEW PATCH?
$ patch -p1 < mynewpatch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- oldfile.txt 2011-03-15 18:50:31.771711321 +0530
|+++ newfile.txt 2011-03-15 18:50:51.683711409 +0530
--------------------------
File to patch: oldfile.txt
patching file oldfile.txt