linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: 2.5.72 module loading issue
@ 2003-07-24 17:11 yiding_wang
  2003-07-24 21:08 ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: yiding_wang @ 2003-07-24 17:11 UTC (permalink / raw)
  To: rddunlap, yiding_wang, sam; +Cc: linux-kernel

Hello Randy,

Thanks for the response.  I did not get time to look into this till now.  The way you suggested is to add module build process into kernel build.  This requires a user to build a loadable module with kernel together.  What I really want to is to have module build alone but include kernel symbols and variables so it will not have problem when loading.  The benefit of doing it is to make user and developer easy to change the code and rebuild without experiencing the kernel rebuild process every time.  I read those two documents and they mainly talking about how to build module with kernel together.

In2.4.x, there is a "Rules.make" which has all needed symbols and variables defined.  I just includes that file for my module build and everything works perfectly.  Now in 2.5.x, those structure has been changed and the "rule" files seem to be relocated under "scripts" and being changed too.  I am trying to make use of those "rules" to make module build and load simpler compare with build module with kernel each time.

Any ideas?

thanks and regards,

Eddie

> -----Original Message-----
> From: Randy.Dunlap [mailto:rddunlap@osdl.org]
> Sent: Tuesday, July 22, 2003 8:15 PM
> To: yiding_wang@agilent.com
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: 2.5.72 module loading issue
> 
> 
> On Tue, 22 Jul 2003 16:27:24 -0600 <yiding_wang@agilent.com> wrote:
> 
> | I am still struggling on the fc driver module working on 
> new 2.5.72/2.6 kernel and wish someone can shed some lights here.
> | 
> | The driver is working great for 2.4.x Linux and is modified 
> to reflect all SCSI layer change in 2.5.72.  I have RH9.0 and 
> installed 2.5.72 on the same system.  Driver compiled under 
> 2.5.72 OK.  The module utilities are upgraded to 0.9.13-pre.
> | 
> | Now first problem I have is to module loading fails on 
> "insmod mymodule.o".  Message:
> |  
> | "No module found in object"
> | "Error inserting 'mymodule.o': -1 Invalid module format"
> ...
> | 
> | It looks like something is missing from migrating my driver 
> module from 2.4.x to 2.5.x.
> | 
> | What is new requirement for module building and loading 
> with "insmod" on 2.5.72 compare with the requirement in 2.4.x?  
> 
> Please use the correct makefile for mymodule.
> See linux/Documentation/modules.txt and
>   linux/Documentation/kbuild/makefile.txt.
> In general, it only takes a few lines to build a module that is
> maintained outside of the kernel source tree in 2.5/2.6.
> 
> Here is an example of one that is probably longer than it needs
> to be:
> 
> # makefile for oops_test/dump*.c
> # Randy Dunlap, 2003-03-12
> # usage:
> # cd /path/to/kernel/source && make 
> SUBDIRS=/path/to/source/oops_test/ modules
> 
> CONFIG_OOPS_TEST=m
> 
> obj-m := dump_test.o
> 
> # dump_test-objs := dump_test.o
> 
> clean-files := *.o
> 
> # fini;
> 
> --
> ~Randy
> | http://developer.osdl.org/rddunlap/ | 
http://www.xenotime.net/linux/ |
For Linux-2.6:
http://www.codemonkey.org.uk/post-halloween-2.5.txt
  or http://lwn.net/Articles/39901/
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/

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

* Re: 2.5.72 module loading issue
  2003-07-24 17:11 2.5.72 module loading issue yiding_wang
@ 2003-07-24 21:08 ` Sam Ravnborg
  2003-07-24 23:27   ` Randy.Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2003-07-24 21:08 UTC (permalink / raw)
  To: yiding_wang; +Cc: rddunlap, sam, linux-kernel

On Thu, Jul 24, 2003 at 11:11:24AM -0600, yiding_wang@agilent.com wrote:
> Hello Randy,
> 
> Thanks for the response.  I did not get time to look into this till now.  The way you suggested is to add module build process into kernel build.  This requires a user to build a loadable module with kernel together.  What I really want to is to have module build alone but include kernel symbols and variables so it will not have problem when loading.  The benefit of doing it is to make user and developer easy to change the code and rebuild without experiencing the kernel rebuild process every time.  I read those two documents and they mainly talking about how to build module with kernel together.

Please break your lines - they are very long..

It is well known that building drivers outside the kernel tree is not
supported in 2.6.0-test yet. This is one of the two issues remaining before
kbuild is ready. You will see them present on Andrew Morton's must-fix
list.

