linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Song Sam <samlinuxppc@yahoo.com.cn>
Cc: Sam Ravnborg <sam@ravnborg.org>, linuxppc-embedded@lists.linuxppc.org
Subject: Re: Module Compiling Problem
Date: Mon, 24 May 2004 07:06:40 +0200	[thread overview]
Message-ID: <20040524050640.GA2245@mars.ravnborg.org> (raw)
In-Reply-To: <20040524014947.68864.qmail@web15213.mail.bjs.yahoo.com>


On Mon, May 24, 2004 at 09:49:47AM +0800, Song Sam wrote:
> > When compiling an external module use:
> > for 2.4:
> > make -C $ERNELSRC SUBDIRS=$PWD modules
>
> Uh,$ERNELSRC or $KERNELSRC?

When compiling modules you better use the kbuild infrastructure, and
then also a kbuild makefile.
The way to use the kbuild infrastructure is to build your
modules with the above command, where $KERNELSRC is
the directory where you have the kernelsrc.
So you should use something like:
make -C /home/sam/src/kernel/v2.4.18/ SUBDIRS=$PWD modules
assuming the src of the kernel is located in
/home/sam/src/kernel/v2.4.18/

> [Makefile]
> CC = ppc_8xx-gcc
>
> # TOPDIR  := $(shell /bin/pwd)
>
> FILENAME = myic
>
> MYPATH  = /workspace/keep/dmt201/kernel
>
> CPPFLAGS := -D__KERNEL__ -D_REENTRANT
> -I$(MYPATH)/include
>
> CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
> -Wno-trigraphs -O2 -fomit-frame-pointer \
> -fno-strict-aliasing -fno-common -g
> -I$(MYPATH)/arch/ppc -fsigned-char -msoft-float -pipe
> \
> -ffixed-r2 -Wno-uninitialized -mmultiple -mstring
>
> all : $(FILENAME).o
>
> clean :
>         rm $(FILENAME).o
> $(FILENAME).o : $(FILENAME).c
>         $(CC) $(CFLAGS) -DMODULE
> -DKBUILD_BASENAME=$(FILENAME) -c $(FILENAME).c
>
> Thanks a million for your notes.

Try with a Makefile like this:
[Makefile]
obj-m := myic.o

That should do it.
[Later you can add the clean stuff]

	Sam

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

  reply	other threads:[~2004-05-24  5:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-22  0:57 Framebuffer problems Christopher E Cordahi
2004-05-22  7:25 ` Module Compiling Problem Song Sam
2004-05-23  2:00   ` Song Sam
2004-05-23 18:34     ` Sam Ravnborg
2004-05-24  1:49       ` Song Sam
2004-05-24  5:06         ` Sam Ravnborg [this message]
2004-05-24  7:22           ` Query about KERNELLOAD Venkatesh Savithri Mahesh
2004-05-24 12:09             ` Mark Chambers
2004-05-24 15:17           ` Module Compiling Problem Song Sam

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=20040524050640.GA2245@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    --cc=samlinuxppc@yahoo.com.cn \
    /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;
as well as URLs for NNTP newsgroup(s).