Translation(s): English - Italiano

(!) ?Discussion


A patch is a small text document containing a delta of changes between two different versions of a source tree. Patches are created with the `diff' program.

To correctly apply a patch you need to know what base it was generated from and what new version the patch will change the source tree into.

How do I apply a patch?

You apply a patch with the `patch' program. The patch program reads a diff (or patch) file and makes the changes to the source tree described in it.

Patches for the Linux kernel are generated relative to the parent directory holding the kernel source dir. This means that paths to files inside the patch file contain the name of the kernel source dirs it was generated against - since this is unlikely to match the name of the kernel source dir on your local machine (but is often useful info to see what version an otherwise unlabeled patch was generated against) you should change into your kernel source directory and then strip the first element of the path from filenames in the patch file when applying it (the -p1 argument to `patch' does this). To revert a previously applied patch, use the -R argument to patch.

Where can I download the patches?

The patches are available at http://kernel.org/ Most recent patches are linked from the front page, but they also have specific homes. The 2.6.x.y (-stable) and 2.6.x patches live at ftp://ftp.kernel.org/pub/linux/kernel/v2.6/

The -rc (the least experimental) patches live at ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing/

The -git patches live at ftp://ftp.kernel.org/pub/linux/kernel/v2.6/snapshots/

The -mm (the most experimental) kernels live at ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/

Patches are often applied to upstream source as part of debian pacakges, see debian/patches. The list of patches part of Debian is available on sources.debian.net.