LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 677|回复: 3

编译内核模块 出现错误。

[复制链接]
发表于 2004-2-4 11:48:40 | 显示全部楼层 |阅读模式
gcc -Wall -DMODULE -D__KERNEL__ -DLinux -c start.c
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 start.c:2:
/usr/include/asm/processor.h:56: error: `CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)
/usr/include/asm/processor.h:56: error: requested alignment is not a constant
make: *** [start.o] Error 1

这个在rh9上编译是好的。
是我的linux source安装的有问题吗?

代码如下


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

#if CONFIG_MODVERSION == 1
#define MODVERSION
#include <linux/modversion.h>
#endif

int init_module()
{
  printk("Hello, world - this is the kernel speaking\n");
  return 0;
}
发表于 2004-2-4 14:44:37 | 显示全部楼层
你用的什么内核?内核头文件的问题,是不是换过内核了?CPU选对了没有?
 楼主| 发表于 2004-2-4 16:13:04 | 显示全部楼层
我是按照LFS 5.0 安装的 2.4.22 的内核,没有换。
[ahr@lfs ~/code]$ uname -a
Linux lfs 2.4.22 #1 SMP Sun Jan 4 00:44:07 EST 2004 i686 GenuineIntel unknown GNU/Linux

CPU安装头文件的时候哪里选啊?我的cpu是PIII550
编译内核的时候,cpu我用的默认选项:(Pentium-III/Celeron(Coppermine)) Processor family
 楼主| 发表于 2004-2-4 17:40:50 | 显示全部楼层
找到方法了!
http://archives.linuxfromscratch ... ebruary/032792.html
太多东西不知道,sigh :(
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表