增加 hello_drv.c.

Signed-off-by: chen.yang <chen.yang@yuzhen-iot.com>
This commit is contained in:
chen.yang 2022-03-24 19:37:27 +08:00
parent 24ebbed1f8
commit 963da5ff22
8 changed files with 47 additions and 12 deletions

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