[实践OK]如何打patch,以及diff和patch的使用

jackxiang 2009-10-11 00:18 | |
glibc_fwrite_warning.patch

到memcache目录下:
[root@localhost memcached-1.4.25]# patch -p0 < glibc_fwrite_warning.patch
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:
--------------------------
|--- memcached-1.4.20/memcached.c.orig  2014-05-11 02:59:58.000000000 -0400
|+++ memcached-1.4.20/memcached.c       2015-01-13 18:05:43.000000000 -0500
--------------------------
File to patch: memcached.c
patching file memcached.c
Hunk #1 succeeded at 1283 (offset 9 lines).

=====================================================



1) diff/patch这对工具在数学上来说,diff是对2个集合求差,patch是求和

diff A B > C 生成A和B的diff文件C

patch A C 给A打上diff文件得到B

patch -R B C B还原为A

2) 内核补丁

生成

diff -uNr linux-2.6.xxx linux-2.6.xxx.1 > diff.patch

升级

cp diff.patch linux-2.6.xxx/.

cd linux-2.6.xxx

patch -p1 < diff.patch

可以参考$(linux_src)/Documentation/applying_patches.txt

还可以参考这一篇:http://www.hzlitai.com.cn/bbs/dispbbs.asp?boardid=28&id=1215

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/2048/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2016-4-20 15:02
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]