I am trying to add a device driver for a wifi dongle(specifically rtl8812au) on Ubuntu Core.
Currently I am looking into:
adding the driver to the kernel source, therefore to include it in the kernel snap of the device.
creating a snap that can be added using kernel-module-control plug
I believe compiling the kernel is the most sraight forward way, but will not be able to be modular as the kernel source has to be modified everytime the kernel changes.
I tried looking into the kernel-module-control plug but the documentation of the kernel-module-control plug is pretty much absent.
What would be the best practice for adding a device driver in ubuntu core?
Thank you in advance,
The kernel snap is definitely the better way here (kernel-module-control, while you might be able to make it work, will not care for versions, so your module might go completely out of sync with a kernel snap update)
If it means just enabling or backporting an existing driver of the mainline tree, you should contact the kernel team. @ppisati might be able to point you in the right direction.
Ogra, just to clarify, does that mean that if I use, say, a raspberry pi and want to add a kernel module for an obscure wifi dongle that i found in my basement, the recommended way is to request that the raspberry-pi kernel snap that the whole world uses be modified to contain my kernel module?
In other words, isn’t adding kernel modules to the kernel snap breaking the whole modularity concept of kernel modules? or did you recommend that because in this case he’s using a custom kernel snap? if so, what’s the recommended way when adding kernel modules to an official canonical snap?
Well, how would that module be maintained, get security updates, code updates for potential changes in the kernel api etc… The proper opensource practice is to submit it upstream and have it maintained in the mainline kernel… if that’s not an option you go to the next downstream which would be the ubuntu kernel team… then you indeed have always the option to maintain your own kernel snap (either via local manual update in a hand built image through a brand store etc) and then there is also the kernel-module-control interface that allows you to ship a binary module in a snap and insmod it… but if the kernel abi changes this can explode badly in
your face… so there are plenty of ways, the cleanest is to submit it to the ubuntu tree though (if you can not get it mainline)…
All the other options depend on your use case…
i.e. some of my developer images at https://people.canonical.com/~ogra/snappy use kernels with specific out of tree wlan modules, modified device trees and patches that would break other pieces if not in context with this specific hardware… but these images are not for production use and the kernel snaps are not in the store…