我写了一个简单的模块:
#define __KERNEL__
#define MODULE
#include <linux/kernel.h>
#include <linux/module.h>
int init_module(void)
{
printk("Hello, world\n");
return 0;
}
void cleanup_module(void)
{
printk("Goodbye\n");
}
并用这个命令编译它:
cc -c hello.c
但我收到此错误:
linux/module.h: No such file or directory
有什么建议么?
编辑:我使用了这个逗号:
cc -I/usr/src/linux-headers-3.0.0-17-generic/include -c hello.c
它领先一步,现在我收到此错误:
In file included from /usr/src/linux-headers-3.0.0-17-generic/include/linux/kernel.h:13:0,
from hello.c:3:
/usr/src/linux-headers-3.0.0-17-generic/include/linux/linkage.h:5:25: fatal error: asm/linkage.h: No such file or directory
compilation terminated.