linux-postmarketos-qcom: download kernel.org tarball, apply patches on top
Created by: ollieparanoid
As discussed in IRC, it would be nice if we could use the upstream kernel sources and apply few device specific patches on top (until they are mainlined properly), instead of directly downloading a tarball from postmarketOS/linux. (The extra repository is needed for easier collaboration in any case.)
Advantages:
- It's obvious how many patches we are carrying
- It's easier to look at these patches
- No need to download the full Linux source over and over again for each version
I've tried to automatize that step, and so far I've got the following:
#!/bin/sh
# Runs this script inside the linux source folder
# Fake destination folder for now
aport="/tmp/aport"
mkdir -p "$aport"
rm "$aport"/*.patch 2>/dev/null
# Find the most recent common commit
branch_upstream="master"
branch_patched="postmarketos-linux-qcom"
base="$(git merge-base $branch_upstream $branch_patched)"
echo "merge-base: $base"
# Find the related RC tag
tag="$(git describe --match "v*-rc*" --abbrev=0)"
echo "tag: $tag"
# Write patch files
git format-patch -o "$aport" "$tag" "$branch_patched"
But when done that way, it outputs the following and then generates thousands of patch files, because right now the branch is not based off a clean RC version, but the latest commit on master at time of creation:
merge-base: b284d4d5a6785f8cd07eda2646a95782373cd01e
tag: v4.16-rc7
Looking at the branch on GitHub, right now it says:
This branch is 30 commits ahead, 1379 commits behind torvalds:master.
So we should be able to get 30 patch files instead.
I recommend the following to get there:
- Create a new branch
linux-postmarketos-qcom
(instead ofpostmarketos-linux-qcom
which we have right now, the new name will be like the package name of the kernel) - Base that off the latest linux RC version instead of the latest commit on the branch
- Then apply all patches again (and use better commit messages? one has just "stuff")
- Test it on the device
Then I could finish the script above, we could update the APKBUILD and finally delete the old branch.
What do you think about that @bhush9, @opendata26, @MartijnBraam and everyone else interested in linux-postmarketos-qcom
?