The patch patch command is used
Http://www.cnblogs.com/huanghuang/archive/2011/07/14/2106402.html
Patch commands are used for patching, and patch files are generated using diff
Patch command syntax
Patch [-B [-B Prefix]] [-F] [-l] [-N] [-R] [-S] [-V] [-C |-e |-n] [-D Directory] [-D Define] [-F number] [-I. Patchfile] [-O OutFile] [-P number] [- R Rejectfile] [-X number] [File]
When a patch command fails or refuses to accept patches, it produces a diff file with the same name as the original file, with a suffix of ". Rej".
When using-B, a backup file with the same name as the original file with a suffix of ". Orig" is generated.
Frequently used patch parameters:
-P: Specify the directory level (remove a few levels from the path name) if the patch file contains the path names/CURDS/WHEY/SRC/BLURFL/BLURFL.C
Then:-P 0 uses the full path name-P 1 To remove the leading slash, leaving the CURDS/WHEY/SRC/BLURFL/BLURFL.C. -P 4 Removes the leading slash and the first three directories, leaving the BLURFL/BLURFL.C.
-d:directory change the current directory to the specified directory before hitting the patch
-i:patchfile Specify patch files instead of reading patch information from standard input
-R: Reverse patch, this option is useful in preventing error patching
The generation of patches is typically compared with the diff command for a and B files
diff -nrua a b > C.patch
Such as:
diff -nrua linux-2.6. /makefile linux-2.6. /makefile >c.patchcat c.Patch
---linux-2.6.14/makefile 2008-07-30 16:54:20.000000000 +0800 + + linux-2.6.26/makefile 2008-07-14 05:51:29.000000000 + 0800 @@ -1,8 +1,8 @@ -1,8 = 2 Patchlevel = 6-sublevel = +sublevel = + extraversion =-name=affluent Albatross +nam E = Rotary Wombat # *documentation* # to see a list of typical targets execute ' make help '
---file represents a file that will be patched such as: Linux-2.6.14/makefile + + + file for patch source files such as: Linux-2.6.26/makefile
Application
ls c.Patch linux-2.6. linux-2.6. - CD Linux-2.6. - Patch -P1 < /C.Patch
If you have multiple patches to play, you should pay attention to the order of patching!
Excerpt from: http://blog.ednchina.com/mcu_study/146725/message.aspx
The patch patch command is used