There are two ways Linux kernel modules are built: 1. as a part of kernel executable binary (compressed image) i.e. with CONFIG_*=y
options at build time, or 2. as separate kernel object (.ko
) files that can be loaded and unloaded with some conditions i.e. built with CONFIG_*=m
options.
In second case the .ko
files are placed on some standard location(s), usually /lib/modules/
on Linux and its equivalent on Android /system/lib/modules/
or /vendor/lib/modules/
. These paths are hard-coded in binaries that load them e.g. insmod
, modprobe
.
On pre-Pie releases (1), by-default Android kernel is built without option CONFIG_MODULES=y
, so there are no kernel modules built as .ko
files which can be loaded or unloaded with insmod
, modprobe
or rmmod
as is the case with standard Linux distros. Nor they are exposed through /proc/modules
from where lsmod
reads information. However each kernel component that can be built as a module has an entry in /sys/module
.
Now those modules which are compiled and loaded as .ko
file has a corresponding /sys/module/<module>/initstate
file, others don't have. You can confirm this way if there are any loaded modules:
~$ ls /sys/module/*/initstate