can't load own simple module :(
From: NonDeterministic (linuxadmin_at_yandex.ru)
Date: 10/22/05
- Next message: nirnimesh_at_gmail.com: "segfault with dlsym(RTLD_NEXT, "func")"
- Previous message: Gromer: "How to hook a context switch??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 22 Oct 2005 12:50:47 +0200
Hello!
Sorry for the newbie question here.
I want to learn how to write kernel modules and started
with a simple module that does nothing except printing
hello world.
It compiles but I can't load it with insmod ./mymodule.ko
# insmod mymodule.ko
insmod: error inserting 'cictest.ko': -1 File exists
this is my Makefile
=====================================================================
obj-m += mymodule.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
=====================================================================
this is my mymodule.c
=====================================================================
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
static int __init init(void)
{
printk(KERN_INFO "Hello, [modulized] world!\n");
return 0;
}
static void __exit fini(void)
{
}
MODULE_ALIAS("mymodule");
module_init(init);
module_exit(fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("mymodule");
=====================================================================
Thanks in advance!
-- [NonDeterministic] aka Ivan G Shevchenko
- Next message: nirnimesh_at_gmail.com: "segfault with dlsym(RTLD_NEXT, "func")"
- Previous message: Gromer: "How to hook a context switch??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|