Build own driver alone

  • In this section, you are going to learn

  • How to build own driver alone

#

Version

Freebsd

14.1.0

  • Execute the below command to build the kernel compilation

test:~$ cd /usr/src/sys/module/mychar/

test:~$ make
  • Check for the module generated in below path

test:~$ ls /usr/obj/usr/src/amd64.amd64/sys/modules/mychar/
mychar.ko
  • Move to the directory and load the module by running below command

test:~$ cd /usr/obj/usr/src/amd64.amd64/sys/modules/mychar/

test:~$ kldload mychar.ko
  • Unload the module from the system by running below command

test:~$ cd /usr/obj/usr/src/amd64.amd64/sys/modules/mychar/

test:~$ kldunload mychar.ko