initial hello

This commit is contained in:
Wolfgang Hottgenroth 2019-09-25 21:18:14 +01:00
commit 3e443344fa
2 changed files with 35 additions and 0 deletions

15
hello/Makefile Normal file
View File

@ -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

20
hello/hello.c Normal file
View File

@ -0,0 +1,20 @@
/*
* $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
*/
#include <linux/init.h>
#include <linux/module.h>
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);