public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Invalid module format in Fedora core2
@ 2005-02-25 15:27 Payasam Manohar
  2005-02-25 15:36 ` Arjan van de Ven
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Payasam Manohar @ 2005-02-25 15:27 UTC (permalink / raw)
  To: linux-kernel


  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.





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

* Re: Invalid module format in Fedora core2
  2005-02-25 15:27 Payasam Manohar
@ 2005-02-25 15:36 ` Arjan van de Ven
  2005-02-25 15:42 ` Christian Borntraeger
  2005-02-25 15:53 ` linux-os
  2 siblings, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2005-02-25 15:36 UTC (permalink / raw)
  To: Payasam Manohar; +Cc: linux-kernel

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




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

* Re: Invalid module format in Fedora core2
  2005-02-25 15:27 Payasam Manohar
  2005-02-25 15:36 ` Arjan van de Ven
@ 2005-02-25 15:42 ` Christian Borntraeger
  2005-02-25 15:53 ` linux-os
  2 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2005-02-25 15:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Payasam Manohar

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

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

* Re: Invalid module format in Fedora core2
  2005-02-25 15:27 Payasam Manohar
  2005-02-25 15:36 ` Arjan van de Ven
  2005-02-25 15:42 ` Christian Borntraeger
@ 2005-02-25 15:53 ` linux-os
  2005-02-25 16:49   ` Horst von Brand
       [not found]   ` <20050225205004.GA15773@mars>
  2 siblings, 2 replies; 7+ messages in thread
From: linux-os @ 2005-02-25 15:53 UTC (permalink / raw)
  To: Payasam Manohar; +Cc: Linux kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2907 bytes --]

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.

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2702 bytes --]

#
#
#    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.
#
#    Project Makefile for kernel versions over 6 
#    Created 05-OCT-2004    Richard B. Johnson
#
#    Note that macro "obj" refers to this directory when
#    make is executing from the kernel directory. 
#

%.o:%.S
		as -o $@ $<

VERS := $(shell uname -r)
CDIR := $(shell pwd)
MKNOD = /usr/bin/mknodp
FNAM = HeavyLink
EXTRA_CFLAGS += -DKVER6 -DMAJOR_NR=178 -DMODNAME="\"$(FNAM)"\"

OBJS =	datalink.o	min_size_t.o	license.o	ram_test.o\
	rwcheck.o	seeprom.o	rwreg.o		rnd.o\
	rdtsc.o		dma_buffer.o	ioctltxt.o

all:		chkhdrs 
		@./chkhdrs
		@make V=1 -C /usr/src/linux-$(VERS) SUBDIRS=$(CDIR) modules
		strip -x -R .note -R .comment $(FNAM).ko

obj-m		:= 	$(FNAM).o
$(FNAM)-objs	:=	$(OBJS)
$(obj)/min_size_t.o:	$(obj)/min_size_t.S	$(obj)/Makefile
$(obj)/license.o:	$(obj)/license.c	$(obj)/Makefile
$(obj)/ram_test.o:	$(obj)/ram_test.c	$(obj)/Makefile 
$(obj)/rwcheck.o:	$(obj)/rwcheck.S	$(obj)/Makefile
$(obj)/rwreg.o:		$(obj)/rwreg.S		$(obj)/Makefile
$(obj)/rnd.o:		$(obj)/rnd.S		$(obj)/Makefile
$(obj)/rdtsc.o:		$(obj)/rdtsc.S		$(obj)/Makefile
$(obj)/ioctltxt.o:	$(obj)/ioctltxt.s
$(obj)/datalink.o:	$(obj)/datalink.c	$(obj)/datalink.h\
			$(obj)/config.h		$(obj)/types.h\
			$(obj)/plx.h		$(obj)/dlb.h\
			$(obj)/ver.h		$(obj)/Makefile\
			$(SUBDIRS)/bool.h	$(SUBDIRS)/kver.h
