现在的位置: 首页 > 综合 > 正文

Linux内核Makefile模板,及其注意事项

2018年10月04日 ⁄ 综合 ⁄ 共 428字 ⁄ 字号 评论关闭

一、Linux内核Makefile模板

obj-m := test.o
test-objs := testipb.o ipb.o


KERNELDIR = /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:  
        $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
install:
        cp inerdns.ko ../

二、注意事项

      2.1 第一行的test.o,必须与第二行的test-objs相对应。

      2.2 第一行的test.o,与第二行中的testipb.o不能重名。

以前博客《Linux内核编程:第一个Linux内核代码》中的Makefile模板不正确:http://blog.csdn.net/guowenyan001/article/details/11964597

抱歉!评论已关闭.