|
Hey Manoj, You've defined what you want the end result to be. You should also need to define what the source is for this result. You might try looking at some other drivers (such as NVidia, or acerhk) that compile kernel modules. In your makefile, you will have rules. Rules are generally in the form of 'label:what do do'. Labels define what you can type after your 'make' command eg 'make label'. In the example below, TARGET is defined as 'acerhk.ko'. This is the module we are trying to build. The rule 'all: $(TARGET)' will therefore be interpreted as 'all: acerhk.ko'. make will then find the rule named 'acerhk.ko' and see what else is to be done. The rule 'acerhk.ko' defines the source and header files, and how make should run. Hope this helps a bit. What follows is from the acerhk Makefile, edited somewhat to remove all the kernel 2.4 stuff. You can also add conditional statements (eg if) to Makefiles.... -- begin Makefile -- KERNELSRC?=/lib/modules/`uname -r`/build KERNELVERSION=$(shell awk -F\" '/REL/ {print $$2}' $(KERNELSRC)/include/linux/version.h) KERNELMAJOR=$(shell echo $(KERNELVERSION)|head -c3) obj-m += acerhk.o CC=gcc CFLAGS+=-c -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe INCLUDE=-I$(KERNELSRC)/include TARGET := acerhk.ko SOURCE := acerhk.c all: $(TARGET) acerhk.ko: $(SOURCE) acerhk.h $(MAKE) -C $(KERNELSRC) SUBDIRS=$(PWD) modules asm: $(SOURCE) $(CC) $(INCLUDE) $(INCLUDE)/asm-i386/mach-default $(CFLAGS) -fverbose-asm -S -DMODVERSIONS -DMODULE -D__KERNEL__ $(SOURCE) clean: rm -f *~ *.o *.s *.ko *.mod.c load: $(TARGET) insmod $(TARGET) unload: rmmod acerhk install: $(TARGET) #cp -v $(TARGET) /lib/modules/$(KERNELVERSION)/kernel/drivers/char mkdir -p /lib/modules/$(KERNELVERSION)/extra cp -v $(TARGET) /lib/modules/$(KERNELVERSION)/extra/ depmod -a -- end Makefile -- Regards Sean Hi guys,
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
Re: [dubailug] Linux device drivers: compilation
Sean Craig - Snr Solutions Consultant - enigmatis Mon, 26 Dec 2005 11:37:38 -0800
- [dubailug] Linux device ... Manoj Menon
- Re: [dubailug] Linu... Sean Craig - Snr Solutions Consultant - enigmatis
- Re: [dubailug] Linu... Manu Abraham
