Kernel modules#

Some drivers of the Linux kernel are not loaded automatically, but come as so called kernel modules. SimpleCore™ brings all the necessary tools to work with kernel modules.

Kernel modules currently in use#

To check the kernel modules currently used run

$ lsmod
Module                  Size  Used by
snd_soc_da7213         69632  1
at24                   24576  0
fsl_jr_uio             20480  0
caam_jr               196608  0
caamkeyblob_desc       20480  1 caam_jr
snd_soc_imx_da7213     16384  0
snd_soc_imx_audmux     20480  1 snd_soc_imx_da7213
fuse                  135168  1

List all available kernel modules#

To list all the available kernel modules run

$ find /lib/modules/$(uname -r) -type f -name '*.ko*' | sort
/lib/modules/5.10.35/extra/cryptodev.ko
/lib/modules/5.10.35/extra/devreg.ko
/lib/modules/5.10.35/extra/eapi/eapi_ec.ko
/lib/modules/5.10.35/extra/eapi/eapi_ec_bl.ko
/lib/modules/5.10.35/extra/eapi/eapi_ec_hwm.ko
/lib/modules/5.10.35/extra/eapi/eapi_ec_running_time.ko
/lib/modules/5.10.35/extra/eapi/eapi_ec_wdt.ko
/lib/modules/5.10.35/extra/eapi/eapi_nvram.ko
/lib/modules/5.10.35/extra/i2c_ids_acpi.ko
/lib/modules/5.10.35/extra/i2c_ids_of.ko
/lib/modules/5.10.35/extra/leds-gpio-acpi.ko
/lib/modules/5.10.35/extra/pci2uio.ko
/lib/modules/5.10.35/extra/user-gpios.ko

Information about a kernel module#

To get more information on a specific kernel module run

$ modinfo <path to kernel module>
# or
$ modinfo <kernel module filename>

e.g.

$ modinfo /lib/modules/5.10.35/kernel/net/sched/act_gact.ko
filename:       /lib/modules/5.10.35/kernel/net/sched/act_gact.ko
license:        GPL
description:    Generic Classifier actions
author:         Jamal Hadi Salim(2002-4)
depends:
intree:         Y
name:           act_gact
vermagic:       5.10.35 SMP preempt mod_unload aarch64

Load a kernel module#

To load a kernel module run

$ modprobe <path to kernel module>
# or
$ modprobe <kernel module filename>

e.g.

$ modprobe /lib/modules/5.10.35/kernel/net/sched/act_gact.ko
# or
$ modprobe act_gact

Unload a kernel module#

To unload a running kernel module run

$ rmmod <kernel module filename>

Exit the top session

the kernel module filename can be extracted from Kernel modules currently in use