Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1527075
  • 博文数量: 290
  • 博客积分: 3468
  • 博客等级: 中校
  • 技术积分: 3461
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-28 22:21
文章分类

全部博文(290)

文章存档

2016年(13)

2015年(3)

2014年(42)

2013年(67)

2012年(90)

2011年(75)

分类: LINUX

2014-07-16 10:43:11

系统环境:centos 6.5 x64

 

1. 获取内核源码

yum install yum-utils

yum provides /boot/vmlinuz-2.6.32-431 # 获取包名

yumdownloader --source kernel-2.6.32-431 #根据包名获取源码

 

要想下载源码包,我们就必须先配置好yum的源码包下载路径,操作如下(需要root权限):

1. 打开/etc/yum.repos.d目录。

2. 如果没有CentOS-Source.repo文件就新建一个,有就备份。

3. 往CentOS-Source.repo插入以下内容:

[base-source]

name=CentOS-$releasever - Base Source

baseurl=

enabled=1[updates-source]

name=CentOS-$releasever - Updates Source

baseurl=

enabled=1[extras-source]

name=CentOS-$releasever - Extras Source

baseurl=

enabled=1[centosplus-source]

name=CentOS-$releasever - Plus Source

baseurl=

enabled=1

 

修改完成后,还需要以下语句使之生效:

yum clean all;

yum makecache

 

2. 配制kernel

使用原先的 config文件(/usr/src/kernels/$(uname -r)-$(uname -m)/.config). ),在此基础之上进行裁剪。

 

3. 编译kernel

 

在开始升级下,需要安装一些构建内核的必需的依赖软件包

yum groupinstall “Development Tools”
yum install ncurses-devel

清理内核

make mrproper

make clean

以发行版中自带的config 文件为基础

cp config-431 .config

#make bzImage
#make modules
#make modules_install
#make install

make help //查看支持的选项

 

[root@srv linux-2.6.32-220.4.2.el6]# make bzImage
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-x86
  CALL    scripts/checksyscalls.sh
  CHK     include/linux/compile.h
  CC      crypto/signature/ksign-publickey.o
crypto/signature/ksign-publickey.c:2:17: 错误:key.h:没有那个文件或目录
crypto/signature/ksign-publickey.c: 在函数‘ksign_init’:
crypto/signature/ksign-publickey.c:10: 错误:‘ksign_def_public_key’未声明(在此函数内第一次使用)
crypto/signature/ksign-publickey.c:10: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
crypto/signature/ksign-publickey.c:10: 错误:所在的函数内也只报告一次。)
crypto/signature/ksign-publickey.c:11: 错误:‘ksign_def_public_key_size’未声明(在此函数内第一次使用)
make[2]: *** [crypto/signature/ksign-publickey.o] 错误 1
make[1]: *** [crypto/signature] 错误 2

make: *** [crypto] 错误 2

 

去除模块签名检验

 [ * ] Enable loadable module support  ---> 

[ ]   Module signature verification (EXPERIMENTAL) #去除这项

 -*- Cryptographic API  --->

[ ]   In-kernel signature checker (EXPERIMENTAL)  #去除这项



drivers/net/wireless/airo.c: 在函数‘wifi_setup’中:

drivers/net/wireless/airo.c:2670: 错误:‘struct net_device’没有名为‘wireless_handlers’的成员

drivers/net/wireless/airo.c: 在函数‘init_wifidev’中:

drivers/net/wireless/airo.c:2693: 错误:‘struct net_device’没有名为‘wireless_data’的成员

drivers/net/wireless/airo.c:2693: 错误:‘struct net_device’没有名为‘wireless_data’的成员

drivers/net/wireless/airo.c: 在函数‘_init_airo_card’中:

drivers/net/wireless/airo.c:2822: 错误:‘struct net_device’没有名为‘wireless_handlers’的成员

drivers/net/wireless/airo.c:2824: 错误:‘struct net_device’没有名为‘wireless_data’的成员

make[3]: *** [drivers/net/wireless/airo.o] 错误 1

make[2]: *** [drivers/net/wireless] 错误 2

make[1]: *** [drivers/net] 错误 2

make: *** [drivers] 错误 2


去除无线支持:

Device Drivers  ---> 

-*- Network device support  ---> 

[ ]   Wireless LAN  --->                    #这项去除                               

    WiMAX Wireless Broadband devices  --->  #这项去除



sh /root/kernel-2.6.32/linux-2.6.32-431.el6/arch/x86/boot/install.sh 2.6.32 arch/x86/boot/bzImage \

                System.map "/boot"

ERROR: modinfo: could not find module vmhgfs

ERROR: modinfo: could not find module vsock

ERROR: modinfo: could not find module vmci

ERROR: modinfo: could not find module ext4

ERROR: modinfo: could not find module jbd2

ERROR: modinfo: could not find module mbcache

[root@localhost linux-2.6.32-431.el6]# 


修改config把 ext4, ext3 文件系统支持直接编译进 kernel而不是以模块的形式存在,不然启动不了(因为加载不了ext4模块,文件系统无法挂载)

 

参考链接:

分析Linux kernel在“make install”时的“ERROR: modinfo: could not find module power_meter”这类问题 

阅读(1726) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~