Hello World Linux Device Driver Program

Let's in this post write a hello world Linux device driver

Create a hello.c file with the following content in a new folder


Create a Makefile with the following content in the same folder

Command to create a module: make


Command to load module: insmod hello.ko

When you run this command, function specified in module_init will be executed, to check run "dmesg"

Command to remove module: rmmod hello

When you run this command, function specified in module_exit will be executed, verify it by running "dmesg"


Output:



Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PR, PN and PV Variable in Yocto