commit 3e443344fa0c684fc356ac9009abb946c583efa4 Author: Wolfgang Hottgenroth Date: Wed Sep 25 21:18:14 2019 +0100 initial hello diff --git a/hello/Makefile b/hello/Makefile new file mode 100644 index 0000000..5fdf62a --- /dev/null +++ b/hello/Makefile @@ -0,0 +1,15 @@ +ifneq ($(KERNELRELEASE),) + obj-m := hello.o +else + KERNELDIR ?= /usr/src/linux-headers-4.19.66-v7+ + PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules + +.PHONY: clean +clean: + rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order Module.symvers + +endif + diff --git a/hello/hello.c b/hello/hello.c new file mode 100644 index 0000000..18369e9 --- /dev/null +++ b/hello/hello.c @@ -0,0 +1,20 @@ +/* + * $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $ + */ +#include +#include +MODULE_LICENSE("GPL"); + +static int hello_init(void) +{ + printk(KERN_ALERT "Hello, world\n"); + return 0; +} + +static void hello_exit(void) +{ + printk(KERN_ALERT "Goodbye, cruel world\n"); +} + +module_init(hello_init); +module_exit(hello_exit);