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 on
- (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
refactor deviceinfo and device-* package template
external_disk, only use
- Make all deviceinfo files like the template (changes)
downstreamkerenl_preparefunction with the easy features from here
it checks if the
it removes all -Werror flags from Makefiles (as in
- it runs silentoldconfig with yes
downstreamkernel_preparein the linux APKBUILD generated by
- it checks if the
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=1variable for that).
- use that version to show when the package uses an outdated template
- put all patches in a shared folder (#542 (moved))
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_preparefor 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
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"instead of
- Instead of
make olddefconfig, use
yes "" | make olddefconfig, so the user does not have to accept the defaults manually. (
make silentoldconfigdoes the same and is better, however this is not available in older kernels)
- Do not depend on
postmarketos-mkinitfs, we already pull that in with
- Automatically use
- 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!).