mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.6.0-test3 module compilation
@ 2003-08-20 16:39 linuxmodule
  2003-08-20 16:54 ` Randy.Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: linuxmodule @ 2003-08-20 16:39 UTC (permalink / raw)
  To: linux-kernel

I am trying to compile a module on 2.6.0-test3 kernel. The makefile i am using is a pretty normal one : 

CFLAGS = -D__KERNEL__ -DMODULE -I/usr/src/linux-2.6.0-test3/include -O
dummy.o: dummy.c

The module i am trying to compile is taken from the kernel itself (dummy network device driver). The
compilation works flawlessly but when i try to insert the module i get : invalid module format.
What am i doing wrong because i have modutils and module-init and both work, since the same module (dummy)
compiled with the kernel itself can be inserted and removed without the previous error message.
Is there something i should know about the compilation process ? The kernel-compiled module (dummy.ko) has
about 10 Kbytes and dummy.ko compiled by me has only 2 Kbytes :(

Thank you in advance
Snowdog

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

* Re: 2.6.0-test3 module compilation
  2003-08-20 16:39 2.6.0-test3 module compilation linuxmodule
@ 2003-08-20 16:54 ` Randy.Dunlap
  2003-08-20 17:19 ` Richard B. Johnson
  2003-08-20 18:47 ` Sam Ravnborg
  2 siblings, 0 replies; 5+ messages in thread
From: Randy.Dunlap @ 2003-08-20 16:54 UTC (permalink / raw)
  To: linuxmodule; +Cc: linux-kernel

On Wed, 20 Aug 2003 18:39:19 +0200 (CEST) <linuxmodule@altern.org> wrote:

