View, load, or unload a kernel module
Undertand the difference between a statically compiled kernel and one that uses loadable kernel modules. Be able to view, load and unload kernel modules on each BSD system but should be aware that kernel modules are discouraged on NetBSD and OpenBSD systems.
TODO: Are they really discouraged? Where documented?
Kernel modules provide extra functionality that a system administrator can add to their running kernel. Common examples include audio device drivers, network interfaces, RAID and other hardware drivers, extra filesystems support, packet filtering, binary compatibility support for other operating systems (like Linux), and console screen savers. In most cases, this extra functionality or hardware support can be configured and then built in to your monolithic kernel. But using kernel modules may be more convenient.
On FreeBSD and DragonFly, the kernel module filenames have an
NetBSD and OpenBSD kernel modules end with
On FreeBSD and DraogonFlyBSD, the default kernel modules are located at
On NetBSD and OpenBSD kernel modules are at
/usr/lkm. The generic system in OpenBSD contains no loadable kernel modules.
TODO: list a few common modules TODO: show how to find modules
FreeBSD and DragonFly use
kldstat to load, unload and to view details, respectively.
NetBSD and OpenBSD use the
The following is an example of runninng
kldstat to list modules on a DragonFly system:
""# kldstat ""Id Refs Address Size Name "" 1 5 0xc0100000 5eff14 kernel "" 2 1 0xc06f0000 2b58 ecc.ko "" 3 1 0xc06f3000 591d0 acpi.ko "" 4 1 0xdd68c000 3000 null.ko
The "refs" column shows the number of modules referenced by the kernel object. TODO: The "address" column shows the load address of (the pointer to) the kernel object. The "size" is the size in hexadecimal.
In the above examples, "ecc" is for AMD64 ECC memory controller, "acpi" is for ACPI power management, and "null" provides the mount_null filesystem support.
TODO: explain why the kernel listed
TODO: should this mention -v? maybe not for BSDA?
kldstat(8), kldload(8), kldunload(8), and loader.conf(5); modstat(8), modload(8), modunload(8), and lkm.conf(5)