Install and Verify the Kernel Module Packages¶
About This Task¶
Once you build the kernel module packages as described in Obtain Driver Source and Build the Kernel Module Packages, you can install them to test and verify operation.
Before You Begin¶
You must have successfully built the kernel driver module packages.
This procedure assumes you are in the parent directory of the cloned hello-world repository.
Procedure¶
Install the kernel driver module packages.
Note
The hello-world-common package includes dependencies for the hello-world package. As a result, you must install it first.
$ dpkg -i hello-world-common_1.0-elxr3-1_amd64.deb $ dpkg -i hello-world_1.0-elxr3-1_amd64.deb
Add the module to the running kernel.
$ modprobe hello-world
Verify the module is running.
$ lsmod |grep hello hello_world 16384 0
In this example, the output reflects the kernel module name and process ID.
To view the message from the printk function for loading the module, run the following command:
$ dmesg |grep Hello [ 730.508395] Hello world!
Optionally remove the kernel driver module and uninstall the packages.
$ rmmod hello-world
To view the message from the printk function for unloading the module, use the same dmesg command:
$ dmesg |grep Hello [ 730.508395] Hello world! [ 1646.374554] Hello world exit!
Optionally uninstall the kernel module packages.
$ dpkg -r hello-world hello-world-common
Results¶
In this tutorial, you have learned how to prepare, build, install, verify, and remove a kernel module in eLxr Server 12.
For more detailed information on working with the kernel, refer to the documentation at Debian Linux Kernel Handbook: Common kernel-related tasks.