Re: External compilation

From: Kai Germaschewski (
Date: Mon Jun 10 2002 - 09:31:42 EST

On Sun, 9 Jun 2002, 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) ?

Well, you need the source for the kernel you're building the module for,
it needs to be configured and "make dep" must have been run (for module

(You normally can find it by looking into /lib/modules/`uname -r`/kernel
for the currently running kernel)

Put your module source in some directory, and add a Makefile like

        obj-m := my_module.o

        include $(TOPDIR)/Rules.make

cd into the kernel source and run

        make SUBDIRS=/path/to/your/module modules


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:18 EST