I just want to insert a module without tainting the kernel.
This is the file test1.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL")
MODULE_AUTHOR("AUTHOR")
MODULE_DESCRIPTION("DESCRIPTION")
static int __init module_hello(void) {
printk(KERN_ALERT "Hello");
return 0;
}
static void __exit module_bye(void) {
printk(KERN_ALERT "Bye");
}
module_init(module_hello);
module_exit(module_bye);
and in the same folder, the file Makefile
, as decribed in kernel.org section 3
ifneq ($(KERNELRELEASE),)
obj-m := test1.o
else
KDIR ?= /lib/modules/`uname -r`/build
default:
$(MAKE) -C $(KDIR) M=$$PWD
endif
Executing make
creates the necessary files correctly, but when I insert it I get the message Loading out-of-tree modules taints kernel
, and I don't get the output of the module_hello
until I remove the module, and after that, if I insert it again I get the message from the module_bye
function, but not the hello one.