| I am trying to compile a module on 2.6.0-test3 kernel. The makefile i am using is a pretty normal one : 
| 
| CFLAGS = -D__KERNEL__ -DMODULE -I/usr/src/linux-2.6.0-test3/include -O
| dummy.o: dummy.c
| 
| The module i am trying to compile is taken from the kernel itself (dummy network device driver). The
| compilation works flawlessly but when i try to insert the module i get : invalid module format.
| What am i doing wrong because i have modutils and module-init and both work, since the same module (dummy)
| compiled with the kernel itself can be inserted and removed without the previous error message.
| Is there something i should know about the compilation process ? The kernel-compiled module (dummy.ko) has
| about 10 Kbytes and dummy.ko compiled by me has only 2 Kbytes :(

Please wrap lines near 70-72 characters.

Can you try a Makefile and instructions like this?

# makefile for dummy module
# usage:
# cd /path/to/kernel/source && make SUBDIRS=/path/to/source/dummymod/ modules

obj-m := dummy.o

clean-files := *.o


--
~Randy   [MOTD:  Always include kernel version.]
"Everything is relative."

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

* Re: 2.6.0-test3 module compilation
  2003-08-20 16:39 2.6.0-test3 module compilation linuxmodule
  2003-08-20 16:54 ` Randy.Dunlap
@ 2003-08-20 17:19 ` Richard B. Johnson
  2003-08-20 18:47 ` Sam Ravnborg
  2 siblings, 0 replies; 5+ messages in thread
From: Richard B. Johnson @ 2003-08-20 17:19 UTC (permalink / raw)
  To: linuxmodule; +Cc: Linux kernel

On Wed, 20 Aug 2003 linuxmodule@altern.org wrote:

> I am trying to compile a module on 2.6.0-test3 kernel. The makefile i
> am using is a pretty normal one :
>
> CFLAGS = -D__KERNEL__ -DMODULE -I/usr/src/linux-2.6.0-test3/include -O
> dummy.o: dummy.c
>
> The module i am trying to compile is taken from the kernel itself
> (dummy network device driver). The
> compilation works flawlessly but when i try to insert the module i get
> : invalid module format.
> What am i doing wrong because i have modutils and module-init and both
> work, since the same module (dummy)
> compiled with the kernel itself can be inserted and removed
> without the previous error message.
> Is there something i should know about the compilation process ?
> The kernel-compiled module (dummy.ko) has
> about 10 Kbytes and dummy.ko compiled by me has only 2 Kbytes :(
>
> Thank you in advance
> Snowdog

I can't tell how CFLAGS is being used (with the colon???).
Anyway, the correct way to build the module (for 2.4.20) is:

Script started on Wed Aug 20 13:09:15 2003
# gcc -c -o dummy.o -DMODULE -D__KERNEL__ -O2 \
  -I/usr/src/linux-2.4.20/include dummy.c
You have new mail in /var/spool/mail/root

# insmod dummy.o
# lsmod
Module                  Size  Used by
dummy                   1052   0  (unused)
vximsg                  3784   0  (autoclean)
vxidrvr                 1548   0  (autoclean)
st                     29592   0  (autoclean) (unused)
nfs                    47848   0  (autoclean)
lockd                  37244   0  (autoclean) [nfs]
sunrpc                 63228   0  (autoclean) [nfs lockd]
ipchains               41400   7
3c59x                  28224   1  (autoclean)
nls_cp437               4376   4  (autoclean)
isofs                  17232   0  (unused)
loop                    8632   0
sr_mod                 11964   0  (unused)
cdrom                  27936   0  [sr_mod]
BusLogic               35768   7
sd_mod                 10184  14
scsi_mod               54572   4  [st sr_mod BusLogic sd_mod]
# ifconfig dummy0 1.2.3.4
# ifconfig
dummy0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:1.2.3.4  Bcast:1.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0

eth0      Link encap:Ethernet  HWaddr 00:50:DA:19:7A:7D
          inet addr:10.100.2.224  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3959973 errors:0 dropped:0 overruns:0 frame:0
          TX packets:442389 errors:0 dropped:0 overruns:0 carrier:0
          collisions:22249 txqueuelen:100
          Interrupt:10 Base address:0xb800

eth0:1    Link encap:Ethernet  HWaddr 00:50:DA:19:7A:7D
          inet addr:10.106.100.167  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0xb800

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:7722 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7722 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0

You have new mail in /var/spool/mail/root
# rmmod dummy
# exit
exit

Script done on Wed Aug 20 13:11:53 2003


...and it works.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



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

* Re: 2.6.0-test3 module compilation
  2003-08-20 16:39 2.6.0-test3 module compilation linuxmodule
  2003-08-20 16:54 ` Randy.Dunlap
  2003-08-20 17:19 ` Richard B. Johnson
@ 2003-08-20 18:47 ` Sam Ravnborg
  2 siblings, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2003-08-20 18:47 UTC (permalink / raw)
  To: linuxmodule; +Cc: linux-kernel

On Wed, Aug 20, 2003 at 06:39:19PM +0200, linuxmodule@altern.org wrote:
> I am trying to compile a module on 2.6.0-test3 kernel. The makefile i am using is a pretty normal one : 

Try reading Documentation/modules.txt.

	Sam

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

* Re: 2.6.0-test3 module compilation
@ 2003-08-20 19:06 Jose Luis Alarcon Sanchez
  0 siblings, 0 replies; 5+ messages in thread
From: Jose Luis Alarcon Sanchez @ 2003-08-20 19:06 UTC (permalink / raw)
  To: linuxmodule, linux-kernel

---- Begin Original Message ----
 From: <linuxmodule@altern.org>
Sent: Wed, 20 Aug 2003 18:39:19 +0200 (CEST)
To: linux-kernel@vger.kernel.org
Subject: 2.6.0-test3 module compilation

I am trying to compile a module on 2.6.0-test3 kernel. The makefile i
am using is a pretty normal one : 

CFLAGS = -D__KERNEL__ -DMODULE -I/usr/src/linux-2.6.0-test3/include -O
dummy.o: dummy.c

The module i am trying to compile is taken from the kernel itself
(dummy network device driver). The
compilation works flawlessly but when i try to insert the module i get
: invalid module format.
What am i doing wrong because i have modutils and module-init and both
work, since the same module (dummy)
compiled with the kernel itself can be inserted and removed without
the previous error message.
Is there something i should know about the compilation process ? The
kernel-compiled module (dummy.ko) has
about 10 Kbytes and dummy.ko compiled by me has only 2 Kbytes :(

Thank you in advance
Snowdog
---- End Original Message ----

  Try to give a look to this "Linux Weekly News" article:

     http://lwn.net/Articles/21823

  Good luck.

  Regards.

  Jose.


http://linuxespana.scripterz.org

FreeBSD RELEASE 4.8.
Mandrake Linux 9.1 Kernel 2.6.0-test3 XFS.
Registered BSD User 51101.
Registered Linux User #213309.
Memories..... You are talking about memories. 
Rick Deckard. Blade Runner.


Get your Free E-mail at http://chevy.zzn.com
___________________________________________________________
Get your own Web-based E-mail Service at http://www.zzn.com

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

end of thread, other threads:[~2003-08-20 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-20 16:39 2.6.0-test3 module compilation linuxmodule
2003-08-20 16:54 ` Randy.Dunlap
2003-08-20 17:19 ` Richard B. Johnson
2003-08-20 18:47 ` Sam Ravnborg
2003-08-20 19:06 Jose Luis Alarcon Sanchez

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®