2003-07-22 22:12:59

by yiding_wang

[permalink] [raw]
Subject: 2.5.72 module loading issue

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


2003-07-23 03:02:12

by Randy.Dunlap

[permalink] [raw]
Subject: Re: 2.5.72 module loading issue

On Tue, 22 Jul 2003 16:27:24 -0600 <[email protected]> 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/

2003-07-23 06:14:58

by yiding_wang

[permalink] [raw]
Subject: RE: 2.5.72 module loading issue

Thanks and I will definitely try it!

-----Original Message-----
From: Randy.Dunlap [mailto:[email protected]]
Sent: Tuesday, July 22, 2003 8:15 PM
To: [email protected]
Cc: [email protected]
Subject: Re: 2.5.72 module loading issue


On Tue, 22 Jul 2003 16:27:24 -0600 <[email protected]> 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/

2003-07-24 16:57:11

by yiding_wang

[permalink] [raw]
Subject: RE: 2.5.72 module loading issue

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:[email protected]]
> Sent: Tuesday, July 22, 2003 8:15 PM
> To: [email protected]
> Cc: [email protected]
> Subject: Re: 2.5.72 module loading issue
>
>
> On Tue, 22 Jul 2003 16:27:24 -0600 <[email protected]> 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/

2003-07-24 20:53:43

by Sam Ravnborg

[permalink] [raw]
Subject: Re: 2.5.72 module loading issue

On Thu, Jul 24, 2003 at 11:11:24AM -0600, [email protected] 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

2003-07-24 23:17:09

by Randy.Dunlap

[permalink] [raw]
Subject: Re: 2.5.72 module loading issue

On Thu, 24 Jul 2003 23:08:48 +0200 Sam Ravnborg <[email protected]> wrote:

| On Thu, Jul 24, 2003 at 11:11:24AM -0600, [email protected] 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