CentOS6.5原生内核版本是
Linux 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
在网上下载对应版本的src.rpm包:kernel-2.6.32-431.el6.src.rpm
http://rpm.pbone.net/index.php3/stat/4/idpl/24668468/dir/scientific_linux_6/com/kernel-devel-2.6.32-431.el6.x86_64.rpm.html
1.解压src.rpm包:
# rpm -ivh kernel-2.6.32-431.el6.src.rpm
----------------------------------------
错误提示:
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
执行下面两个命令:
# groupadd mockbuild
# useradd mockbuild -g mockbuild
----------------------------------------
2.生成rmp包
# rpmbuild -bb xxx.spec
----------------------------------------
错误提示:
error: Failed build dependencies:
asciidoc is needed by kernel-2.6.32-431.el6.x86_64
newt-devel is needed by kernel-2.6.32-431.el6.x86_64
ftp://rpmfind.net/linux/centos/6.7/os/x86_64/Packages/asciidoc-8.4.5-4.1.el6.noarch.rpm
ftp://rpmfind.net/linux/centos/6.7/os/x86_64/Packages/newt-devel-0.52.11-3.el6.x86_64.rpm
ftp://rpmfind.net/linux/centos/6.7/os/x86_64/Packages/slang-devel-2.2.1-1.el6.x86_64.rpm
解决办法:
#rpm -ivh /home/zq/kernel/asciidoc-8.4.5-4.1.el6.noarch.rpm
#rpm -ivh /home/zq/kernel/slang-devel-2.2.1-1.el6.x86_64.rpm
#rpm -ivh /home/zq/kernel/newt-devel-0.52.11-3.el6.x86_64.rpm
----------------------------------------
卡住gpg: keyring `./pubring.gpg' created不动了
解决办法:
执行一下命令:
rngd -r /dev/urandom
----------------------------------------
3.安装rpm包
#cd /root/rpmbuild/RPMS/x86_64/
#rpm -ivh kernel-debuginfo-common-x86_64-2.6.32-431.el6.x86_64.rpm
#rpm -ivh kernel-debug-2.6.32-431.el6.x86_64.rpm
#rpm -ivh kernel-debug-debuginfo-2.6.32-431.el6.x86_64.rpm
4.调试内核
4.1 模拟机内内核奔溃
echo c > /proc/sysrq-trigger
执行此命令内核崩溃,会在/var/crash目录下生成vmcore文件。(vim /etc/kdump.conf; path /var/crash)
4.2 分析vmcore
进入目录/var/crash/127.0.0.1-2014-02-24-09:30:19,可以看到vmcore文件。
1.执行/usr/bin/crash /usr/lib/debug/lib/modules/2.6.32-220.el6.x86_64/vmlinux vmcore
2.具体分析过程见:http://blog.csdn.net/guowenyan001/article/details/12975221
参考资料:
Linux内核调试:kdump、vmcore、crash、kernel-debuginfo
http://blog.csdn.net/guowenyan001/article/details/19807555
细谈.src.rpm软件包安装方法
http://blog.chinaunix.net/uid-21266384-id-186416.html
阅读(4329) | 评论(0) | 转发(0) |