我的makefile导致:没有规则来制作目标`arch / x86 / tools / relocs.c’,这是必需的
我使用的是Ubuntu 12.04。 我写了一个简单的hello world内核模块( hello.c
)。 我为它写了下面的makefile:
obj-m+=hello.o KDIR:= /usr/src/linux-headers-3.2.0-24-generic-pae all: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: rm -rf *.o *.ko *.mod.* *.symvers *.order
但是当我从内核制作时出现了这个错误:
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-24-generic-pae' make[2]: *** No rule to make target `arch/x86/tools/relocs.c', needed by `arch/x86/tools/relocs'. Stop.
hello.c
和makefile
位于/Documents/module_prog
。 我从该目录运行make
。
导致此错误的原因是什么?如何解决?
在make文件中,只需将SUBDIRS=$(PWD)
更改为M=$(shell pwd)
…
像魅力一样工作