summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjerome <jerome@xlinfo.fr>2025-07-19 22:26:16 +0200
committerjerome <jerome@xlinfo.fr>2025-07-19 22:26:16 +0200
commit2e422b03a5f321e490fc8592ef7abc7d1d48eaad (patch)
tree4e10e37fd19b3a7e6f9296bdf8228fd2d3da5188
downloadkernmodule-2e422b03a5f321e490fc8592ef7abc7d1d48eaad.tar.gz
kernmodule-2e422b03a5f321e490fc8592ef7abc7d1d48eaad.zip
commit initalHEADmaster
-rw-r--r--Makefile7
-rw-r--r--hello.c21
2 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..87d1bde
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,7 @@
+obj-m += hello.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/hello.c b/hello.c
new file mode 100644
index 0000000..f5f4ecc
--- /dev/null
+++ b/hello.c
@@ -0,0 +1,21 @@
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Sachith Muhandiram");
+MODULE_DESCRIPTION("Simple first Linux module");
+MODULE_VERSION("1.0.0");
+
+
+static int __init initHelloWorld(void){
+ printk(KERN_INFO "Hello, this is my first kernel module \n");
+ return 0;
+}
+
+static void __exit exitHelloWorld(void){
+ printk(KERN_INFO "Exit Hello world module\n");
+}
+
+module_init(initHelloWorld);
+module_exit(exitHelloWorld);