How to properly backup downstream kernels
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 gitlab.com or github.com. 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 htcdev.com), 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
# 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.)
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.