≡ Menu

FreeBSD: Load Kernel Module at Runtime

How do I load a kernel module at runtime from a shell prompt under FreeBSD UNIX operating systems?

You need to use the kldload utility loads file.ko into the kernel using the kernel linker. /boot/kernel directory containing loadable modules. Modules must have an extension of .ko. The kldload utility exits 0 on success, and >0 if an error occurs.

Example: Load module called foo

Type the command as follows:
# kldload foo
# kldload -v foo
To list loaded module use kldstat as follows:
# kldstat
Some modules such as pf, ipfw, ipf, and others may be automatically loaded at boot time when the corresponding rc.conf statement is used. Modules may also be auto-loaded through their addition to loader.conf file.

kldload command options

From the man page:

     -n      Don't try to load module if already loaded.

     -v      Be more verbose.

     -q      Silence any extraneous warnings.
Share this tutorial on:
{ 0 comments… add one }
Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , ,