How to make Patches

Source: Internet
Author: User

Exercise: Patching Uboot

u-boot-1.1.6.tar.bz2 as source file, Xx-patch as patch file (patch file usually ends with patch)

Steps:

1.tar XVF u-boot-1.1.6.tar.bz2
2.LS;CD U-boot-1.1.6;ls
3. See which file the patch will hit (as described in patch), Vim U-boot-1.1.6_jz2440.patch

Diff-urn u-boot-1.1.6/board/100ask24x0/100ask24x0.c u-boot-1.1.6_jz2440/b oard/100ask24x0/100ask24x0.c---u-boot-1 .1.6/board/100ask24x0/100ask24x0.c 1970-01-01 07:00:00.000000 +0700+++ u-boot-1.1.6_jz2440/board/100ask24x0/100 ASK24X0.C 2010-11-26 12:54:3 7.034090906 +0800

---represents the contents of the original file, + + + represents the modified content, the patch to hit the next line of diff---"U-boot-1.16/board/100ask24x0/100ask24x0.c" inside

1539 @@ -34,6 +34,8 @@ -34,6 declare_global_data_ptr; 1541 1542 #if (Config_commands & cfg_cmd_loadb) 1543 +/* support Xmodem, www.100ask.net */1544 +static ULONG load_s Erial_xmodem (ulong offset); 1545 static ULONG Load_serial_ymodem (ULONG offset); 1546 #endif 1547 1548 @@ -53,355 +55,355 @@ -53,355 #if (config_commands & cfg_cmd_loads) 1550 int do_load_serial (cm d_tbl_t *CMDTP, int flag, int argc, char *argv[])

Line 1539th means starting from 34 lines, a total of 6 lines, (1540,1541,1542,1545,1546,1547) is added with a plus two lines, so starting from 34 lines, a total (8 lines)--(1540-1557), that is, plus 1543, 1544 have the plus sign for these two lines!


4. Check the current directory, PWD, if the current directory is in xx/u-boot-1.1.6

5. Patching: Command: Patch-p1 <. /xx-patch, (parameter-p, because the current directory xx/u-boot-1.1.6, and just look at the file to be patched, so-p is used to ignore the first "/" directory, if you need to enter a level of the directory is-P2, do not ignore the words are directly-p0)

6. Patching completed



How to make Patches

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.