module compilation on 2.6 (Makefile and install.sh)

Hannes Mayer h.mayer at inode.at
Sat Jun 19 06:38:00 UTC 2004


Fred Fedora wrote:
> Rick,
> Thanks for explaining. Is there some sample makefile which ahieves this 
> trick somewhere on teh web? 

Not on the web, but I use this Makefile for my kernel hacking:

----------

obj-m	:= your-module.o

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

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

----------

You have your-module.c and the Makefile in the current directory,
just issue "make" and the your-module.ko is built.

install it with this: (I have a install.sh script for that)

#!/bin/sh
install -m 644 your-module.ko /lib/modules/`uname -r`/kernel/drivers/your-module.ko
/sbin/depmod -a

(adjust the /lib/modules path according to your needs)

Now make a

# modprobe your-module

and off the fun goes ;-)

Cheers,
Hannes.





More information about the fedora-list mailing list