compile only one kernel module *.ko in linux

来源:互联网 发布:矩阵分析 教材 编辑:程序博客网 时间:2024/05/18 17:28
ifneq ($(KERNELRELEASE),)

..........

..........

..........

.........

 
        EXTRA_CFLAGS += -DDEBUG

else
        PWD := $(shell pwd)
        KVER := $(shell uname -r)
        KDIR := /lib/modules/$(KVER)/build

all:

        $(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
        rm -rf *.o *.mod.c *.mod.o *.ko *.symvers *.order *.a

endif

modify kernel module make file in source code directory.


and execute make in source code directory.

need to copy *.ko to directory

/lib/modules/$(KVER)/kernel/***

and restart system.


0 0