Linux kernel 2.6.11 and external module error

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

 




I tried to compile a small external module for my amd_64 2.6.11 kernel.
The module code is:
--------------------------ZIP
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>

MODULE_INFO(vermagic,VERMAGIC_STRING);
MODULE_AUTHOR("Sko");
MODULE_DESCRIPTION("NoP");
static int __init demo_init(void) {
                printk("initializing..\n");
                        return 0;
}

static void __exit demo_exit(void) {
                printk("goodbye!\n");
}

module_init(demo_init);
module_exit(demo_exit);
MODULE_LICENSE("GPL");
---------------------------------
and the Makefile I used:
obj-m := ex0.o
#ex0-y :=
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
-----------------------------
I module compiles succesfully but when I try to insmod it I get the following
message at the console:
#insmod -f ./ex0.o
insmod: error inserting 'ex0.o': -1 Invalid module format

and at /var/log/messages the following:
kernel: No module found in object
I use module-init-tools 3.2.2
#modprobe -V
module-init-tools version 3.2.2

Could anyone tell me what am I doing wrong..

Thanks in advance! :)



--
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