Open main menu

How to properly backup downstream kernels

Revision as of 07:44, 17 October 2020 by Oturpe (talk | contribs) (→‎When is backup needed?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Since we can't use the mainline kernel for all devices, we need access to the downstream kernel source code. From time to time, such repositories disappear from the web, so it is a good idea to back them up. We want to be able to easily confirm that the backed up kernel has the same source code as the original one, so please follow these steps.

When is backup needed?

Consider the reliability of the kernel source. If there is any chance that the source might disappear, a backup must be taken and used instead of original source. LineageOS repositories are considered a trusted source, backups are not required for them.


Create a backup of the desired kernel to a public source code hosting service, such as or If the original git repository was on the same platform, this is oftentimes as easy as clicking the "fork" button on the original repository.

If there is no git repository available (e.g. if the kernel sources can only be downloaded as zip archive from, then kindly ask in #postmarketOS if somebody can download the sources and mirror them to pmsourcedump for you. If you don't get an answer in the chat, you can also ask in a new issue.

Adjust linux package

  • Make it point to your backup instead of the original URL
  • Change # Source to # Source: backup of https://insert-original-url-here
  • Make sure that you do not change the commit hash! (Under the assumption, that there is no hash collusion, this guarantees that your backup has the same source as the original one.)

Additional patches

If you need to add additional patches on top of the kernel (e.g. to fix the build), create patch files and place them inside the aport directory. This way we can transparently see what has been changed.

See also