[原创]Bochs使用指南

来源:百度文库 编辑:神马文学网 时间:2024/04/28 13:33:03
简介
一般而言,一讲到 PC 仿真器,大家第一个想到的大概就是 VMWare,或是 Virtual PC 吧? 但还有另一个 Open Source 的项目,Bochs,也可以做到类似的功能哦∼
Bochs(发音为 Box)是一个「纯粹」的 Software Emulator,所以它可以在很多平台上执行;也可以成功仿真大部份的 x86 作业 系统,但因为它完全是使用软件来仿真硬件的,因此它的执行效率就真的不是很好了。
而相较于 VMware 及 Virtual PC,VMware 和 Virtual PC 则是为了加快仿真器的速度,采用了极多的硬件加速技术。所以它的模 拟效率一级棒,但是只限于在 x86 平台上执行。其中的 Virtual PC 更局限于仅能在 MS Widows 的环境下执行。
另外还有一个采用了类似 VMware 的硬件加速技术的Open Source 项目,Plex86。不过,Plex86 的程序代码己被 Bochs 所采纳,所 以它的地位已完全被 Bochs 所取代了。至少,在 Debian 里已经完全没有 Plex86 的影子了:
(以下为 Debian 里的 Plex86 套件 之说明)
The functionality of Plex86 in debian has been superceeded by the Bochs package.
This is a dummy package that depends on bochs to facilitate upgrade,
and can be safely removed.
[编辑]事前准备
为了要能够顺利执行 Bochs,我们必须先准备它的硬设备-其中最重要、也最难搞定的就是硬盘;和 VMware 类似的,在 Bochs 里,是利用 Image File 来仿真硬盘的;也就是 Bochs 是将一个大大的档案仿真成一颗硬盘。
我们可以利用 bximage 这个套件所提供的 bximage 工具程序来制作这些 Image File,例: (请注意它所显示的 bashrc 之相关设定信息)
[编辑]制作一个 Floppy Image File
========================================================================
bximage
Disk Image Creation Tool for Bochs
$Id: bximage.c,v 1.19 2003/08/01 01:20:00 cbothamy Exp $
========================================================================
Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd] fd
Choose the size of floppy disk image to create, in megabytes.
Please type 0.36, 0.72, 1.2, 1.44, or 2.88. [1.44] 1.44
I will create a floppy image with
cyl=80
heads=2
sectors per track=18
total sectors=2880
total bytes=1474560
What should I name the image?
[a.img] Boot.img
Writing: [] Done.
I wrote 1474560 bytes to Boot.img.
The following line should appear in your bochsrc:
floppya: 1_44="Boot.img", status=inserted
[编辑]制作一个 Hard Disk Image File
在这里是指定 growing 这种格式。这种格式的 Image File 可以有效节省硬盘空间。
========================================================================
bximage
Disk Image Creation Tool for Bochs
$Id: bximage.c,v 1.19 2003/08/01 01:20:00 cbothamy Exp $
========================================================================
Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd] hd
What kind of image should I create?
Please type flat, sparse or growing. [flat] growing
Enter the hard disk size in megabytes, between 1 and 32255
[10] 1969
I will create a 'growing' hard disk image with
cyl=4000
heads=16
sectors per track=63
total sectors=4032000
total size=1968.75 megabytes
What should I name the image?
[c.img] Native.img
Writing: [] Done.
I wrote 2064384000 bytes to Native.img.
The following line should appear in your bochsrc:
ata0-master: type=disk, path="Native.img", mode=growing, cylinders=4000, heads=16, spt=63
[编辑]BIOS
另外,还有开机时所要用到的 BIOS。这些 BIOS 已包含于 bochsbios 这个套件中,在安装了 bochsbios 套件后,这些 BIOS 将会出现在 /usr/share/bochs/ 里。其中建议使用的 BIOS 为 BIOS-bochs-latest。
[编辑]显示卡 BIOS
而显示卡也有其专用之 BIOS。这个 BIOS 已包含于 vgabios 这个套件中,在安装了 vgabios 套件后,这些 BIOS 将会出现在 /usr/share/vgabios/ 里。其中建议使用使用的 BIOS 为 vgabios.bin。
硬设备的准备工作就到此为止了。
[编辑]设定 Bochs
当第一次执行 Bochs 时,它会激活一个预设的文字设定接口。其实真的有蛮多需要设定的:
[编辑]内存
在此是将其设定为 64 MB。
Enter memory size (MB): [4] 64
[编辑]操作接口
Bochs 只有提供了 wxWidgets based 的 GUI 设定接口, 其它则全使用文字接口的设定程序,textconfig, 也就是您
from site :http://bbs.cnvz.net/thread-1166-1-1.html