centOS+bochs+gdb调试linux0.11

编译并安装bochs:

安装g++ gcc

yum-yinstallgccgcc-c++libstdc++-devel

安装其他依赖

yum install libX11-devel

yum install gtk2-devel

(可能不全)

./configure –enable-gdb-stub

make

make install

找一份可以编译的linux0.11源码

http://download.csdn.net/detail/guotong1988/8292037

整一个bochs可以运行linux0.11的现有环境

http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-060625.zip

在linux-0.11-devel-060625目录下

执行 bochs -q -f bochsrc-hd.bxrc

—–发生错误以及解决办法 —–

(1) >>PANIC<< bochsrc-hd.bxrc:37: vgaromimage directive malformed.

A. 注释掉相应行

B. 改成:vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest

(2) >>PANIC<< bochsrc-hd.bxrc:284: directive ‘floppy_command_delay’ not understood

A. 注释掉相应行

(3) bochsrc-hd.bxrc:194: unknown parameter for parport1 ignored.

A. 注释掉

B. 改成:parport1: enabled=1, file="parport.out"

(4) >>PANIC<< bochsrc-hd.bxrc:307: directive ‘ips’ not understood

A. 注释掉

B. 改成:cpu: count=1, ips=1000000

(5) dlopen failed for module ‘x’: file not found

A. 配置文件顶部增加:

config_interface: textconfig display_library: sdl

(来源于bochs默认配置文件 /etc/bochs-init/bochsrc)

(6) ROM: System BIOS must end at 0xfffff

A. romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000 改成 romimage: file=/usr/share/bochs/BIOS-bochs-latest

(7) 其他问题参考

http://www.cnblogs.com/soli/archive/2009/09/21/1571466.html

弄出来bochs自己的窗口后,修改配置文件,第一行加上

gdbstub: enabled=1, port=1234, text_base=0, data_base=0, bss_base=0让bochs启动时等待gdb(1).打开两个终端窗口;(2).一个运行bochs -f bochsrc-hd.bxrc ,此时该窗口中会显示一条等待gdb来连接的信息:“Wait for gdb connection on localhost:1234”,并且系统会创建一个Bochs主窗口(此时无内容);(3).在另一个窗口中,我们把工作目录切换到内核源代码目录中,运行命令:“gdb tools/system”;(4).在运行gdb的窗口中键入命令“break main”和“target remote localhost:1234”,此时gdb会显示已经连接到Bochs的信息;(5).在gdb环境中再执行命令“cont”,稍过一会gdb会显示程序停止在init/main.c的main()函数处。

然后就是gdb的使用了

含泪播种的人一定能含笑收获。

centOS+bochs+gdb调试linux0.11

相关文章:

你感兴趣的文章:

标签云: