lkml.org 
[lkml]   [2004]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: makeing a loadable module
From
Date
On Sun, 2004-11-07 at 23:28 -0500, Gene Heskett wrote:
> Greetings;
>
> I found some code I can play with/hack/etc, in the form of a loadable
> module and some testing driver programs, in 'dpci8255.tar.gz'.
>
> Unforch its for a slightly different card than the one I have, and
> once I've hacked the code to suit, I need to rebuild it.
>
> So whats the gcc command line to make just a bare, loadable module for
> say a 2.4.25 kernel? Obviously I'm missing something when it
> complains and quits, claiming there is no 'main' defined, which I
> don't think modules actually have one of those?
>
> What I'm trying to do (hey, no big dummy jokes please :)
>
> [root@coyote dist]# cc -o dpci8255.o dpci8255lib.c
> /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crt1.o(.text+0x18):
> In function `_start':
> : undefined reference to `main'
> collect2: ld returned 1 exit status
>
> The gcc manpage isn't that helpfull and I've now read thru it twice.

This should work for a single source file

]$ gcc -O2 -D__KERNEL__ -DMODULE -DHAVE_CONFIG_H -I/usr/src/linux/include -c dcpi8255.c

If your using SMP then you'll need to define that as well.

--
Eric Gaumer <gaumerel@ecs.fullerton.edu>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:07    [from the cache]
©2003-2011 Jasper Spaans