Alpine kernel module support: Difference between revisions
Prabuanand (talk | contribs) m (added example) |
Prabuanand (talk | contribs) (added working example with necessary wikilinks and external links) |
||
Line 1: | Line 1: | ||
[https://github.com/jirutka/akms Alpine Kernel Module Support] (AKMS) is | [https://github.com/jirutka/akms Alpine Kernel Module Support] (AKMS) is an Alpine Linux tool that enables building out-of-tree (external) Linux kernel modules from source for each installed kernel on the user’s system in an automated and organized fashion. The concept is to have kernel modules automatically rebuilt when a new kernel version is installed. | ||
AKMS is inspired by [https://github.com/dell/dkms Dynamic Kernel Module Support] (DKMS) used on many Linux distributions. It has been | AKMS is inspired by [https://github.com/dell/dkms Dynamic Kernel Module Support] (DKMS) used on many Linux distributions. It has been implemented with simplicity, reliability, and security in mind. | ||
* Builds are always executed under an unprivileged user inside a sandbox with isolated Mount, IPC, PID, Network, UTS, Cgroup, and User (if possible) namespaces. | |||
Builds are always executed under an unprivileged user inside a sandbox | * Unlike DKMS, you don’t need to have all the dependencies for building modules permanently installed on the system. If some dependencies are missing, they are automatically installed in a disposable overlay over your real root filesystem (using [[OverlayFS]] and [[Bubblewrap|bubblewrap]]). | ||
== Overview == | == Overview == | ||
Line 29: | Line 25: | ||
|} | |} | ||
== | == Installation == | ||
Install the {{pkg|akms}} package as follows:{{Cmd|# apk add akms}} | |||
== Using AKMS == | |||
Install the package related to the required [[#List of out-of-tree kernel module packages|kernel driver]]. For example, if you need driver for '''rtl8812au''' chipset based Wifi USB adapater, then install the package {{pkg|rtl8812au-src}} from [[Repositories#Using testing repository|testing repository]] as follows:{{Cmd|# apk add rtl8812au-src@testing}} | |||
AKMS will get triggered by the above package installation and the kernel modules are built and installed as shown below: {{Cmd|<nowiki># apk add rtl8812au-src@testing | |||
(1/1) Installing rtl8812au-src@testing (5.6.4.2_git20250530-r0) | |||
akms-0.3.0-r0.trigger: Executing script... | |||
akms-0.3.0-r0.trigger: akms: Building module 88XXau/5.6.4.2 for kernel 6.12.49-0-lts | |||
... | |||
akms-0.3.0-r0.trigger: akms: Installing module 88XXau 5.6.4.2 for kernel 6.12.49-0-lts | |||
akms-0.3.0-r0.trigger: akms: Module 88XXau/5.6.4.2 for 6.12.49-0-lts installed successfully | |||
</nowiki>}} | |||
After AKMS builds and installs modules, one may need to [[#Loading kernel modules|load]] them or they may get loaded automatically on reboot. | |||
=== Loading kernel modules === | |||
Find the actual module name first using the command: {{Cmd|$ akms status}} | |||
If the above command doesn't return anything, use the following command: {{Cmd|<nowiki>$ find /lib/modules/$(uname -r) -name "*88XXau*"</nowiki>}} | |||
The output in this case is {{ic|/lib/modules/6.12.49-0-lts/kernel/extra/akms/88XXau.ko.gz}} | |||
To view module information:{{Cmd|$ modinfo 88XXau}} | |||
To verify if a module is loaded:{{Cmd|<nowiki>$ lsmod | grep 88XXau</nowiki>}} | |||
If the module is not loaded, verify again using the above command after loading the module using the command:{{Cmd|# modprobe 88XXau}} | |||
In the rare case, if the out-of-tree kernel module conflicts with built-in kernel driver, they may need to be blacklisted as shown below:{{Cat|/etc/modprobe.d/rtl8192eu.conf|# Blacklist conflicting drivers | |||
blacklist rtl8xxxu}} | |||
=== Kernel upgrades === | |||
Whenever a new kernel version is installed, the Kernel modules are automatically rebuilt and installed by AKMS as shown below: | |||
{{Cmd|<nowiki>... | |||
Running `apk upgrade` at 2025-09-19 20:46:13 | |||
apk-tools 3.0.0_rc5_git20250819-r0, compiled for x86_64. | |||
(1/2) Upgrading linux-lts (6.12.46-r0 -> 6.12.48-r0) | |||
(2/2) Upgrading linux-lts-dev (6.12.46-r0 -> 6.12.48-r0) | |||
busybox-1.37.0-r19.trigger: Executing script... | |||
kmod-34.2-r0.trigger: Executing script... | |||
kernel-hooks-0.2-r1.trigger: Executing script... | |||
kernel-hooks-0.2-r1.trigger: kernel-hooks: executing hook 20-akms.hook (lts, 6.12.48-0, 6.12.46-0) | |||
... | |||
kernel-hooks-0.2-r1.trigger: akms: Module 88XXau/5.6.4.2 for 6.12.48-0-lts installed successfully | |||
</nowiki>}} | |||
== List of out-of-tree kernel module packages == | |||
A number of out-of-tree (external) Linux kernel modules are available in the Alpine Linux package repository. To list all the available kernel driver packages, issue the command:{{Cmd|$ apk search '\-src'}} | |||
Refer {{pkg|*src*}} for the list of all such packages in the package database. | |||
AKMS can be used only for packages related to kernel drivers. Packages like {{pkg|rust-src}}, {{pkg|openjdk*-src}} appearing in the above list are not kernel drivers. | |||
== See also == | == See also == |
Revision as of 11:39, 1 October 2025
Alpine Kernel Module Support (AKMS) is an Alpine Linux tool that enables building out-of-tree (external) Linux kernel modules from source for each installed kernel on the user’s system in an automated and organized fashion. The concept is to have kernel modules automatically rebuilt when a new kernel version is installed.
AKMS is inspired by Dynamic Kernel Module Support (DKMS) used on many Linux distributions. It has been implemented with simplicity, reliability, and security in mind.
- Builds are always executed under an unprivileged user inside a sandbox with isolated Mount, IPC, PID, Network, UTS, Cgroup, and User (if possible) namespaces.
- Unlike DKMS, you don’t need to have all the dependencies for building modules permanently installed on the system. If some dependencies are missing, they are automatically installed in a disposable overlay over your real root filesystem (using OverlayFS and bubblewrap).
Overview
AKMS has following actions with associated options and arguments.
install | Build and install module(s) into /lib/modules, unless already built (or -r is specified) or installed. |
build | Build module(s), unless already built (or -r is specified), without installing them. |
uninstall | Uninstall module(s) from /lib/modules. |
unbuild | Remove built module(s) version(s) from the state directory. |
status | Show status of modules. |
Installation
Install the akms package as follows:
# apk add akms
Using AKMS
Install the package related to the required kernel driver. For example, if you need driver for rtl8812au chipset based Wifi USB adapater, then install the package rtl8812au-src from testing repository as follows:
# apk add rtl8812au-src@testing
AKMS will get triggered by the above package installation and the kernel modules are built and installed as shown below:
# apk add rtl8812au-src@testing (1/1) Installing rtl8812au-src@testing (5.6.4.2_git20250530-r0) akms-0.3.0-r0.trigger: Executing script... akms-0.3.0-r0.trigger: akms: Building module 88XXau/5.6.4.2 for kernel 6.12.49-0-lts ... akms-0.3.0-r0.trigger: akms: Installing module 88XXau 5.6.4.2 for kernel 6.12.49-0-lts akms-0.3.0-r0.trigger: akms: Module 88XXau/5.6.4.2 for 6.12.49-0-lts installed successfully
After AKMS builds and installs modules, one may need to load them or they may get loaded automatically on reboot.
Loading kernel modules
Find the actual module name first using the command:
$ akms status
If the above command doesn't return anything, use the following command:
$ find /lib/modules/$(uname -r) -name "*88XXau*"
The output in this case is /lib/modules/6.12.49-0-lts/kernel/extra/akms/88XXau.ko.gz
To view module information:
$ modinfo 88XXau
To verify if a module is loaded:
$ lsmod | grep 88XXau
If the module is not loaded, verify again using the above command after loading the module using the command:
# modprobe 88XXau
In the rare case, if the out-of-tree kernel module conflicts with built-in kernel driver, they may need to be blacklisted as shown below:
Contents of /etc/modprobe.d/rtl8192eu.conf
Kernel upgrades
Whenever a new kernel version is installed, the Kernel modules are automatically rebuilt and installed by AKMS as shown below:
... Running `apk upgrade` at 2025-09-19 20:46:13 apk-tools 3.0.0_rc5_git20250819-r0, compiled for x86_64. (1/2) Upgrading linux-lts (6.12.46-r0 -> 6.12.48-r0) (2/2) Upgrading linux-lts-dev (6.12.46-r0 -> 6.12.48-r0) busybox-1.37.0-r19.trigger: Executing script... kmod-34.2-r0.trigger: Executing script... kernel-hooks-0.2-r1.trigger: Executing script... kernel-hooks-0.2-r1.trigger: kernel-hooks: executing hook 20-akms.hook (lts, 6.12.48-0, 6.12.46-0) ... kernel-hooks-0.2-r1.trigger: akms: Module 88XXau/5.6.4.2 for 6.12.48-0-lts installed successfully
List of out-of-tree kernel module packages
A number of out-of-tree (external) Linux kernel modules are available in the Alpine Linux package repository. To list all the available kernel driver packages, issue the command:
$ apk search '\-src'
Refer *src* for the list of all such packages in the package database.
AKMS can be used only for packages related to kernel drivers. Packages like rust-src, openjdk*-src appearing in the above list are not kernel drivers.