参考文章:
http://www.cnblogs.com/itech/archive/2009/08/19/1549729.html
http://www.ibm.com/developerworks/cn/linux/l-diffp/
一、建立源码包和工作包
[root@opennebula opennebula-dcloud]# ls -l
total 12
drwxrwxr-x 5 root root 4096 Jun 11 21:36 opennebula-4.6.2 #官方源码
drwxr-xr-x. 5 root root 4096 Sep 28 18:03 opennebula-4.6.2-patched #开发工作目录,新的分支
drwxr-xr-x. 3 root root 4096 Sep 23 14:27 scripts
[root@opennebula opennebula-dcloud]#
二、比较修改的源码,并将其制作成patched
diff -uNr opennebula-4.6.2 opennebula-4.6.2-patched > opennebula-4.6.2-patched.patched
三、测试patched
mkdir testpatch
[root@opennebula testpatch]# ls -al
total 12
drwxr-xr-x 3 root root 4096 Oct 10 10:16 .
dr-xr-x---. 41 root root 4096 Oct 10 10:08 ..
drwxr-xr-x 5 root root 4096 Oct 10 10:17 opennebula-4.6.2
[root@opennebula testpatch]# cd opennebula-4.6.2/
[root@opennebula opennebula-4.6.2]# ls #测试补丁目录
include install.sh LICENSE NOTICE opennebula-4.6.2-patched.patched README.md SConstruct share src
[root@opennebula opennebula-4.6.2]#patch -p1 < opennebula-4.6.2-patched.patched #开始打补丁