patch commands for Linux-Alibaba Cloud Developer Community

Transfers from http://blog.csdn.net/maotianwang/article/details/11107083

Follow the steps in this article TO understand the usage of diff & patch. Basically, diff is a fixed method such as "diff -Naur FROM TO"(FROM, TO are variables), then, when using patch, first look at the general content of the patch file, combine the current directory to determine the number of directories to skip, and then apply "patch -pN < patch.file"(N is a variable).

------------------- Summary: single file diff -uN from-file to-file >to-file.patch patch -p0 < to-file.patch patch -RE -p0 < to-file.patch

multiple files: diff -uNr from-docu to-docu &gt;to-docu.patch patch -p1 &lt; to-docu.patch patch -R -p1

-------------------

the application patches the kernel. When creating the cross-compilation toolchain, one step is to patch the kernel. I didn't know it very well at that time, but now it is very clear. Refer to the previous article "establishment of development tool chain based on ARM + Linux Embedded Development". 1. The first step is to decompress, because the released patch files are compressed using gzip. $gunzip **/setup-dir/ patch-2.4.21-rmk1.gz 2, and then go to your kernel source code directory $cd linux-2.4.21 3, patch $patch -p1 <**/**/setup-dir/patch-2.4.21-rmk1 after patching, you need to check whether there are files that refuse execution, that is, check. The existence of the rej file. Run the $find . -name *.rej command to output it to the standard output terminal. The default screen is used. Of course, you can also use redirection to output to a specified file, such as reject. $fine . -name *.rej >reject then you can view the content of reject.

This article is forwarded from wdy198622 51CTO blog, original link: http://blog.51cto.com/weimouren/1754320
Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now