mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Insmod failed
@ 2003-01-07 17:08 Michal Sojka
  2003-01-07 17:21 ` Randy.Dunlap
  2003-01-07 17:23 ` Sam Ravnborg
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Sojka @ 2003-01-07 17:08 UTC (permalink / raw)
  To: linux-kernel

Hi,

I'am porting driver for my USB 2.0 device to 2.5 and when I try insmod 
my module I get the following:

Error inserting '/lib/modules/2.5.54/misc/usb-emise.o': -1 Invalid 
module format


I compile my module separate of kernel tree with Makefile similar to 
that in Linux Device Drivers book (Rubini, Corbet). What is the right 
way to compile standalone modules?

module-init-tools version 0.9.7, kenrel 2.5.52,54

objdump -h /lib/modules/2.5.54/misc/usb-emise.o

/lib/modules/2.5.54/misc/usb-emise.o:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
   0 .text         00001b94  00000000  00000000  00000034  2**2
                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
   1 .data         000001c0  00000000  00000000  00001be0  2**5
                   CONTENTS, ALLOC, LOAD, RELOC, DATA
   2 .bss          00000000  00000000  00000000  00001da0  2**2
                   ALLOC
   3 .note         00000014  00000000  00000000  00001da0  2**0
                   CONTENTS, READONLY
   4 .stab         00007bd8  00000000  00000000  00001db4  2**2
                   CONTENTS, RELOC, READONLY, DEBUGGING
   5 .stabstr      0001893f  00000000  00000000  0000998c  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .rodata.str1.32 00000aa0  00000000  00000000  000222e0  2**5
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   7 .rodata.str1.1 00000129  00000000  00000000  00022d80  2**0
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   8 __obsparm     00000080  00000000  00000000  00022ec0  2**5
                   CONTENTS, ALLOC, LOAD, DATA
   9 .rodata       00000004  00000000  00000000  00022f40  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
  10 .init.text    000000c8  00000000  00000000  00022f44  2**2
                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  11 .exit.text    00000098  00000000  00000000  0002300c  2**2
                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  12 .comment      00000037  00000000  00000000  000230a4  2**0
                   CONTENTS, READONLY


Thanks
Michal Sojka


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insmod failed
  2003-01-07 17:08 Insmod failed Michal Sojka
@ 2003-01-07 17:21 ` Randy.Dunlap
  2003-01-07 17:23 ` Sam Ravnborg
  1 sibling, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2003-01-07 17:21 UTC (permalink / raw)
  To: Michal Sojka; +Cc: linux-kernel

| Hi,

On Tue, 7 Jan 2003, Michal Sojka wrote:

| I'am porting driver for my USB 2.0 device to 2.5 and when I try insmod
| my module I get the following:
|
| Error inserting '/lib/modules/2.5.54/misc/usb-emise.o': -1 Invalid
| module format

>From lkml archives:
Add a -DKBUILD_MODNAME="yourname" compile option to one of the files,
the new loader requires a module name section. It should be only set
once for each module.

In addition make sure you're using the new style module_init/module_exit
macros instead of init_module/cleanup_module.

| I compile my module separate of kernel tree with Makefile similar to
| that in Linux Device Drivers book (Rubini, Corbet). What is the right
| way to compile standalone modules?

>From lkml archives:
Try to folllow this reciept [recipe] posted by Kai G.
-------------
Well, you can do

cd my_module
echo "obj-m := my_module.o" > Makefile
vi my_module.c
make -C <path/to/kernel/src> SUBDIRS=$PWD modules

That's not too bad (and basically works for 2.4 as well)
---------------

| module-init-tools version 0.9.7, kenrel 2.5.52,54
|
| objdump -h /lib/modules/2.5.54/misc/usb-emise.o
|
| /lib/modules/2.5.54/misc/usb-emise.o:     file format elf32-i386
|
| Sections:
| Idx Name          Size      VMA       LMA       File off  Algn
|    0 .text         00001b94  00000000  00000000  00000034  2**2
|                    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
|    1 .data         000001c0  00000000  00000000  00001be0  2**5
|                    CONTENTS, ALLOC, LOAD, RELOC, DATA
|    2 .bss          00000000  00000000  00000000  00001da0  2**2
|                    ALLOC
|    3 .note         00000014  00000000  00000000  00001da0  2**0
|                    CONTENTS, READONLY
|    4 .stab         00007bd8  00000000  00000000  00001db4  2**2
|                    CONTENTS, RELOC, READONLY, DEBUGGING
|    5 .stabstr      0001893f  00000000  00000000  0000998c  2**0
|                    CONTENTS, READONLY, DEBUGGING
|    6 .rodata.str1.32 00000aa0  00000000  00000000  000222e0  2**5
|                    CONTENTS, ALLOC, LOAD, READONLY, DATA
|    7 .rodata.str1.1 00000129  00000000  00000000  00022d80  2**0
|                    CONTENTS, ALLOC, LOAD, READONLY, DATA
|    8 __obsparm     00000080  00000000  00000000  00022ec0  2**5
|                    CONTENTS, ALLOC, LOAD, DATA
|    9 .rodata       00000004  00000000  00000000  00022f40  2**2
|                    CONTENTS, ALLOC, LOAD, READONLY, DATA
|   10 .init.text    000000c8  00000000  00000000  00022f44  2**2
|                    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
|   11 .exit.text    00000098  00000000  00000000  0002300c  2**2
|                    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
|   12 .comment      00000037  00000000  00000000  000230a4  2**0
|                    CONTENTS, READONLY

See a pattern here?  :)
-- 
~Randy


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insmod failed
  2003-01-07 17:08 Insmod failed Michal Sojka
  2003-01-07 17:21 ` Randy.Dunlap
@ 2003-01-07 17:23 ` Sam Ravnborg
  1 sibling, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2003-01-07 17:23 UTC (permalink / raw)
  To: Michal Sojka; +Cc: linux-kernel, Kai Germaschewski

On Tue, Jan 07, 2003 at 06:08:21PM +0100, Michal Sojka wrote:
> Hi,
> 
> I'am porting driver for my USB 2.0 device to 2.5 and when I try insmod 
> my module I get the following:
> 
> Error inserting '/lib/modules/2.5.54/misc/usb-emise.o': -1 Invalid 
> module format
> 
> 
> I compile my module separate of kernel tree with Makefile similar to 
> that in Linux Device Drivers book (Rubini, Corbet). What is the right 
> way to compile standalone modules?

Kai posted the following a few weeks ago:
-----
Well, you can do

cd my_module
echo "obj-m := my_module.o" > Makefile
vi my_module.c
make -C <path/to/kernel/src> SUBDIRS=$PWD modules
-----

Let me know if this solves the problem,

	Sam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-07 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07 17:08 Insmod failed Michal Sojka
2003-01-07 17:21 ` Randy.Dunlap
2003-01-07 17:23 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®