增加 hello_drv.c. #10

Merged
lion187 merged 1 commits from dev into master 2022-03-28 08:10:52 +08:00
8 changed files with 47 additions and 12 deletions
Showing only changes of commit 963da5ff22 - Show all commits

View File

@ -0,0 +1,14 @@
obj-m:= \
hellodrv.o
hellodrv-objs:= \
hello_drv.o
EXTRA_CFLAGS += \
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

View File

@ -0,0 +1,21 @@
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "hello driver enter\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "hello driver exit\n ");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("rick.chan");
MODULE_DESCRIPTION("a simple hello world module");
MODULE_ALIAS("a simplest module");