===== Module compilation Linux =====
Install dependencies:
yum install gcc kernel-devel
Create module source file:
/*
* goku.c - The simplest kernel module.
*/
#include /* Needed by all modules */
#include /* Needed for KERN_INFO */
MODULE_LICENSE("GPL");
int init_module(void)
{
printk(KERN_INFO "Dragon Ball GT...\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goku SSJ4 es la mejor transformacion...\n");
}
Create the make file:
obj-m += goku.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
Compile the module:
make
Test your module:
lsmod|grep goku
sudo insmod goku.ko
lsmod|grep goku
Great!... but what does? Check:
sudo dmesg
You will see in the output:
[ 7347.651869] Dragon Ball GT...
Unload the module:
sudo rmmod hello.ko
lsmod|grep hello
Check:
sudo dmesg
You will see in the output:
[ 7459.206258] Goku SSJ4 es la mejor transformacion...
==== Sources ====
* https://tldp.org/LDP/lkmpg/2.6/html/x121.html
* https://github.com/volatilityfoundation/volatility/pull/813/commits/220f9df1e636f5772ec0f0cd1702ce4e6cfa9849