can't load own simple module :(

From: NonDeterministic (linuxadmin_at_yandex.ru)
Date: 10/22/05


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


Relevant Pages

  • [patch 4/5] Linux Kernel Markers - Samples
    ... Module example showing how to use the Linux Kernel Markers. ... +# builds the kprobes example kernel modules; ... * See the file COPYING for more details. ... +static int example_init ...
    (Linux-Kernel)
  • [patch 4/5] Linux Kernel Markers - Samples
    ... Module example showing how to use the Linux Kernel Markers. ... +# builds the kprobes example kernel modules; ... * See the file COPYING for more details. ... +static int example_init ...
    (Linux-Kernel)
  • Re: hba
    ... After install the driver the next steps are: ... insmod mptscsish ... 2.- Install the kernel modules for the tape-support: ... > I downloaded a driver from hp web, ...
    (RedHat)
  • Re: Still learning about loading modules
    ... > I just updated the kernel modules from a cd-rom (actually I just ... The Soundblaster kernel module will not load. ... Try modprobe instead of insmod. ... Probably the sb driver needs some ...
    (comp.os.linux.setup)