Code while working through the FreeBSD Device Drivers book
README.md

Hello world kernel module #

This is a simple "Hello, World" module for FreeBSD 14.3. It emits a message via printf when it is loaded and another when it is unloaded.

Building #

Just use make:

make

Loading / Unloading #

To load the module, a path is needed (relative is fine). Also, the command needs to be run with elevated privileges.

sudo kldload ./hello_world.ko

To unload, just the module name is needed, but you still need elevated privileges.

sudo kldunload hello_world

The module name is defined in the source file in the moduledata_t struct.