增加 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

@ -1,11 +1,11 @@
obj-m:= \
demochar.o
demochar.o
demochar-objs:= \
demo_char.o
EXTRA_CFLAGS += \
-I$(PWD)
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

View File

@ -1,11 +1,11 @@
obj-m:= \
demomisc.o
demomisc.o
demomisc-objs:= \
demo_misc.o
EXTRA_CFLAGS += \
-I$(PWD)
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

View File

@ -1,11 +1,11 @@
obj-m:= \
demoplatform.o
demoplatform.o
demoplatform-objs:= \
demo_platform.o
EXTRA_CFLAGS += \
-I$(PWD)
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

View File

@ -1,11 +1,11 @@
obj-m:= \
demospi.o
demospi.o
demoplatform-objs:= \
demo_spi.o
EXTRA_CFLAGS += \
-I$(PWD)
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

View File

@ -1,11 +1,11 @@
obj-m:= \
demochar.o
demochar.o
demochar-objs:= \
demo_char.o
EXTRA_CFLAGS += \
-I$(PWD)
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

View File

@ -1,11 +1,11 @@
obj-m:= \
demomisc.o
demomisc.o
demomisc-objs:= \
demo_misc.o
EXTRA_CFLAGS += \
-I$(PWD)
-I$(PWD)
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

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");