initial
This commit is contained in:
11
driver/Makefile
Normal file
11
driver/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
obj-m += hello.o
|
||||
|
||||
KDIR := /lib/modules/$(shell uname -r)/build
|
||||
PWD := $(shell pwd)
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) modules
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) clean
|
||||
|
21
driver/hello.c
Normal file
21
driver/hello.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
static int __init hello_init(void) {
|
||||
pr_info("hello: Modul wurde geladen.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit hello_exit(void) {
|
||||
pr_info("hello: Modul wurde entladen.\n");
|
||||
}
|
||||
|
||||
module_init(hello_init);
|
||||
module_exit(hello_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Du");
|
||||
MODULE_DESCRIPTION("Minimales Kernelmodul-Beispiel");
|
||||
MODULE_VERSION("0.1");
|
||||
|
Reference in New Issue
Block a user