$(obj)/dma_buffer.o:	$(obj)/dma_buffer.c	$(obj)/datalink.h\
			$(obj)/config.h		$(obj)/Makefile\
			$(SUBDIRS)/bool.h
$(obj)/seeprom.o:	$(obj)/seeprom.c	$(obj)/plx.h\
			$(obj)/types.h		$(obj)/Makefile

chkhdrs:	../tools/chkhdrs.c
	gcc -O2 -Wall -o chkhdrs ../tools/chkhdrs.c

$(SUBDIRS)/chktrue:	$(SUBDIRS)/../tools/chktrue.c
	gcc -O2 -Wall -o $(SUBDIRS)/chktrue $(SUBDIRS)/../tools/chktrue.c

$(SUBDIRS)/bool.h:	$(SUBDIRS)/chktrue
	cd $(SUBDIRS) ; $(SUBDIRS)/chktrue

$(SUBDIRS)/mkioctltxt:	$(SUBDIRS)/mkioctltxt.c
	gcc -O2 -Wall -o $(SUBDIRS)/mkioctltxt $(SUBDIRS)/mkioctltxt.c

$(SUBDIRS)/ioctltxt.s:	$(SUBDIRS)/mkioctltxt $(SUBDIRS)/datalink.h
	cd $(SUBDIRS) ; $(SUBDIRS)/mkioctltxt

$(SUBDIRS)/chkver:	$(SUBDIRS)/../tools/chkver.c
	gcc -O2 -Wall -o $(SUBDIRS)/chkver $(SUBDIRS)/../tools/chkver.c

$(SUBDIRS)/kver.h:	$(SUBDIRS)/chkver
	cd $(SUBDIRS) ; $(SUBDIRS)/chkver $(VERS)


install:	install.sh $(MKNOD)
	@sh install.sh install


$(MKNOD):	../tools/mknodp.c
	make -C ../tools

clean:
	rm -rf $(OBJS) $(FNAM).ko $(FNAM).mod.c $(FNAM)*.o \.*.cmd \
chkhdrs \.tmp_versions chktrue bool.h kver.h *.s mkioctltxt chkver
		@sh install.sh clean


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

* Re: Invalid module format in Fedora core2
  2005-02-25 15:53 ` linux-os
@ 2005-02-25 16:49   ` Horst von Brand
       [not found]   ` <20050225205004.GA15773@mars>
  1 sibling, 0 replies; 7+ messages in thread
From: Horst von Brand @ 2005-02-25 16:49 UTC (permalink / raw)
  To: linux-os; +Cc: Payasam Manohar, Linux kernel

linux-os <linux-os@analogic.com> 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

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

* Re: Invalid module format in Fedora core2
       [not found]   ` <20050225205004.GA15773@mars>
@ 2005-02-27  3:11     ` Payasam Manohar
  0 siblings, 0 replies; 7+ messages in thread
From: Payasam Manohar @ 2005-02-27  3:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-os


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
>

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

* Re: Invalid module format in Fedora core2
       [not found] ` <3BQcw-7tO-3@gated-at.bofh.it>
@ 2005-02-27  7:35   ` Robert Hancock
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Hancock @ 2005-02-27  7:35 UTC (permalink / raw)
  To: linux-kernel

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..


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

end of thread, other threads:[~2005-02-27  7:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3BPzY-6Vi-33@gated-at.bofh.it>
     [not found] ` <3BQcw-7tO-3@gated-at.bofh.it>
2005-02-27  7:35   ` Invalid module format in Fedora core2 Robert Hancock
2005-02-25 15:27 Payasam Manohar
2005-02-25 15:36 ` Arjan van de Ven
2005-02-25 15:42 ` Christian Borntraeger
2005-02-25 15:53 ` linux-os
2005-02-25 16:49   ` Horst von Brand
     [not found]   ` <20050225205004.GA15773@mars>
2005-02-27  3:11     ` Payasam Manohar

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