Wednesday, 26 August 2015

Writing Linux Kernel module

  lsmod – List all loaded kernel modules




Sample kernel module

hello_world.c module in 'C'
 


Compiling kernel module
 
make -C /lib/modules/<`uname -r`>/build M=<path_to_hello_world.c file> modules
 
#on successful compilation : hello_world.ko file will be generated

 Adding /inserting module 

 # loading the module
insmod hello_world.ko

# checking whether module is loaded.
dmesg |grep

# checking using lsmod
lsmod | grep hello

No comments:

Post a Comment

Total Pageviews

Popular Posts