# Comment/uncomment the following line to enable/disable debugging
#DEBUG = y
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULLC_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
############################### add for my linux cross-complete enviroment start yc
CROSS=arm-uclibc-linux-
CC = $(CROSS)gcc
AR := $(CROSS)ar -rv
############################### add for my linux cross-complete enviroment over yc
CFLAGS += $(DEBFLAGS) -I$(LDDINC)
############### modify with your project
TARGET = second
############### modify with your project
ifneq ($(KERNELRELEASE),)
############### modify with your project
#scullc-objs := main.o
obj-m := second.o
############### modify with your project
else
############################## modify the kernel for my enviromentstart yc
KERNELDIR ?= /home/yc/workspace/dev/linux/kernel/linux-2.6.14
############################## modify the kernel for my enviromentstart yc
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) modules
endif
install:
install -d $(INSTALLDIR)
install -c $(TARGET).o $(INSTALLDIR)
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
注意:上述是在基于ARM平台的驱动Makefile模板,链接的Kernvelel必须是实际在ARM板上运行的映像版本的头文件,否则,不同版本会出现问题。
另外,如果要在x86的机子上编译、运行驱动,则需要使用同一版本的内核:将下载的标准内核置于/usr/local/src/目录下(解压的),编译该内核,并使用该内核启动!
阅读(1093) | 评论(0) | 转发(0) |