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.
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.
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:
- 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.
patch -p1 < patchfile
and reboot!