For example, I need to apply this patch for my Linux source code:http://git.kernel.org/cgit/linux/kernel/git/davem/net.gi t/diff/?id=fe82b3300ec9c0dc4ba871f9a58b265aadf4e186
First, I copy this paragraph to a file in local directory:/usr/src/linux-4.3/patch.file.
"
Diff--git A/net/mpls/mpls_iptunnel.c B/net/mpls/mpls_iptunnel.c
Index 67591AE.. 64afd3d 100644
---a/net/mpls/mpls_iptunnel.c
+ + + b/net/mpls/mpls_iptunnel.c@@ -54,10 +54,10 @@ int mpls_output (struct net *net, struct sock *sk, struct sk_buff *skb) u nsigned int ttl; /* Obtain the TTL */-if (Skb->protocol = = htons (eth_p_ip)) {+if (dst->ops->family = af_inet) {ttl = IP_HDR (SKB) ->ttl; RT = (struct rtable *) dst;-} else if (Skb->protocol = = htons (Eth_p_ipv6)) {+} else if (dst->ops->family = = Af_ine T6) {ttl = IPV6_HDR (SKB)->hop_limit; rt6 = (struct rt6_info *) DST;} else {
"
And then use this command to the patch:
# Patch < Patch.file
And then I got the warning info:
"
Can ' t find file to patch on input line 5
Perhaps should have used the-p or--strip option?
The text leading up to this is:
--------------------------
|diff--git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
|index 67591ae.. 64afd3d 100644
|---a/net/mpls/mpls_iptunnel.c
|+++ B/NET/MPLS/MPLS_IPTUNNEL.C
--------------------------
File to Patch:
"
I ignore the warning and input the file name:net/mpls/mpls_iptunnel.c
And then the patch is applied.
How to apply a patch for Linux source code