目标“全部”的配方失败

时间:2019-04-27 14:34:54

标签: c linux makefile kernel-module

我正在尝试制作一个将.c代码编译为Linux Ubuntu 16.04中可加载内核模块的makefile。但是,我收到了“目标'所有'失败的错误的食谱”。我使用“ sudo make”来运行makefile,因此权限在这里应该不是问题。

代码(module1.c):

#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
printk(KERN_INFO "Hello World!\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Bye-bye World!.\n");
}

MakeFile:

obj-m += module1.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

错误:

make -C /lib/modules/4.8.0-36-generic/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-4.8.0-36-generic'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --silentoldconfig Kconfig
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:191: recipe for target 'archheaders' failed
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.8.0-36-generic'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

0 个答案:

没有答案