HOWTO build a kernel module

Paul Howarth paul at city-fan.org
Fri Feb 18 18:06:35 UTC 2005


BZ Benny wrote:
> Hi,
> Did somone know a good HOWTO build a kernel module in FC3

There's one in the release notes:

-------------------------------------------------------------------------

An exploded source tree is not required to build kernel modules against 
the currently in-use kernel.

For example, to build the foo.ko module, create the following file 
(named Makefile) in the directory containing the foo.c file:


obj-m	:= foo.o

KDIR	:= /lib/modules/$(shell uname -r)/build
PWD	:= $(shell pwd)

default:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

Issue the make command to build the foo.ko module.

-------------------------------------------------------------------------

That's all that's needed...

Paul.




More information about the fedora-list mailing list