如何解决:没有制定目标的规则?

Sag*_*gar 5 linux kernel system-calls kernel-module linux-kernel

我正在尝试构建一个演示内核模块,但是当我制作时,我得到了关注,

make[1]: Entering directory '/usr/src/linux-headers-4.4.0-47-generic'
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h'. Stop.
arch/x86/Makefile:199: recipe for target 'archheaders' failed                                                                                      
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-47-generic'
Makefile:4: recipe for target 'all' failed
Run Code Online (Sandbox Code Playgroud)

我正在跨 linux 内核构建模块 - 4.4.0-47 版本 - 64 位操作系统。任何人都可以帮助我理解为什么我面临这个错误。提前谢谢你。

小智 3

确保您有正确的 make 文件。这是一个非常常见的问题。或者您也可以在 makefile 中使用以下语句。

 obj-m += your_module_name.o

 all:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
 clean:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Run Code Online (Sandbox Code Playgroud)

它应该有效。