Added basic kernel module and makefile

This commit is contained in:
elimin8 2021-09-22 17:51:54 +01:00
parent 870bfe72e2
commit f6f4c7cae5
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E
2 changed files with 29 additions and 0 deletions

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
obj-m += king.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

22
king.c Normal file
View File

@ -0,0 +1,22 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Michael Sweet");
MODULE_DESCRIPTION("Universal CUPS printing driver");
MODULE_VERSION("1.0");
static int __init lkm_example_init(void)
{
printk(KERN_INFO "Hello m8s\n");
return 0;
}
static void __exit lkm_example_exit(void)
{
printk(KERN_INFO "Bye m8s\n");
}
module_init(lkm_example_init);
module_exit(lkm_example_exit);