A. Patch for Single file:
We take Mkprj.sh.1 and mkprj.sh two files as an example:
[[email protected] tst]# ls
Mkprj.sh.1 mkprj.sh
See the differences between the two files:
[Email protected] tst]# diff mkprj.sh Mkprj.sh.1
20,21c20
< CD $workdir/fornew; mkdir crosstools kernel nfs_root uboot;
< CD $workdir/farsight; mkdir crosstools kernel nfs_root uboot;
---
> CD $workdir/farsight1; mkdir crosstools kernel nfs_root uboot;
23c22
<
---
> CD $workdir/configs2;
1. Make Patch Patches
[[email protected] tst]# diff mkprj.sh mkprj.sh.1 > Mk_patch
2. Patch Patches
[Email protected] tst]# patch mkprj.sh < Mk_patch
Patching file mkprj.sh
Observe two files that are already the same:
[Email protected] tst]# diff mkprj.sh Mkprj.sh.1
3. Uninstall Patch Patches
[Email protected] tst]# patch-r mkprj.sh < Mkpatch
Patching file mkprj.sh
Observing two files, mkprj.sh back to its original appearance.
[Email protected] tst]# diff mkprj.sh Mkprj.sh.1
20,21c20
< CD $workdir/fornew; mkdir crosstools kernel nfs_root uboot;
< CD $workdir/farsight; mkdir crosstools kernel nfs_root uboot;
---
> CD $workdir/farsight1; mkdir crosstools kernel nfs_root uboot;
23c22
<
---
> CD $workdir/configs2;
Second, patch for the directory
How to make patch files for Linux and how to make patcheshttp://blog.csdn.net/zhenwenxian/article/details/8393731
#ls/work/kernel
linux-2.6.22.6 linux-2.6.22.6_jz2440
1. Make Patch Patches
#diff-naur linux-2.6.22.6/linux-2.6.22.6_jz2440/> Linux-2.6.22.6_jz2440.patch
#ls/work/kernel
linux-2.6.22.6 linux-2.6.22.6_jz2440 Linux-2.6.22.6_jz2440.patch
2. Patch Patches
#cd/work/kernel/linux-2.6.22.6
Patch-p1 <. /linux-2.6.22.6_jz2440.patch
3. Remove patch (-R)
Patch- R -p1 <. /linux-2.6.22.6_jz2440.patch
Linux commands: Patch