-如何製作patch文件
比如基於kernel做了修改,修改了LCD原始碼,修改前的內容放在資料夾kernel下,修改後的內容放在資料夾kernel_new下,那麼製作patch文件的命令為diff -Naur kernel/ kernel_new/ > zwx-lcd.patch ,產生patch文件zwx-lcd.patch。
這個patch文件是描述文件的路徑信息和將第幾行內容刪除,在第幾行添加內容,刪除用減號,添加用加號~
-如何patch文件
整理自http://linux.byexamples.com/archives/163/how-to-create-patch-file-using-patch-and-diff/
patch --dry-run -p1 -i Tb02.patch
The success output looks like this:
patching file TbApi.cpp
patching file TbApi.h
patching file TbCard.cpp
...
The failure ouptut looks like this:
patching file TbCard.cpp
Hunk #2 FAILED at 585.
1 out of 2 hunks FAILED -- saving rejects to file TbCard.cpp.rej
patching file TbCard.h
Hunk #1 FAILED at 57.
Hunk #2 FAILED at 77.
Hunk #3 succeeded at 83 with fuzz 1 (offset -21 lines).
....
At last, if the dry-run is giving good result, do this and enjoy the compilation.
patch -p1 -i Tb02.patch
沒有留言:
張貼留言