Tutorial by Examples

#include <linux/init.h> #include <linux/module.h> /** * This function is called when the module is first loaded. */ static int __init hello_kernel_init(void) { printk("Hello, World!\n"); return 0; } /** * This function is called when is called if a...
In order to compile the driver, it is necessary to have the Linux Kernel source tree. Assuming the sources are at /lib/modules/<kernel-version>, the following Makefile will compile the file driver.c into the driver.ko Kernel Object obj-m := driver.o KDIR := /lib/modules/$(shell uname -r)/bu...

Page 1 of 1