Build own driver alone =========================================== .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Learnings in this section ` * :ref:`Version Info ` * :ref:`Steps to build own driver alone ` * :ref:`STEP 1: Follow below link till step 7 ` * :ref:`STEP 2: Compile kernel ` * :ref:`STEP 3: Check the generated module ` * :ref:`STEP 4: Load the module ` * :ref:`STEP 5: Unload the module ` .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step1: .. tab-set:: .. tab-item:: Clean kernel compilation * In this section, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * How to build own driver alone .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step2: .. tab-set:: .. tab-item:: Version Info =============================== ======================================= # Version =============================== ======================================= Freebsd 14.1.0 =============================== ======================================= .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step3: .. tab-set:: .. tab-item:: Steps to build own driver with kernel compilation .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step4: .. tab-set:: .. tab-item:: STEP 1: Follow below link till step 7 :doc:`../build_drv_with_kernel_compilation/build_drv_with_kernel_compilation` .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step5: .. tab-set:: .. tab-item:: STEP 2: Compile kernel * Execute the below command to build the kernel compilation .. code-block:: c test:~$ cd /usr/src/sys/module/mychar/ test:~$ make .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step6: .. tab-set:: .. tab-item:: STEP 3: Check the generated module * Check for the module generated in below path .. code-block:: c test:~$ ls /usr/obj/usr/src/amd64.amd64/sys/modules/mychar/ mychar.ko .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step7: .. tab-set:: .. tab-item:: STEP 4: Load the module * Move to the directory and load the module by running below command .. code-block:: c test:~$ cd /usr/obj/usr/src/amd64.amd64/sys/modules/mychar/ test:~$ kldload mychar.ko .. _FreebsdDeviceDriver_kernel_compilation_build_driver_step8: .. tab-set:: .. tab-item:: STEP 5: Unload the module * Unload the module from the system by running below command .. code-block:: c test:~$ cd /usr/obj/usr/src/amd64.amd64/sys/modules/mychar/ test:~$ kldunload mychar.ko