How to apply a patch correctly?

8,231

When patching Linux kernel to the next minor version, you should use incremental patch. For your case, you should patch with patch-3.13.7-8.xz. This will patch your kernel source 3.13.7 to 3.13.8.

Share:
8,231

Related videos on Youtube

A. Jain
Author by

A. Jain

Updated on September 18, 2022

Comments

  • A. Jain
    A. Jain almost 2 years

    I am trying to patch a linux 3.13.7 source tree to 3.13.8 using the patch-3.13.8.xz file. Since the patch file is in xz format, I used the following command to apply it while in the source tree:

    unxz -cd ../patch-3.13.8.xz | patch -p1
    

    But I receive:

    Reversed (or previously applied) patch detected!  Assume -R? [n]
    

    I have checked man patch for the -R flag and the description makes no sense to me. Can someone please explain what is going on and what I need to do to fix this?

    • Admin
      Admin about 10 years
      So instead of using unxz -cd ../patch-3.13.8.xz | patch -p1, I can put it in reverse mode with unxz -cd ../patch-3.13.8.xz | patch -p1 -R?
    • Admin
      Admin about 10 years
      Well, no. You should investigate why the patch you are applying has already been applied. It's usually a sign something is wrong.
    • Admin
      Admin about 10 years
      I have tries answering yes to all Reversed (or previously applied) patch detected! Assume -R? [n] questions and yet most seem to succeed, but some fail. I haven't actually compiled the source before in this particular tree so I guess it would be Ok to download the new linux 3.13.8 source tree anyway.
    • Admin
      Admin about 10 years
      Yes, I should have said "why patch thinks the patch has already been applied". Programs can make mistakes.
    • Admin
      Admin about 10 years
      @Shadur Is this flag to be used with the patch command?
    • Admin
      Admin about 10 years
      Yes. Basically, it tells patch to do absolutely everything except actually alter the files, so you can see if the patch goes through cleanly.