ifeq ($(KERNELRELEASE),) KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) TEST = test modules: $(MAKE) -C $(KERNELDIR) M=$(PWD) clean: rm -rvf *.ko *.o *.mod.c Module* module* test: gcc $(TEST).c -o $(TEST) mknod: sudo mknod /dev/my_hello c 365 0 insmod: sudo insmod my_hello.ko .PHONY:modules clean mknod test insmod else obj-m := 你的驅動文件名.o endif