public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Gene Heskett <gene.heskett@verizon.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: makeing a loadable module
Date: Mon, 8 Nov 2004 23:37:03 +0100	[thread overview]
Message-ID: <20041108223703.GC16261@mars.ravnborg.org> (raw)
In-Reply-To: <200411072328.48785.gene.heskett@verizon.net>

On Sun, Nov 07, 2004 at 11:28:48PM -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

Create a small Makefile:
echo obj-m := dpci8255.o > Makefile

And use:
make -C $PATH_TO_KERNEL_SRC SUBDIRS=$PWD modules

This will give you the correct gcc commandline - adopted to actual
configuration of the kernel.
Any other way to compile a module is br0ken.

For 2.6 the above syntax works as well, but simpler versions exists.

	Sam

      parent reply	other threads:[~2004-11-08 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08  4:28 makeing a loadable module Gene Heskett
2004-11-08  6:08 ` Eric Gaumer
2004-11-08 22:37 ` Sam Ravnborg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041108223703.GC16261@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=gene.heskett@verizon.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox