I am a beginner. I wrote a hello world module (actually copied from the o'Reilly book). the code is:
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "\nHello World");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "\nGood bye");
}
module_init(hello_init);
module_exit(hello_exit);
So when i insert the module, and dmesg nothig would appear. But when i remove it, and then dmesg, i can see
Hello World
Good Bye
/var/log/kern.log
? Which version of Ubuntu is this?grep
to search for text in files such as/var/log/syslog
and outputs ofdmesg
.