patch 制作

Posted vx-cg248805770

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了patch 制作相关的知识,希望对你有一定的参考价值。

1.到dl目录下将需要修改的tar文件拷贝出来(位置随意)
2.解压sudo tar xvf xxxx.tar
3.重命名(xxx.old)
4.再解压一份,并将需要修改的地方对比过来
5.执行下面命令(以ebtables为例):
diff -Naur iptables-1.4.21.old/ iptables-1.4.21/ >> 002-port-trigger.patch

6.将生成的patch文件拷贝到package/ebtables/patches/目录下(以ebtables)为例


如果修改的有拓展部分:eg有了新的定义TCSUPPORT_PON_MAC_FILTER
则在package/ebtables/Makefile下添加:
ifeq ($(CONFIG_ARCADYAN_TARGET_telmex_VR7516RW22-A-TE),y)
TARGET_CFLAGS+= -DTCSUPPORT_PON_MAC_FILTER

endif

注:CONFIG_ARCADYAN_TARGET_telmex_VR7516RW22-A-TE为开发板型号,到.config中寻找

 

打patch的时候如果出现类似如下的错误:

Applying ./patches/601-fix-lanpc-DNS-failure using plaintext:
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:
--------------------------
|--- dnsmasq-nodhcpv6.old/dnsmasq-2.78/src/network.c 2018-08-23 16:05:58.351672998 +0800
|+++ dnsmasq-nodhcpv6/dnsmasq-2.78/src/network.c 2018-08-23 16:08:37.247859547 +0800
--------------------------
No file to patch. Skipping patch.

 

是因为dnsmasq-2.78在package/dnsmasq/Makefile中将他进行编译到dnsmasq-nodhcpv6目录下,我们打patch的时候不能把dnsmasq-nodhcpv6目录拷贝过来,只能拷贝dnsmasq-2.78/目录下的文件,进行比较


diff -Naur dnsmasq-2.78/src/dnsmasq.h dnsmasq-2.78/src/dnsmasq.h >> 601-fix-lanpc-DNS-failure ----指定文件打patch,多个文件就执行多次
diff -Naur dnsmasq-2.78/src/network.c dnsmasq-2.78/src/network.c >> 601-fix-lanpc-DNS-failure

 

以上是关于patch 制作的主要内容,如果未能解决你的问题,请参考以下文章

第九章包

第九章查找

第九章

第九章 常用模块

第九章:IO流

第九章 项目经理