Patch source code in Linux

Source: Internet
Author: User

1. Generate patches for a single file

Diff-up path1/org. c path2/New. c

This command will generate output similar to the following. You can redirect it to a file, which is a patch.

-U displays the rows (context) before and after the different rows. The default value is three rows before and after the difference. In this way, the patch contains more information.
-P: displays information about the C function of the Code.

 

2. Patch

In the generated patch, the path information contains the name of your Linux source code root directory, but other people's source code root directory may be another name. Therefore, when patching, to enter the root directory of your Linux source code and tell the patch tool, ignore the first directory (parameter-P1) of the path in the patch ).

Patch-P1 <XXX. Patch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.