编译一个内核模块时出现的问题,请高手看一下

jiangli829 jiangli829 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
用 cc -c hello.c 编译如下代码

hello.c

#define MODULE
#define __KERNEL__

#include "linux/kernel.h"
#include "linux/module.h"
/* pross the CONFIG_MODVERSIONS*/

#ifdef MODVERSIONS
#include "linux/modversions.h"
#endif

/* the init function*/

int init_module()
{
printk(" hello !\n");
return 1;
}

/* the distory function*/

int cleanup_module()
{
return 1;
}

出现如下错误提示:

In file included from /usr/include/linux/prefetch.h:13,
from /usr/include/linux/list.h:6,
from /usr/include/linux/module.h:12,
from hello.c:5:
/usr/include/asm/processor.h:65: `CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)
/usr/include/asm/processor.h:65: requested alignment is not a constant

请高手指点!!!



6,1 顶端

...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
jiangli829
Linux_Kernel 4,469 成员 17,458 内容