LinuxSir.cn,穿越时空的Linuxsir!

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

CentOS 5.2,无法编译自带内核源码?

[复制链接]
发表于 2008-11-24 01:36:32 | 显示全部楼层 |阅读模式
为了让自己笔记本的Intel 3945网卡有用,编译安装最新驱动时,要求编译内核;当然也想针对自己的硬件优化一下,于是决定编译CentOS 5.2 的自带内核。

内核版本:
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]# uname -a
Linux yd-xzn-nb 2.6.18-92.1.18.el5 #1 SMP Wed Nov 12 09:30:27 EST 2008 i686 i686 i386 GNU/Linux

编译过程:
一、make mrproper
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]# make mrproper
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/i386/Kconfig
***
*** You have not yet configured your kernel!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[3]: *** [silentoldconfig] 错误 1
make[2]: *** [silentoldconfig] 错误 2
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig

二、make xconfig
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]# make O=/root/build/kernel/2.6.18-92.1.18.el5/ xconfig
  GEN     /root/build/kernel/2.6.18-92.1.18.el5/Makefile
scripts/kconfig/qconf arch/i386/Kconfig
ScimInputContextPlugin()
#
# configuration written to .config
#
~ScimInputContextPlugin()

三、make
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]# make O=/root/build/kernel/2.6.18-92.1.18.el5/
  GEN     /root/build/kernel/2.6.18-92.1.18.el5/Makefile
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/i386/Kconfig
  Using /usr/src/kernels/2.6.18-92.1.18.el5-i686 as source for kernel
  /usr/src/kernels/2.6.18-92.1.18.el5-i686 is not clean, please run 'make mrproper'
  in the '/usr/src/kernels/2.6.18-92.1.18.el5-i686' directory.
make[1]: *** [prepare3] 错误 1
make: *** [_all] 错误 2

提示没清理干净,那就再来一次吧:
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]# make mrproper
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/i386/Kconfig
***
*** You have not yet configured your kernel!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[3]: *** [silentoldconfig] 错误 1
make[2]: *** [silentoldconfig] 错误 2
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   include/config

清理完了,再一次make:
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]# make O=/root/build/kernel/2.6.18-92.1.18.el5/
  Using /usr/src/kernels/2.6.18-92.1.18.el5-i686 as source for kernel
  GEN     /root/build/kernel/2.6.18-92.1.18.el5/Makefile
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/linux/utsrelease.h
  UPD     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-i386
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/lex.c
  SHIPPED scripts/genksyms/parse.h
  SHIPPED scripts/genksyms/keywords.c
  HOSTCC  scripts/genksyms/lex.o
  SHIPPED scripts/genksyms/parse.c
  HOSTCC  scripts/genksyms/parse.o
  HOSTLD  scripts/genksyms/genksyms
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
make[2]: *** 没有规则可以创建“init/built-in.o”需要的目标“init/main.o”。 停止。
make[1]: *** [init] 错误 2
make: *** [_all] 错误 2
[root@yd-xzn-nb 2.6.18-92.1.18.el5-i686]#

由于各种原因重装几次系统,每次重新编译CentOS 5.2 自带内核,都是出现:
make[2]: *** 没有规则可以创建“init/built-in.o”需要的目标“init/main.o”。 停止。

哪位大侠指点一二?

网上搜了一下CentOS内核编译的内容,全是升级内核的,没有发现重编译原有内核的。

由于水平有限,升级内核后,iptables又不能用了(启动失败,说是iptables-restore第24行错误),所以只好编译一下原有内核--结果总是失败。
 楼主| 发表于 2008-11-24 22:26:40 | 显示全部楼层
来自:http://www.netfilter.org/projects/iptables/downloads.html
iptables Releases
2008-Oct-13: iptables-1.4.2
iptables 1.4.2 has been released. This release supports all new features of the 2.6.27 kernel.
原来低版的iptables跟高版的kernel有兼容问题?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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