• List all loaded kernel modules:
  • kldstat
    

  • Load a module from the command line:
  • kldload <module>
    

    NOTE:
    If the module is in the module search path, then just specifying the module name is ok, otherwise you must include the full path to the module, for example:

    kldload /usr/local/modules/my_module.ko

  • Unload a module from the command line:
  • kldunload <module>
    

  • Load a module at boot time:
  • Add: <module>_load=”YES” in /boot/loader.conf

    For example, to load the module aesni at boot, add the following to /boot/loader.conf:

    aesni_load="YES"
    

  • List the module search path
  • kldconfig -r

  • Change the module search path
  • To make permanent changes, specify the path(s) using module_path in /boot/loader.conf, for example:

    module_path="/boot/kernel;/boot/modules;/usr/local/modules"

    To make changes on-the-fly use kldconfig (changes will be lost on reboot):

    # add path(s) at the end of the list
    kldconfig -m <path> ...
    
    # add path(s) at the beginning of the list
    kldconfig -mi <path> ...
    
    # replace all the paths with the specified path(s)
    kldconfig <path> ...
    
    # remove a path 
    kldconfig -d <path>