New kernel porting workflow (incl. APKBUILD template, refactor existing device/linux- APKBUILDs)
Created by: ollieparanoid
TODO each major item is for a standalone PR, see below for implementation details. This list is a bit dated now, consider if the changes still make sense or have been implemented in another way already before working on them.
-
pmbootstrap init
: when specifying a new device, ask for confirmation and create default (device-, linux-) packages (base onlinux-lg-mako
for now) -
(documentation, no PR): adjust the porting guide to use that instead of manually copying APKBUILDs -
when we detect the "qcdt" (appended dtb to the boot.img instead of the kernel) in bootimg analyzing, add this and that to the generated linux
APKBUILD (#1125) -
refactor deviceinfo and device-* package template -
Remove external_disk_install
andexternal_disk
, only useexternal_storage
instead (#1301) -
Make all deviceinfo files like the template (changes)
-
-
provides a downstreamkerenl_prepare
function with the easy features from here-
it checks if the pkgver
is3.x.x
-
it removes all -Werror flags from Makefiles (as in linux-ouya-ouya
) -
it runs silentoldconfig with yes -
use downstreamkernel_prepare
in the linux APKBUILD generated bypmbootstrap init
-
-
refactor the whole linux- APKBUILD template (as generated by pmbootstrap init
) based on what is here-
add a wiki page describing everything -
add the shorturl, as used in the APKBUILD
-
-
add additional checks to default_prepare_kernelport
, which depend on the refactoring (and only execute them for the refactored APKBUILDs, add a_templatever=1
variable for that).-
use that version to show when the package uses an outdated template
-
-
put all patches in a shared folder (#542 (closed)) -
implement pmbootstrap autopatch
, which automatically tries to apply each patch to the source, and updates the APKBUILD to include the patches that work with the kernel. -
add a check that finds the busybox binary, and checks if the kernel works for isorec (e.g. own init script) -
do the same thing for qcdt -
refactor all existing device/linux-
packages to use the template
Read on for lots of brainstorming, and please contribute ideas and tell us if something doesn't make sense!
It would be nice if we had modern template somewhere in the code tree for new kernels with the following:
- using abuild's
default_prepare
for applying the patches (like @drebrez did, example) - include commonly used patches by default (fix return address, timeconst fix, msm driver fix). it's much easier to remove patches that do not apply than finding which patch is necessary to fix a specific compilation error.
- using "_commit" instead of "_hash", because "_hash" is confusing
- use .tar.gz (not zip!) sources from LineageOS
- add useful comments everywhere
- in general: throw out everything that we do not need
- use
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
instead of...-Alpine
- Instead of
make olddefconfig
, useyes "" | make olddefconfig
, so the user does not have to accept the defaults manually. (make silentoldconfig
does the same and is better, however this is not available in older kernels) - Do not depend on
postmarketos-mkinitfs
, we already pull that in withpostmarketos-base
- Automatically use
zImage-dtb
if found - Convert the GCC6 header file to a patch file
- patching out -Werror* by default in
prepare()
(as I did for linux-ouya-ouya):
# Remove all -Werror statements
find . -type f -name Makefile -print0 | xargs -0 sed -i 's/-Werror-/-W/g'
find . -type f -name Makefile -print0 | xargs -0 sed -i 's/-Werror//g'
After that is done, we could adjust the existing kernel packages to that new template (in a second PR!).
Edited by Administrator