(kernel 2.6.9) insmod: -1 Invalid module format
Hi,
I'm new to Linux module dev, I copied a very simple module from a book
(http://lwn.net/Kernel/LDD2/ch02.lwn) and I can't insert it into the kernel.
I found hundreds of bug reports about it on google without any solution. I must be doing something wrong...
/*----------mymodule.c-----------*/
#define MODULE
#include <linux/module.h>
int init_module(void)
{ printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void)
{ printk("<1>Goodbye cruel world\n"); }
/*----------EOF-----------*/
# gcc -c mymodule.c # insmod mymodule.o insmod: error inserting 'mymodule.o': -1 Invalid module format
Thanks a lot
steph
Quoted 16 lines · Stephane Coulombe Bisson
Hi,
I'm new to Linux module dev, I copied a very simple module from a book
(http://lwn.net/Kernel/LDD2/ch02.lwn) and I can't insert it into the kernel.I found hundreds of bug reports about it on google without any solution. I must be doing something wrong...
/*----------mymodule.c-----------*/
#define MODULE
#include <linux/module.h>
intinit_module(void){printk("<1>Hello, world\n"); return 0; } voidcleanup_module(void){printk("<1>Goodbye cruel world\n"); } /*----------EOF-----------*/
Quoted 3 lines
# gcc -c mymodule.c # insmod mymodule.o insmod: error inserting 'mymodule.o': -1 Invalid module format
a. You need to use more than 'gcc -c module.c' to build a module for Linux 2.6.x. See current linux/Documentation/kbuild/*.txt .
b. You load a module file named "mymodule.ko" for Linux 2.6.x, not "mymodule.o".
c. Make sure that you are using current module-init-tools package.
Signature · 1 line
~Randy
Quoted 3 lines · Randy.Dunlap
c. Make sure that you are using current module-init-tools package.
What is module-init-tools current version?
Quoted 7 lines · Stephane Coulombe Bisson
Quoted 2 lines · Randy.Dunlap
c. Make sure that you are using current module-init-tools package.
What is module-init-tools current version?
Looks like 3.1.
See http://www.kernel.org/pub/linux/kernel/people/rusty/modules/
Signature · 1 line
~Randy
Quoted 8 lines · Randy.Dunlap
Quoted 6 lines · Stephane Coulombe Bisson
Quoted 2 lines · Randy.Dunlap
c. Make sure that you are using current module-init-tools package.
Quoted 6 lines
Quoted 1 line
What is module-init-tools current version?
Looks like 3.1.
See http://www.kernel.org/pub/linux/kernel/people/rusty/modules/
I should have also said:
I don't think that's your current problem.
Signature · 1 line
~Randy
Quoted 4 lines · Stephane Coulombe Bisson
Hi,
I'm new to Linux module dev, I copied a very simple module from a book
(http://lwn.net/Kernel/LDD2/ch02.lwn) and I can't insert it into the
Just an FYI, but that book relates to the 2.4 version of the kernel. The next version deals with 2.6, and I think the author hinted it would be available around February.
josh