mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
readme split
This commit is contained in:
12
hello_host/Makefile
Normal file
12
hello_host/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
obj-m += hello.o
|
||||
ccflags-y := -Wno-declaration-after-statement -std=gnu99
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: hello.ko
|
||||
|
||||
hello.ko: hello.c
|
||||
$(MAKE) -C '/lib/modules/$(shell uname -r)/build' M='$(PWD)' modules
|
||||
|
||||
clean:
|
||||
$(MAKE) -C '/lib/modules/$(shell uname -r)/build' M='$(PWD)' clean
|
||||
3
hello_host/README.md
Normal file
3
hello_host/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Hello host
|
||||
|
||||
Minimal host build system sanity check example.
|
||||
17
hello_host/hello.c
Normal file
17
hello_host/hello.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
static int myinit(void)
|
||||
{
|
||||
pr_info("hello init\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void myexit(void)
|
||||
{
|
||||
pr_info("hello exit\n");
|
||||
}
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
Reference in New Issue
Block a user