树莓派3 编译驱动

分为本地编译和交叉编译,主要是Makefile的写法:

本地编译:

obj-m := bcm2835-i2s.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
	make -C $(KDIR) M=$(PWD) modules
clean:
	rm *.o *.ko *.mod.c modules.order Module.symvers
.PHONY:clean

 

交叉编译:

KERN_DIR = /home/qiengo/doc/Linux/raspberrypi/linux_all/linux
PWD:=$(shell pwd)

obj-m	+= ker_rw.o
all:
	make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C $(KERN_DIR) M=$(PWD) modules 
clean:
	rm -rf *.o *.ko *.order *.mod.c

 

posted @ 2016-03-29 22:02  Qiengo  阅读(3110)  评论(0编辑  收藏  举报