[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: module compilation on 2.6 (Makefile and install.sh)



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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]