Ubuntu下Bochs安装与初步使用
Ubuntu下Bochs安装
从 sourceforge.net/projects/bochs/files/bochs下载源码,版本选择是 2.6.2
解压压缩包
编译(configure ->make ->make install)
. /configure
–prefix= /your_path/bochs
–enable-debugger
–enable-disasm
–enable-iodebug
–enable-x86-debugger
–with-x
–with-xll
注意替换 prefix 中的 your_path
- 不出意外,configure之后会生成Makefile文件,就可以开始编译了
make
- 不出问题则继续执行
make install
- 到此bochs安装就完成了
bochs使用初步
安装完成后就去bochs的安装目录下面,创建配置文件,用来模拟BIOS,这里的文件名不做要求,内容如下
megs: 32
romimage: file=/your_path/bochs/share/bochs/BIOS-bochs-latest
vgaromimage: file=/your_path/qizong007/bochs/share/bochs/VGABIOS-lgpl-latestboot: disk
log: bochs.out
mouse: enabled=0
keyboard_mapping: enable=1, map=/your_path/bochs/share/bochs/keymaps/x11-pc-us.mapata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
#下面这行后文会解释用处 暂时先注释掉
#ata0-master: type=disk, path=“hd60M.img”, mode=flat, cylinders=121, heads=16, spt=63
#gdbstub: enabled=0, port=1234, text_base=0, data_base=0, bss_base=0
这里的配置是不开启gdb的配置 所以最后一行注释掉了
TIPS: 以下操作均位于安装目录下
- 运行bochs
方式1
bin/bochs -f bochsrc.disk
此处 -f 后面的参数是配置前文中bios配置文件的文件名
方式2
bin/bochs
- 页面会出现以下内容
You can also start bochs with the -q option to skip these menus.
- Restore factory default configuration
- Read options from…
- Edit options
- Save options to…
- Restore the Bochs state from…
- Begin simulation
- Quit now
Please choose one: [2]
- [2]表示默认为选项2,键入回车即可
What is the configuration file name?
To cancel, type ‘none’. [none]
- 此时需要键入bios配置文件的文件名
结果如下:

注意此处的BOOT FAILED 意味着没有硬盘存在
模拟硬盘
bin/bximage -hd -mode=“flat” -size=60 -q hd60M.img
此时会产生提示
The following line should appear in your bochsrc:
ata0-master: type=disk, path=“hd60M.img”, mode=flat, cylinders=121, heads=16, spt=63
没错这时候你可以去把配置文件中的注释去掉了
重新运行bochs

注意 BOOT FAILED发生了变化 显然读取到了硬盘,只是不是bootable disk而已罢了
