From 9cbdc4cc9f29d28468c3b4f947fdec2c52c6368b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sankar=20=E0=AE=9A=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B0?= =?UTF-8?q?=E0=AF=8D?= Date: Sun, 10 Mar 2013 20:25:26 +0530 Subject: [PATCH] Starting with a hello world kernel module --- Makefile | 8 ++++++++ simple.c | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Makefile create mode 100644 simple.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0e14332 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +obj-m := simplefs.o +simplefs-objs := simple.o + +all: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean diff --git a/simple.c b/simple.c new file mode 100644 index 0000000..ae14a66 --- /dev/null +++ b/simple.c @@ -0,0 +1,26 @@ +/* + * A Simple Filesystem for the Linux Kernel. + * + * Initial author: Sankar P + * License: Creative Commons Zero License - http://creativecommons.org/publicdomain/zero/1.0/ + */ + +#include +#include + +static int simplefs_init(void) +{ + printk(KERN_ALERT "Hello World\n"); + return 0; +} + +static void simplefs_exit(void) +{ + printk(KERN_ALERT "Goodbye World\n"); +} + +module_init(simplefs_init); +module_exit(simplefs_exit); + +MODULE_LICENSE("CC0"); +MODULE_AUTHOR("Sankar P");