2

I have a system freeze issue and I found this discusion on github, one of them suggest to add 5 patches:

enter image description here

When I type:

patch p1 < 0001-PM-autocomplet.patch

It asked File to patch, I don't know what to fill. How can I proceed and apply these patches. enter image description here

2
  • 5
    Please don't post images of text.
    – Kaz
    Sep 2, 2016 at 16:01
  • 1
    Do you understand that patches apply to the kernel source code, which you then have to compile to produce a kernel image, which you then have to install properly on the intended target system and reboot into it? You can't just run patch -p1 < patchfile and reboot!
    – Kaz
    Sep 2, 2016 at 17:13

1 Answer 1

4

To apply a patch of this form:

diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 0f65d36..ff59753 100644
--- a/include/linux/pm_qos.h

with patch -p1, several conditions have to be met.

  1. You have to be in the top-level directory of a kernel source tree. The -p1 option will strip one path component from the file names, so that a/include/linux/pm_qos.h will be treated as include/linux/pm_qos.h. This is a relative path which has to resolve from your current working directory.

  2. The file include/linux/pm_qos.h has to exist in the version of the kernel that you're trying to patch.

If 1 and 2 are not met, then patch will not find the file to apply and interactively ask you to supply the path name.

Then of course:

  1. The include/linux/pm_qos.h file has to be "sufficiently similar" to the one from which the patch was produced, otherwise the patch will fail to apply.

The same remarks apply separately to all other files that are mentioned in the patch.

If you're trying to patch a different version of the kernel from the one against which the patch was produced, I'm afraid you're "in over your head"; that requires some level of understanding of kernel development (depending on how complex are the adjustments required in the patch for it to apply).

Sometimes we find that kernel files have just been renamed; a patch will apply fairly cleanly if the files mentioned in it are renamed to the new names. On the opposite end, in the worst cases, you have to actually understand what the patch is doing (possibly by looking at the original kernel where it was made), and then implement the same logic from scratch in the target kernel. In cases of "intermediate difficulty", you just have to deal with issues like variable names, function names and struct member names having been renamed; the patch will apply if it just follows new names.

9
  • I can't understand your explanation, too technical for me. All I want is to patch these patches to the current working kernel, is that possible? Sep 2, 2016 at 16:19
  • If you're following someone's exact steps for patching and they don't work, then considerable technical skill is required to resolve that situation by yourself. From the information available about what went wrong, it is not possible to tell whether the patches can or cannot apply.
    – Kaz
    Sep 2, 2016 at 16:27
  • If you're confused by text like "you have to be in the top-level directory of a kernel source tree", then maybe get someone else to do this task.
    – Kaz
    Sep 2, 2016 at 16:28
  • These patches is for the a wireless driver, the author says in the readme as if apply these patches is quite straightforward... Sep 2, 2016 at 16:31
  • Yeah, that text I can't understand at all. Sep 2, 2016 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .