What is the purpose of patches of the linux kernel?

5,790

Solution 1

The purpose is to save lots of traffic.

The Linux tarball is around 75MB, whereas the patches usually just have a few KB.

So if you compile your own kernel, and update to each new minor version the day it is released, instead of redownloading a new 75MB tarball for each minor update, you just download (for example) the main tarball for a given version once and then the patch for the version you actually want. When there is an update you re-use the already downloaded main tarball.

linux-3.14.tar.xz + patch-3.14.{1..n}.xz is below 100MB in total.

linux-3.14.tar.xz + linux-3.14.{1..n}.tar.xz is several times 100MB.

There is no downside to patching, the final result is identical, unless you do something wrong.

Solution 2

These are called "patchset". Patchset are groups of patches that serves the same functionality, are related, or implement a function in steps. These in particular, are the difference between a major revision of the kernel (X.Y) and subsequent minor/maintenance revisions (X.Y.Z) with several proposes:

  • Save space on the servers.
  • Save bandwidth.
  • Being easily applicable and distributable

Remember that those patchsets are incremental. You first have to apply patch .1 before patch .2, and after that you can apply .3.

Share:
5,790

Related videos on Youtube

Eleno
Author by

Eleno

Updated on September 18, 2022

Comments

  • Eleno
    Eleno almost 2 years

    For each Linux kernel version, there is a patch file available for download. For instance, linux-3.12.22 has a corresponding patch-3.12.22.

    What is the purpose of that patch? To always patch the corresponding kernel before compiling it, or to bring a former kernel version up-to-date with the kernel that the patch matches (3.12.22, in this case)?

  • David Richerby
    David Richerby about 10 years
    As written, this doesn't quite answer the question. To be explicit, the purpose of the patch is that applying it to version n-1 of the source "upgrades" it to version n. The advantage is that it saves a lot of traffic, as the answer describes.
  • frostschutz
    frostschutz about 10 years
    I'm not a native speaker. But advantage sounds too weak to me somehow. Saving bandwidth/traffic is important for any server. It has purpose.
  • David Richerby
    David Richerby about 10 years
    The part you didn't answer explicitly is, "To always patch the corresponding kernel before compiling it, or to bring a former kernel version up-to-date with the kernel that the patch matches (3.12.22, in this case)?" patch-3.12.22 is to upgrade from version 3.12.21 to .22, not to be applied to the 3.12.22 sources before compiling them.
  • frostschutz
    frostschutz about 10 years
    Patches are usually for .0, e.g. VERSION = 3 PATCHLEVEL = 12 -SUBLEVEL = 0 +SUBLEVEL = 22. It would be annoying to go through 20 patches...
  • Ruslan
    Ruslan about 10 years
    How would such traffic saving scheme be better than e.g. having a git clone of the repository and doing git pull when a new version gets released?
  • Chan Kim
    Chan Kim over 3 years
    Yes, patch is against the base version. To update 3.12.21 to 3.12.22, you should first reverse-apply patch-3.12.21 to make it 3.12 and then apply patch-3.12.22 to upgrade to 3.12.22.