2005-02-25 15:27:45

by P.Manohar

[permalink] [raw]
Subject: Invalid module format in Fedora core2


Hai all,
I tried to insert a sample module into Fedora core 2 , But it is giving
an error message that " no module in the object"
The same module was inserted successfully into Redhat linux 9.

Is there any changes from RH 9 to Fedora Core 2 with respect to the module
writing and insertion.

Any small help also welcome.

Thanks in advance.
Regards,
Manohar.





2005-02-25 15:36:38

by Arjan van de Ven

[permalink] [raw]
Subject: Re: Invalid module format in Fedora core2

On Fri, 2005-02-25 at 20:57 +0530, Payasam Manohar wrote:
> Hai all,
> I tried to insert a sample module into Fedora core 2 , But it is giving
> an error message that " no module in the object"
> The same module was inserted successfully into Redhat linux 9.
>
> Is there any changes from RH 9 to Fedora Core 2 with respect to the module
> writing and insertion.

yes; 2.6 has a new module system. It sounds like you're not building
your module correctly, look in the Documentation/ directory for more
information on how to build modules for 2.6 kernels



2005-02-25 15:43:40

by Christian Borntraeger

[permalink] [raw]
Subject: Re: Invalid module format in Fedora core2

Payasam Manohar wrote:
> Hai all,
> I tried to insert a sample module into Fedora core 2 , But it is
> giving an error message that " no module in the object"
> The same module was inserted successfully into Redhat linux 9.
>
> Is there any changes from RH 9 to Fedora Core 2 with respect to the
> module writing and insertion.
>
> Any small help also welcome.

Well, the most important difference is probably the move from Linux kernel
2.4 to Linux kernel 2.6.

See http://lwn.net/Articles/driver-porting/ for details how to change
modules from 2.4 to 2.6 (If source code is available).

cheers

Christian

2005-02-25 15:57:53

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: Invalid module format in Fedora core2

On Fri, 25 Feb 2005, Payasam Manohar wrote:

>
> Hai all,
> I tried to insert a sample module into Fedora core 2 , But it is giving an
> error message that " no module in the object"
> The same module was inserted successfully into Redhat linux 9.
>
> Is there any changes from RH 9 to Fedora Core 2 with respect to the module
> writing and insertion.
>

Yes. Fedora Core 2 should have the new module tools. It also has
a new kernel. These new kernels load a module called "module.ko"
instead of "module.o". Inside the new module is some code used
to obfuscate the new module mechanism where 'insmod' and friends
has been moved inside the kernel, further bloating the kernel
and, incidentally, making it necessary for modules to be
"politically correct", i.e., policy moved into the kernel.

Whoever did this disastrous and destructive thing now wants
you to write modules in a certain "politically correct" way,
also. This means that you need to use the kernel source
Makefile.

There are new books that you are supposed to buy which will
tell you how to re-write all your modules to interface with
the new crap.

I attached a typical makefile so you can see how complicated
this new crap is.

In the meantime, you can just take this and link it with your
"module.o" to make a "module.ko".

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// This program may be distributed under the GNU Public License
// version 2, as published by the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330 Boston, MA, 02111.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// This is the junk that needs to be linked with module code so
// it can be loaded by the new in-kernel module loader. It has no
// purpose except to make the kernel loader happy.
//
// This is a totally artificial mechanism used to prevent one
// from making a module that can work over several different
// kernel versions.
//
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
#define DEREF(x) (#x)
#define MKSTR(x) DEREF(x)
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __attribute__((section(".gnu.linkonce.this_module")))
__this_module = {
.name = MKSTR(MODNAME),
.init = init_module,
.exit = cleanup_module,
};
#ifdef REQUIRES_OTHER_MODULES
static const char __attribute_used__ __attribute__((section(".modinfo")))
__module_depends[]="depends=other_modules";
#else
static const char __attribute_used__ __attribute__((section(".modinfo")))
__module_depends[]="depends=";
#endif

> Any small help also welcome.
>
> Thanks in advance.
> Regards,
> Manohar.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.


Attachments:
zzz (2.64 kB)

2005-02-25 16:53:39

by Horst H. von Brand

[permalink] [raw]
Subject: Re: Invalid module format in Fedora core2

linux-os <[email protected]> said:
> On Fri, 25 Feb 2005, Payasam Manohar wrote:
> > I tried to insert a sample module into Fedora core 2 , But it is giving
> > an error message that " no module in the object"
> > The same module was inserted successfully into Redhat linux 9.

> > Is there any changes from RH 9 to Fedora Core 2 with respect to the module
> > writing and insertion.

> Yes. Fedora Core 2 should have the new module tools. It also has
> a new kernel. These new kernels load a module called "module.ko"
> instead of "module.o".

Right up to here.

> Inside the new module is some code used
> to obfuscate the new module mechanism where 'insmod' and friends
> has been moved inside the kernel, further bloating the kernel

AFAIR, the resulting code in-kernel is even smaller than before, and diong
it in-kernel is the only sane way to avoid all kinds of nasty races.

> and, incidentally, making it necessary for modules to be
> "politically correct", i.e., policy moved into the kernel.

Is this FUD really necesary?
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513

2005-02-27 03:11:02

by P.Manohar

[permalink] [raw]
Subject: Re: Invalid module format in Fedora core2


hai sam,
thanks for ur valuable info reg. 2.6 module insertion.




Thanks&Regards,

P.Manohar,
n Fri, 25 Feb 2005, it was written:

>>
>> There are new books that you are supposed to buy which will
>> tell you how to re-write all your modules to interface with
>> the new crap.
> Whats wrong with the free articles at lwn.net?
>
>>
>> I attached a typical makefile so you can see how complicated
>> this new crap is.
> This is utterly crap.
>
> There is no difference in the Makefile being in-kernel or for an
> external module if the Makefile is used solely to specify content of the
> Module.
>
> So for a sample module named mymodule you need:
>
> Makefile:
> obj-m := mymodule.o
> mymodule-y := file1.o file2.o file3.o
>
> Here assuming 3 files are needed to build the actual module.
> If you then want some wrapping to make things a bit easier you can add a
> second file:
>
>
> makefile:
> VERS := $(shell uname -r)
> CDIR := $(shell pwd)
>
> all:
> $(MAKE) V=1 -C /usr/src/linux-$(VERS) SUBDIRS=$(CDIR) modules
> strip -x -R .note -R .comment mymodule.ko
>
> And nothing special is needed with respect to vermagic etc. The kernel
> do it for you.
>
> Please keep in mind the original poster did not ask for a method that
> could be used for both 2.4 _and_ 2.6.
>
> Sam
>

2005-02-27 07:37:17

by Robert Hancock

[permalink] [raw]
Subject: Re: Invalid module format in Fedora core2

linux-os wrote:
> I attached a typical makefile so you can see how complicated
> this new crap is.
>
> In the meantime, you can just take this and link it with your
> "module.o" to make a "module.ko".

What is all this stuff for? Unless you are doing some pretty bizarre
things in your module this is far more complex than it needs to be. See:

http://linuxdevices.com/articles/AT4389927951.html

Given your previous posts on this issue I can't help but think you'd be
better off reading how this can be done simply, rather than whining
about the "political correctness" of the build process..