public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: linux-kernel@vger.kernel.org
Subject: Re: External compilation
Date: 10 Jun 2002 11:15:49 GMT	[thread overview]
Message-ID: <slrnag92j5.90a.kraxel@bytesex.org> (raw)
In-Reply-To: <20020609142602.GA77496@compsoc.man.ac.uk>

John Levon wrote:
>  
>  Is there any good example code for compiling a kernel module
>  externally, that works for modversions etc. on 2.2, 2.4, and 2.5,
>  and does the right thing (including Rules.make) ?
>  
>  I'm having an awful time working out the exact incantations.

Here is a stripped down version of what I use for bttv currently.

  Gerd

==============================[ Makefile ]==============================
# where the kernel sources are located
KDIR := /lib/modules/$(shell uname -r)/build
#KDIR := /work/bk/2.5/build

# kernel version
KVER := $(shell ./uts-release $(KDIR))
MDIR := /lib/modules/$(KVER)/kernel/drivers/media/video

export-objs	:= bttv-if.o video-buf.o
list-multi	:= bttv.o
bttv-objs	:= bttv-driver.o bttv-cards.o bttv-risc.o bttv-if.o bttv-vbi.o

obj-m		:= video-buf.o bttv.o

multi-m		:= $(filter $(list-multi), $(obj-m))
int-m		:= $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))

EXTRA_CFLAGS=-g -Wmissing-prototypes -Wstrict-prototypes

here:
	DIR=`pwd`; (cd $(KDIR); make SUBDIRS=$$DIR modules)

include $(KDIR)/Rules.make

bttv.o: $(bttv-objs)
	$(LD) -r -o $@ $(bttv-objs)

==============================[ uts-release ]==============================
#! /bin/sh
cat <<-EOF | cpp -P -I$1/include | grep '"' | cut -d'"' -f2
	#include <linux/version.h>
	UTS_RELEASE
EOF

  reply	other threads:[~2002-06-10 11:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-09 14:26 External compilation John Levon
2002-06-10 11:15 ` Gerd Knorr [this message]
2002-06-10 14:31 ` Kai Germaschewski
2002-06-10 15:12   ` John Levon
2002-06-10 15:34     ` Kai Germaschewski
2002-06-10 20:05 ` Greg KH

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=slrnag92j5.90a.kraxel@bytesex.org \
    --to=kraxel@bytesex.org \
    --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