Chinaunix首页 | 论坛 | 博客
  • 博客访问: 423292
  • 博文数量: 81
  • 博客积分: 2830
  • 博客等级: 少校
  • 技术积分: 1445
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-24 09:19
文章分类

全部博文(81)

文章存档

2011年(1)

2010年(34)

2009年(16)

2008年(30)

我的朋友

分类: LINUX

2010-06-19 17:29:17


在DELL 2950上经过几天的折腾,终于编译出一个没有错误的内核来。

系统环境:
GCC
gcc -v
使用内建 specs。
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.1.2 20080704 (Red Hat 4.1.2-48)

uname -a
Linux xxx 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
详细经过如下:

首先下载一个 LINUX2.6.32.15 进行编译,无论怎么设置,都报如下错误:
ACPI Error (psargs-0359): [CDW1] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_._OSC] (Node ffff88022f8669b0), AE_NOT_FOUND
在不选开发包的时候报
aer 0000:00:02.0:pcie02: PCIe errors handled by platform firmware.
aer 0000:00:03.0:pcie02: PCIe errors handled by platform firmware.
aer 0000:00:04.0:pcie02: PCIe errors handled by platform firmware.
aer 0000:00:05.0:pcie02: PCIe errors handled by platform firmware.
aer 0000:00:06.0:pcie02: PCIe errors handled by platform firmware.
aer 0000:00:07.0:pcie02: PCIe errors handled by platform firmware.

GOOGLE了两天,老外网站上是说 kernel: ACPI Error 这个是GCC BUG ,没有其他的解决办法,不想升级GCC

aer 0000:00:02.0:pcie02 这个错误是内核BUG,需要安装AER补丁 ,最后我下载了RC补丁,打了后没有了aer 0000:00:02.0:pcie02 这个错误。但是还是报kernel: ACPI Error 错误,郁闷啊,不管了,先起来再说,然后用ltp 工具测试了一下,没到5分钟就挂了。
   哎,继续吧。继续下载最新内核:linux-2.6.34。同样的步骤下来后还是报kernel: ACPI Error,LTP 工具一跑起来没几分钟又挂了。那个郁闷啊!回归到linux-2.6.30.10终于成功了,那个郁闷了几天的心情突然好转,哈哈。废话不说了,记录一下编译步骤。

下载内核:

 mkdir /home/soft/kernel
 cd /home/soft/kernel
 

 
解压内核:

tar jxvf linux-2.6.30.10.tar.bz2  -C /usr/src

编译并选择模块:

cd /usr/src/linux-2.6.30.10
make mrproper
make menuconfig  ###选择自己机器的驱动并去掉一些其他的驱动,如蓝牙,无线,无线USB网卡驱动,添加了EXT4,XFS 文件系统模块
grep "CONFIG_NF_CONNTRACK_IPV4" .config 如果这个选项没有设置或者是为m,iptable 无法使用
grep "CONFIG_SYSFS_DEPRECATED_V2" .config 是否为y,如果不是,启动的时候会报错 “mount:

could not find filesystem ‘/dev/root’......”
make -j8 bzImage
make -j8 modules
make modules_install
make install

错误排除:

启动后报错:insmod: error inserting '/lib/dm-region-hash.ko' : -1 File exists

经过GOOGLE 是结果问题如下:

cd /home/soft/kernel
cp /boot/initrd-2.6.30.10.img .
mkdir newintrd
cd newintrd
zcat ../initrd-2.6.30.10.img |cpio -i
vi init
删除掉
echo "Loading dm-region-hash.ko module"
insmod /lib/dm-region-hash.ko
多余的两行保存
find . |cpio -c -o > ../initrdnew
cd ..
gzip -9 < initrdnew > initrd-2.6.30.10.img.new
cp initrd-2.6.30.10.img.new /boot/initrd-2.6.30.10.img

vi /etc/grub.conf
修改 default=0

然后reboot
linux-2.6.30.10]# uname -a
Linux xxx 2.6.30.10 #2 SMP Sat Jun 19 16:00:07 CST 2010 x86_64 x86_64 x86_64 GNU/Linux

启动后看有没有错误

dmesg|grep -i "error" 看到没有任何输出,那个心情愉悦的程度。

LTP 工具测试了一下,发现服务器正常运行。终于松口气了。再继续测试两天看看运行情况怎么样。

不过在运行 ltp 时系统日志报:
 dmesg|grep -i "error"
connect01[4360]: segfault at 7fff76cbb000 ip 0000000000401610 sp 00007fff76cb8f30 error 4 in connect01[400000+6000]

这个错误暂时没法办解决

最后看看内核文件大小:

[root@backup 10]# ls -lh /boot/initrd-2.6.30.10.img
-rw------- 1 root root 2.6M 06-19 16:08 /boot/initrd-2.6.30.10.img
和redhat 核一样大
ls -lh /boot/vmlinuz-2.6.30.10
-rw-r--r-- 1 root root 2.3M 06-19 16:06 /boot/vmlinuz-2.6.30.10
比原来系统的大0.4M
 ls -lh /boot/System.map-2.6.30.10
-rw-r--r-- 1 root root 1.5M 06-19 16:06 /boot/System.map-2.6.30.10
比原来系统大 0.3M
du -sh /lib/modules/2.6.30.10/
435M    /lib/modules/2.6.30.10/

好大。模块比较多,下一步看怎么缩小。优化一下。

我自己的.config 文件,供大家讨论。
=================20100621 更新=================
升级GCC到 4.4
 gcc -v
使用内建 specs。
目标:x86_64-linux-gnu
配置为:./configure --prefix=/usr/local/gcc4.4 --enable-threads=posix --enable-shared --with-system-zlib --enable-languages=c,c++,java,obj-c++ --enable-nls --enable-targets=all --enable-checking=release --disable-multilib --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-gmp-include=/usr/local/include/ --with-gmp-lib=/usr/local/lib/ --with-mpfr-include=/usr/local/include/ --with-mpfr-lib=/usr/local/lib/
线程模型:posix
gcc 版本 4.4.4 (GCC)

重新编译了一下。模块为24M了。
启动后内存使用
-rw-r--r-- 1 root root    13 06-19 10:19 Version
[root@backup ltp]# free -m
             total       used       free     shared    buffers     cached
Mem:          7922        247       7675          0         32        148
-/+ buffers/cache:         66       7855
Swap:         1027          0       1027

uname -a
Linux XXX 2.6.30-10.el14 #5 SMP Mon Jun 21 14:50:04 CST 2010 x86_64 x86_64 x86_64 GNU/Linux
du -sh /lib/modules/2.6.30-10.el14/
24M     /lib/modules/2.6.30-10.el14/

支持 lm_senors

编译内核是必须选择  
  [*] Prompt for development and/or incomplete code/drivers

否则无法使用 lm_senors
参考:





文件:config.rar
大小:18KB
下载:下载


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