I got diff text from lkml how do I patch it into a kernel source? I am using debian

  • Short answer: you patch source code with the patch utility. But once you've done that, configuring and compiling the kernel correctly is a whole other question, and a pretty broad one at that.
    – Celada
    Commented Jul 26, 2014 at 2:15

1 Answer 1


kernel.org has some excellent documentation on Applying Patches to the Linux Kernel.

Essentially, you use the patch command. Once you have acquired the patch (here called patchfile), place it in your build directory and then issue the command:

patch -p <num> < patchfile

where <num> is the number of leading slashes to remove from the filenames contained in the patch to be applied.

So, assuming your patchfile is in the top-level directory of your kernel source, you can apply it with:

patch -p1 -i patchfile

patch also has a helpful --dry-run option which will print out a list of what the command will do, without making any changes to your files: allowing you to fine tune any adjustments prior to committing them.

  • Thanks! I suppose I didn't look hard enough. Sorry for the duplicate!
    – RN_
    Commented Jul 26, 2014 at 14:38

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