FreeBSD: Load Kernel Module at Runtime

by on October 1, 2008 · 0 comments· LAST UPDATED July 29, 2013

in , ,

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

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsFreeBSD
Estimated completion timeLess than a minute
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
OR
# 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.
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as: , , , , , , , , , , , ,

Previous Faq:

Next Faq: