1
0
Fork 0

Add example kernel module

timestamps
dump_stack() 2018-10-07 10:48:25 +00:00
parent 0e03daf21c
commit 97842d8753
5 changed files with 62 additions and 0 deletions

14
examples/kernel-module/.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
.*.cmd
.tmp_versions
Module.symvers
*.ko
*.mod.c
*.o.d
*.o
modules.order
*.gcno
.#*
GPATH
GRTAGS
GTAGS
.cache.mk

View File

@ -0,0 +1,17 @@
# out-of-tree configuration file
# docs at https://out-of-tree.io
name = "out-of-tree module example"
type = "module"
[[supported_kernels]]
# Can be Ubuntu/CentOS/Debian/etc.
distro_type = "Ubuntu"
# regex for `uname -r`
# See also: regex-golang.appspot.com
release_mask = "4.4.0-70-.*"
# [[supported_kernels]] may be defined unlimited number of times
[[supported_kernels]]
distro_type = "Ubuntu"
# Also you can use only one kernel
release_mask = "4.15.0-29-generic"

View File

@ -0,0 +1,15 @@
# out-of-tree called make with two arguments -- kernel headers path and name
# of target binary that MUST be produced by makefile
# e.g.:
# make KERNEL=/lib/modules/4.8.0-58-generic/build TARGET=hello-world.ko
KERNEL := /lib/modules/$(shell uname -r)/build
TARGET := out-of-tree-module-example
obj-m += $(TARGET).o
$(TARGET)-objs = module.o
all:
make -C $(KERNEL) M=$(PWD) modules
clean:
make -C $(KERNEL) M=$(PWD) clean

View File

@ -0,0 +1,3 @@
# out-of-tree kernel module example
See .out-of-tree.toml

View File

@ -0,0 +1,13 @@
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
return 0;
}
void cleanup_module(void)
{
}
MODULE_LICENSE("GPL");