Chinaunix

标题: 编写内核模块如何设置include路径? [打印本页]

作者: iceking0305    时间: 2011-06-10 16:11
标题: 编写内核模块如何设置include路径?
如题,要编写一个内核模块,其中include的头文件在其他的目录下,如何在Makefile中设置include路径
作者: proghua    时间: 2011-06-10 16:40
  1. ifneq ($(KERNELRELEASE),)
  2.     obj-m := hello.o
  3. else
  4.     KERNELDIR ?= /lib/modules/$(shell uname -r)/build
  5.     PWD :=$(shell pwd)
  6. default:
  7.     $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
  8. endif
复制代码

作者: iceking0305    时间: 2011-06-11 10:57
回复 2# proghua


    哪里有设置include的??
这个应该是最简单的内核模块Makefile吧?
作者: GuiltCool    时间: 2011-06-12 11:57
http://www.latelee.org/embedded- ... makefile-multi.html
作者: GuiltCool    时间: 2011-06-12 11:59
其实LDD3这本书的例子的Makefile中有。
作者: amarant    时间: 2011-06-14 13:44
LZ没弄明白编译模块的make原理啊。
作者: iceking0305    时间: 2011-06-14 16:05
回复 4# GuiltCool


    非常感谢!
已解决




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2