IMX6平台Linux3.14.28系统下编译驱动模块ko和应用程序的Makefile模版

obj-m += button.o
ARCH=arm
MYCROSS_COMPILE=/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-
KERN_DIR =/home/wys/workspace/imx6/M6708-T_V1.01/kernel-imx/


PWD := $(shell pwd)
modules:
$(MAKE) ARCH=arm  CROSS_COMPILE=$(MYCROSS_COMPILE)  -C  $(KERN_DIR) M=$(PWD) modules
$(MYCROSS_COMPILE)gcc -mfloat-abi=hard button_test.c -o button_test -lpthread
clean:
$(MAKE) ARCH=arm  CROSS_COMPILE=$(MYCROSS_COMPILE)  -C $(KERN_DIR) M=$(PWD) modules clean
 
  
注意:
修改Makefile文件的MYCROSS_COMPILE为交叉工具链和KERN_DIR为内核源码目录
Ubuntu下执行sudo make

你可能感兴趣的:(嵌入式linux)