> In2.4.x, there is a "Rules.make" which has all needed symbols and variables defined.  I just includes that file for my module build and everything works perfectly.  Now in 2.5.x, those structure has been changed and the "rule" files seem to be relocated under "scripts" and being changed too.  I am trying to make use of those "rules" to make module build and load simpler compare with build module with kernel each time.
> 
> Any ideas?

Wait a little more, and it will be possible to build modules in a clean
way outside the kernel tree.

	Sam

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

* Re: 2.5.72 module loading issue
  2003-07-24 21:08 ` Sam Ravnborg
@ 2003-07-24 23:27   ` Randy.Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy.Dunlap @ 2003-07-24 23:27 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: yiding_wang, linux-kernel

On Thu, 24 Jul 2003 23:08:48 +0200 Sam Ravnborg <sam@ravnborg.org> wrote:

| On Thu, Jul 24, 2003 at 11:11:24AM -0600, yiding_wang@agilent.com wrote:
| > Hello Randy,
| > 
| > Thanks for the response.  I did not get time to look into this till now.  The way you suggested is to add module build process into kernel build.  This requires a user to build a loadable module with kernel together.  What I really want to is to have module build alone but include kernel symbols and variables so it will not have problem when loading.  The benefit of doing it is to make user and developer easy to change the code and rebuild without experiencing the kernel rebuild process every time.  I read those two documents and they mainly talking about how to build module with kernel together.
| 
| Please break your lines - they are very long..
| 
| It is well known that building drivers outside the kernel tree is not
| supported in 2.6.0-test yet. This is one of the two issues remaining before
| kbuild is ready. You will see them present on Andrew Morton's must-fix
| list.
| 
| > In2.4.x, there is a "Rules.make" which has all needed symbols and variables defined.  I just includes that file for my module build and everything works perfectly.  Now in 2.5.x, those structure has been changed and the "rule" files seem to be relocated under "scripts" and being changed too.  I am trying to make use of those "rules" to make module build and load simpler compare with build module with kernel each time.
| > 
| > Any ideas?
| 
| Wait a little more, and it will be possible to build modules in a clean
| way outside the kernel tree.

Yes, my reply was/is that building modules outside of the kernel
tree isn't supported in 2.6.  I didn't know that there were plans
to fix that.

You can find some other kernel module build info at
  http://lwn.net/Articles/21823/

--
~Randy

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

* RE: 2.5.72 module loading issue
@ 2003-07-23  6:29 yiding_wang
  0 siblings, 0 replies; 6+ messages in thread
From: yiding_wang @ 2003-07-23  6:29 UTC (permalink / raw)
  To: rddunlap, yiding_wang; +Cc: linux-kernel

Thanks and I will definitely try it!

-----Original Message-----
From: Randy.Dunlap [mailto:rddunlap@osdl.org]
Sent: Tuesday, July 22, 2003 8:15 PM
To: yiding_wang@agilent.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.5.72 module loading issue


On Tue, 22 Jul 2003 16:27:24 -0600 <yiding_wang@agilent.com> wrote:

| I am still struggling on the fc driver module working on new 2.5.72/2.6 kernel and wish someone can shed some lights here.
| 
| The driver is working great for 2.4.x Linux and is modified to reflect all SCSI layer change in 2.5.72.  I have RH9.0 and installed 2.5.72 on the same system.  Driver compiled under 2.5.72 OK.  The module utilities are upgraded to 0.9.13-pre.
| 
| Now first problem I have is to module loading fails on "insmod mymodule.o".  Message:
|  
| "No module found in object"
| "Error inserting 'mymodule.o': -1 Invalid module format"
...
| 
| It looks like something is missing from migrating my driver module from 2.4.x to 2.5.x.
| 
| What is new requirement for module building and loading with "insmod" on 2.5.72 compare with the requirement in 2.4.x?  

Please use the correct makefile for mymodule.
See linux/Documentation/modules.txt and
  linux/Documentation/kbuild/makefile.txt.
In general, it only takes a few lines to build a module that is
maintained outside of the kernel source tree in 2.5/2.6.

Here is an example of one that is probably longer than it needs
to be:

# makefile for oops_test/dump*.c
# Randy Dunlap, 2003-03-12
# usage:
# cd /path/to/kernel/source && make SUBDIRS=/path/to/source/oops_test/ modules

CONFIG_OOPS_TEST=m

obj-m := dump_test.o

# dump_test-objs := dump_test.o

clean-files := *.o

# fini;

--
~Randy
| http://developer.osdl.org/rddunlap/ | http://www.xenotime.net/linux/ |
For Linux-2.6:
http://www.codemonkey.org.uk/post-halloween-2.5.txt
  or http://lwn.net/Articles/39901/
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/

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

* Re: 2.5.72 module loading issue
  2003-07-22 22:27 yiding_wang
