взял пример модуля "hello world" c linux.ru.net . вот исходник:
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/module.h> /* Specifically, a module */
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{
printk("Hello, world - this is the kernel speaking\n");
/* If we return a non zero value, it means that
* init_module failed and the kernel module
* can't be loaded */
return 0;
}
/* Cleanup - undid whatever init_module did */
void cleanup_module()
{
printk("Short is the life of a kernel module\n");
}
делаю из терминала insmod hello.o (откомпилил нормально), но ничего в консоль не выводится. может я чего-то не понимаю. каким образом можно запустить init_module программно. разве он не инициализируется при загрузке? при чем по lsmod я его вижу в памяти.
|