mirror of
https://github.com/psankar/simplefs.git
synced 2025-07-23 22:15:03 +02:00
Starting with a hello world kernel module
This commit is contained in:
parent
6924003b81
commit
9cbdc4cc9f
8
Makefile
Normal file
8
Makefile
Normal file
@ -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
|
26
simple.c
Normal file
26
simple.c
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* A Simple Filesystem for the Linux Kernel.
|
||||
*
|
||||
* Initial author: Sankar P <sankar.curiosity@gmail.com>
|
||||
* License: Creative Commons Zero License - http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
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");
|
Loading…
x
Reference in New Issue
Block a user