insmod error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

I compiled a simple module that I have copied from the on-line book "The Linux 
Kernel Module Programming Guide" at http://www.tldp.org/LDP/lkmpg/2.6/html/  
but I am not able to load it with 'insmod'.
It returns the following error:

[root@localhost modules]# insmod hello-2.ko
insmod: error inserting 'hello-2.ko': -1 Invalid module format

I've searched Google but I don't find any solution.

This is the module source:

#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_ALERT */
#include <linux/init.h>         /* Needed for the macros */

static int __init hello_2_init(void)
{
        printk(KERN_ALERT "Hello, world 2\n");
        return 0;
}

static void __exit hello_2_exit(void)
{
        printk(KERN_ALERT "Goodbye, world 2\n");
}

module_init(hello_2_init);
module_exit(hello_2_exit);

The Makefile is (I've compiled with only typing "make"):

KDIR:=/lib/modules/$(shell uname -r)/build

obj-m += hello-1.o
obj-m += hello-2.o
obj-m += hello-3.o

default:
 $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
 $(RM) .*.cmd *.mod.c *.o *.ko -r .tmp*
        
Can any of you help me, please? What am I missing?

Thank you all in advance,

fabio



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux