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
Please read this disclaimer carefully before you start to use the service. By using the service, you acknowledge that you have agreed to and accepted the content of this disclaimer in full. You may choose not to use the service if you do not agree to this disclaimer. This document is automatically generated based on public content on the Internet captured by Machine Learning Platform for AI. The copyright of the information in this document, such as web pages, images, and data, belongs to their respective author and publisher. Such automatically generated content does not reflect the views or opinions of Alibaba Cloud. It is your responsibility to determine the legality, accuracy, authenticity, practicality, and completeness of the content. We recommend that you consult a professional if you have any doubt in this regard. Alibaba Cloud accepts no responsibility for any consequences on account of your use of the content without verification. If you have feedback or you find that this document uses some content in which you have rights and interests, please contact us through this link: https://www.alibabacloud.com/campaign/contact-us-feedback. We will handle the matter according to relevant regulations.
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