|
下载交叉工具链 下载官方内核 找到ch34x.c(内核源码里有) 配置makefile 编译出ko 装载ko 完成
- #Makefile
- ifeq ($(KERNELRELEASE), )
- # KERNELDIR := /lib/modules/$(shell uname -r)/build
- KERNELDIR := ~/Desktop/3399/kernel-stable
- PWD :=$(shell pwd)
- default:
- $(MAKE) -C $(KERNELDIR) M=$(PWD)
- clean:
- rm -rf .tmp_versions Module.symvers *.mod.c *.o *.ko .*.cmd Module.markers modules.order
- load:
- modprobe usbserial
- insmod ch34x.ko
- unload:
- rmmod ch34x
- else
- obj-m := ch34x.o
- endif
- # ifneq ($(KERNELRELEASE),)
- # obj-m:=hello.o
- # else
- # KDIR :=/home/peng/linux-3.14
- # PWD :=$(shell pwd)
- # all:
- # make -C $(KDIR) M=$(PWD) modules
- # clean:
- # rm -f *.ko *.o *.mod.o *.symvers *.cmd *.mod.c *.order
- # endif
|
|