Out-of-tree kernel modules
Drivers in the Linux kernel can either be built into the kernel, or built as modules that stay on disk and get loaded as needed. The modules that can be generated while building the kernel package are called in-tree (because the source code lives in the kernel source tree). There are also out-of-tree modules, for which the source code is located elsewhere. One popular example is wireguard, which is as time of writing, an out-of-tree kernel module.
These out-of-tree modules must be built against the specific kernel source code, that your target device is using, and this is a challenge on its own. Because there are many different Linux kernel packages that the user could install, especially in postmarketOS where we package a downstream kernel for every non-mainlined device. (But even in Alpine, there are various kernel packages to choose from.)
Alpine doesn't use DKMS
Many Linux distributions use DKMS, they install gcc and build the out-of-tree modules on the user's computer for the user's specific kernel just after that kernel has been installed or updated. Alpine does not use DKMS right now, it goes the route of compiling all out-of-tree modules for all available kernels and offering them as binary packages (e.g. wireguard-vanilla). This is acceptable in Alpine, as there's a low amount of available kernels and out-of-tree modules.
How we had it in postmarketOS
For a short time, we also had the out-of-tree kernel module for wireguard working in postmarketOS. Eventually, this became too much maintenance effort and it was dropped. But for the record, here is how it was done:
- a wireguard-postmarketos-stable package (which worked only with linux-postmarketos-stable)
- a kernel-scripts package, which provides the "kernel scripts" for the right architecture, which are necessary to build the out-of-tree module (note that the
[ "$type" != "application/x-sharedlib" ]bit from the patch had to be updated a few times afterwards, but the PR description explains in detail why the package is needed, that's why there's a link to the original PR.)
If somebody is committed to maintaining this, they could look into reviving it. Since we have so many kernels in postmarketOS, and since it would lower the maintenance burden for out-of-tree modules, maybe consider working together with Alpine to ship DKMS.