###设置KERNEL路径 设置环境变量KERNEL_PATH
export KERNEL_PATH=/home/frank/imxbsp/linux-2.6.35.3
###编写makefile
# Makefile2.6
ifneq ($(KERNELRELEASE),)
obj-m := led_drv.o
else
PWD := $(shell pwd)
KVER = 2.6.35.3
KDIR:=$(KERNEL_PATH)
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
endif
###编译 执行make即可
###问题 提示错误
include/linux/mmzone.h:294: error: 'MAX_NR_ZONES' undeclared here
原因是kernel没有编译,编译后就不会报错了