@ 2003-07-23  3:14 ` Randy.Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy.Dunlap @ 2003-07-23  3:14 UTC (permalink / raw)
  To: yiding_wang; +Cc: linux-kernel

On Tue, 22 Jul 2003 16:27:24 -0600 <yiding_wang@agilent.com> wrote:

| I am still struggling on the fc driver module working on new 2.5.72/2.6 kernel and wish someone can shed some lights here.
| 
| The driver is working great for 2.4.x Linux and is modified to reflect all SCSI layer change in 2.5.72.  I have RH9.0 and installed 2.5.72 on the same system.  Driver compiled under 2.5.72 OK.  The module utilities are upgraded to 0.9.13-pre.
| 
| Now first problem I have is to module loading fails on "insmod mymodule.o".  Message:
|  
| "No module found in object"
| "Error inserting 'mymodule.o': -1 Invalid module format"
...
| 
| It looks like something is missing from migrating my driver module from 2.4.x to 2.5.x.
| 
| What is new requirement for module building and loading with "insmod" on 2.5.72 compare with the requirement in 2.4.x?  

Please use the correct makefile for mymodule.
See linux/Documentation/modules.txt and
  linux/Documentation/kbuild/makefile.txt.
In general, it only takes a few lines to build a module that is
maintained outside of the kernel source tree in 2.5/2.6.

Here is an example of one that is probably longer than it needs
to be:

# makefile for oops_test/dump*.c
# Randy Dunlap, 2003-03-12
# usage:
# cd /path/to/kernel/source && make SUBDIRS=/path/to/source/oops_test/ modules

CONFIG_OOPS_TEST=m

obj-m := dump_test.o

# dump_test-objs := dump_test.o

clean-files := *.o

# fini;

--
~Randy
| http://developer.osdl.org/rddunlap/ | http://www.xenotime.net/linux/ |
For Linux-2.6:
http://www.codemonkey.org.uk/post-halloween-2.5.txt
  or http://lwn.net/Articles/39901/
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/

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

* 2.5.72 module loading issue
@ 2003-07-22 22:27 yiding_wang
  2003-07-23  3:14 ` Randy.Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: yiding_wang @ 2003-07-22 22:27 UTC (permalink / raw)
  To: linux-kernel

I am still struggling on the fc driver module working on new 2.5.72/2.6 kernel and wish someone can shed some lights here.

The driver is working great for 2.4.x Linux and is modified to reflect all SCSI layer change in 2.5.72.  I have RH9.0 and installed 2.5.72 on the same system.  Driver compiled under 2.5.72 OK.  The module utilities are upgraded to 0.9.13-pre.

Now first problem I have is to module loading fails on "insmod mymodule.o".  Message:
 
"No module found in object"
"Error inserting 'mymodule.o': -1 Invalid module format"

By checking the trace, following are the failed part: 
... ...
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=49530, ...}) = 0
... ...
brk(0)                                  = 0x804a000
brk(0x804b000)                          = 0x804b000
brk(0)                                  = 0x804b000
create_module(umovestr: Input/output error 0, 0)                     = -1 ENOSYS (Function not implemented)
open("mymodule.o", O_RDONLY)             = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=345047, ...}) = 0
mmap2(NULL, 345047, PROT_READ, MAP_SHARED, 3, 0) = 0x40017000
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - something is wrong here
init_module("ELF", 0x543d7No module found in object) = -1  ENOEXEC (Exec format error))         = -1 ENOEXEC (Exec format error)
... ...
exit_group(1)                           = ?

Noticed that kernel build module has *.mod.c file created, I tried to include those part in but the result is the same.  

This is a SCSI HBA driver and init_module() is not required (ref. to qlogic, adaptec and buslogic drivers).

Also I tried to load kernel build driver module BusLogic.o and qla1280.o with "insmod", it gives error almost the same except the message are different.  
"BusLogic: no version message, tainting kernel"
"Error inserting 'BusLogic.o': -1  No such device

In init_module call, it has init_module("ELF". 0x1a5b4BusLogic" no version magic, tainting kernel.) = -1  ENODEV (No such device).

It looks like something is missing from migrating my driver module from 2.4.x to 2.5.x.

What is new requirement for module building and loading with "insmod" on 2.5.72 compare with the requirement in 2.4.x?  

Many thanks!

Eddie



Also the init_module call 
 

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-24 17:11 2.5.72 module loading issue yiding_wang
2003-07-24 21:08 ` Sam Ravnborg
2003-07-24 23:27   ` Randy.Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2003-07-23  6:29 yiding_wang
2003-07-22 22:27 yiding_wang
2003-07-23  3:14 ` Randy.Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).