I'm wondering how custom ROMs port new versions of Android (particularly the Linux kernel) to old phones.
As I understand, Linux allows closed source kernel modules. If so, then when the phone manufacturer (say Samsung) came out with its phone (say S2) they only open-sourced the main kernel, but not the modules which deal with the hardware.
Cyanogenmod decides to create a CM version of android (same release number) so they keep the Kernel BAPI the same and just play with userspace code.
Now, five years later, Android uses a new Linux kernel.
CM ports (Say Marshmallow) to an old SII.
How do they port the binary blob kernel modules from Jellybean (the last official release for that phone) to Marshmallow?