FreeBSD 9.1: HowTo Load a Kernel Module

Posted on in Categories , , last updated July 29, 2013

I am a new FreeBSD Unix users. I am using FreeBSD version 9.1 and how do I load a kernel module called drm using command line option?

You need to use the kldload command. It loads file.ko (kernel module or device drive) into the kernel using the kernel linker. The syntax is:

kldload module-name

OR

kldload module-name-1 module-name-2

OR

kldload [option] module-name

Please note that if multiple modules are specified then an attempt will be made to load them all, even if some fail. The .ko extension name is not mandatory when loading a given module using kldload. It does not hurt to specify it though.

/boot/kernel directory

/boot/kernel# ls -l /boot/kernel/
# ls -l /boot/kernel/ | more

Examples

Open a terminal or login using ssh. You must login as root user:
# kldload foo
# kldload drm

To load by file name within the module path:
# kldload drm.ko
To load by relative path in the current dir:
# kldload ./name.ko
To load by full path:
# kldload /boot/kernel/drm.ko
To see all loaded modules, enter:
# kldstat
To remove or unload module, enter:
# kldunload drm

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Leave a Comment