bochs x86模拟器
最近在做操作系统方面的研究,不得不去下一个虚拟机来用。由于我不使用Windows,所以选择很少了。因为在Linux上,差不多就只有两款好的虚拟机——Bochs和Qemu。这两个之中,Bochs是用C++编写,能在很多平台上使用,而且不论什么平台,它都不倚赖主机的指令系统,总是模拟x86。所以我选择了Bochs。但是,我惊讶地发现关于如何在Linux上使用Bochs的资料很少。Bochs自带的文档中讲得也不很明确,而且还是英文的。所以我写了这篇文章。
到Bochs的主页: http://bochs.sourceforge.net 上下载最新的Bochs RPM安装包。(写这篇文章时,最新的版本是2.2.1。)以root的身份安装:
#rpm -ivh bochs-2.2.1-1.i586.rpm
其实RPM安装包给你装上了四个新程序:bochs,bochs-dlx,bximage,bxcommit,以及相关文档。安装完毕后,你可以先试试bochs-dlx,它是DLX Linux的一个demo。
$ bochs-dlx
---------------------------------------------------------------
DLX Linux Demo, for Bochs x86 Emulator
---------------------------------------------------------------
Checking for bochs binary...ok
Checking for DLX linux directory...ok
Checking for /usr/bin/gzip...ok
Checking for /home/wangcong/.bochsdlx directory...ok
Entering /home/wangcong/.bochsdlx
Running bochs
00000000000i[APIC?] local apic in initializing
========================================================================
Bochs x86 Emulator 2.2.1
Build from CVS snapshot on July 8, 2005
========================================================================
00000000000i[ ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins'
00000000000i[ ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[ ] reading configuration from bochsrc.txt
00000000000i[ ] lt_dlhandle is 0x8bac490
00000000000i[PLGIN] loaded plugin libbx_x.la
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
马上,你就会看到一个X11窗口。
显示的是VGA BIOS信息,然后是加载Linux的信息。以root身份登录,试试DLX Linux。安装成功。
下面是一些重要的文件:
/usr/bin/bochs | Bochs启动程序 |
/usr/bin/bximage | Bochs带的制作磁盘镜像文件的工具 |
/usr/bin/bxcommit | 把redolog放进flat磁盘镜像文件中去的交互工具 |
/usr/share/doc/bochs/bochsrc-sample.txt | Bochs配置文件的例子 |
/usr/share/bochs/BIOS-bochs-* | ROM BIOS镜像文件 |
/usr/share/bochs/VGABIOS-* | 与VGA BIOS镜像文件相关的文件 |
/usr/bin/bochs-dlx | 启动Bochs中DLX linux的程序 |
/usr/share/bochs/dlxlinux/ | DLX Linux的目录,包含它的磁盘镜像文件和配置文件 |
/usr/share/bochs/keymaps/*.map | X11和SDL的keymap列表 |
命令bohcs可以接受4个参数:-q 加载配置文件后跳过开始菜单;-f configfile 识别指定的配制文件;-n 不加载配置文件;-h 打印帮助信息;-qf configfile 相当于同时使用-q和-f两个选项。使用Bochs,你必须有一个配置文件,或者你通过-f参数指定,或者让Bochs自己搜索。配置文件的作用是告诉Bochs到哪里寻找镜像文件,模拟层如何工作等。Bochs搜索配置文件的顺序是:
<TT CLASS="FILENAME">.bochsrc 在当前目录中
bochsrc 在当前目录中
<TT CLASS="FILENAME">bochsrc.txt 在当前目录中
.bochsrc 在用户的主目录中
bochsrc 在 /etc 目录中
以dlx-linux的配置文件为例,讲一下如何定制你需要的配置文件。dlx-linux的配置文件是/usr/share/doc/bochs目录中的bochsrc-sample.txt。它的内容如下:
###############################################################
# bochsrc.txt file for DLX Linux disk image.
################################################################ how much memory the emulated machine will have
megs: 32# filename of ROM images
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest# what disk images will be used
floppya: 1_44=floppya.img, status=inserted
floppyb: 1_44=floppyb.img, status=inserted# hard disk
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="hd10meg.img", cylinders=306, heads=4, spt=17# choose the boot disk.
boot: c# default config interface is textconfig.
#config_interface: textconfig
#config_interface: wx#display_library: x
# other choices: win32 sdl wx carbon amigaos beos macintosh nogui rfb term svga# where do we send log messages?
log: bochsout.txt# disable the mouse, since DLX is text only
mouse: enabled=0# enable key mapping, using US layout as default.
#
# NOTE: In Bochs 1.4, keyboard mapping is only 100% implemented on X windows.
# However, the key mapping tables are used in the paste function, so
# in the DLX Linux example I'm enabling keyboard_mapping so that paste
# will work. Cut&Paste is currently implemented on win32 and X windows only.keyboard_mapping: enabled=1, map=$BXSHARE/keymaps/x11-pc-us.map
#keyboard_mapping: enabled=1, map=$BXSHARE/keymaps/x11-pc-fr.map
#keyboard_mapping: enabled=1, map=$BXSHARE/keymaps/x11-pc-de.map
#keyboard_mapping: enabled=1, map=$BXSHARE/keymaps/x11-pc-es.map
以#开头的每一行都是注释。注释写得很明白。
megs: 32
指明想要模拟32M的内存。注意:后面的数字最大为2048,但是因为主机系统的限制,在大多数系统上,Bochs甚至不能支持1024M。
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
指明ROM的镜像文件在哪,开机时ROM BIOS被加载到哪里。$BXSHARE是环境变量,指明 Bochs的share目录,在Linux上为/usr/share/bochs。这一般不用改动。下面的vgaromimage 指明VGA ROM的镜像文件位置。
floppya: 1_44=floppya.img, status=inserted
floppyb: 1_44=floppyb.img, status=inserted
floppya是第一软驱,floppyb是第二软驱。后面标明的是软驱镜像文件的位置,软盘是否插入。可以根据你的需要做适当的修改。
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="hd10meg.img", cylinders=306, heads=4, spt=17
打开ata0通道,另外还有ata1,ata2,ata3。对于每一个通道,都必须指明两个IO地址和IRQ。 ata0是默认被打开的,它的ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14。ata0-master 是主ata0通道,后面指明它附带的设备是硬盘,硬盘镜像文件路径,硬盘柱面数,磁头数等参数。
boot: c
指明启动次序,可以是cdrom,floppy,disk。不过由于历史的原因a和c也能被接受。也可以这样来写:
boot: cdrom, floppy, disk
mouse: enabled=0
指明鼠标是否可见。
keyboard_mapping: enabled=1, map=$BXSHARE/keymaps/x11-pc-us.map
打开对虚拟US键盘的重映射,keymap必须被指明。
更多的配置文件选项说明见/usr/share/doc/bochs/user/bochsrc.html。如何编写键盘的keymap列表见/usr/share/doc/bochs/user/keymap.html。
bximage是Bochs自带的制作磁盘镜像的工具,具有良好的交互性,使用很方便。运行bximage,你会看到:
========================================================================
bximage
Disk Image Creation Tool for Bochs
$Id: bximage.c,v 1.25.2.1 2005/07/06 20:40:00 vruppert Exp $
========================================================================Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd]
询问我们是建立一个软盘镜像还是硬盘镜像,默认的是硬盘。我们直接按回车,选择硬盘镜像。
What kind of image should I create?
Please type flat, sparse or growing. [flat]
我们想建立一个简单的镜像,选择默认的flat。回车。
Enter the hard disk size in megabytes, between 1 and 32255
[10]
想要多少Mbyte的大小?键入你想要的大小。
I will create a 'flat' hard disk image with
cyl=2
heads=16
sectors per track=63
total sectors=2016
total size=0.98 megabytesWhat should I name the image?
[c.img]
在上一步中输入“1”后,显示相关的硬盘信息。询问想要什么镜像文件名字?默认的是 c.img。输入hd.img回车。
Writing: [] Done.
I wrote 1032192 bytes to hd.img.
The following line should appear in your bochsrc:
ata0-master: type=disk, path="hd.img", mode=flat, cylinders=2, heads=16, spt=63
建立完毕。然后你就可以使用这个镜像,用Bochs做实验了。
另外Bochs还有强大的调试功能,详细请参阅用户手册第8章。Bochs主页上还有一些做好的系统镜像,比如:OpenBSD,FreeDOS等。不妨下载一个来试试。 Bochs的确是一款优秀的工具,我推荐给每一位做操作系统研究的朋友。
转载于:https://www.cnblogs.com/darknife/p/3151394.html
bochs x86模拟器相关推荐
- Andriod Atom x86模拟器启动报错
用Inter Atom模式的Android模拟器启动报一下错误: Starting emulator for AVD 'new' emulator: ERROR: x86 emulation curr ...
- Android* 4.1.1 (Jelly Bean) x86 模拟器系统映像
x86 Android* 4.1 (Jelly Bean) 模拟器系统映像支持您在您的开发机器上运行 Android 模拟. 通过与 Android SDK 结合使用,您可以在基于英特尔架构的虚拟 A ...
- 红石模拟器android,Win10 Mobile红石3支持x86模拟器
Win10的一大特点就是Continuum,该功能可以让手机像电脑那样使用.根据微软观察员Mary Jo Foley的消息,Win10 Mobile Redstone 3版将加入对x86程序模拟器的支 ...
- surface 3安装android x86,Surface Phone新技能:Win10 Mobile红石3支持x86模拟器
IT之家讯 Win10的一大特点就是Continuum,该功能可以让手机像电脑那样使用.根据微软观察员Mary Jo Foley的消息,Win10 Mobile Redstone 3版将加入对x86程 ...
- 龙芯linux x86 模拟器,关于linux for loongson和wine的一些疑问,请大神解答,谢谢。...
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 我不是学计算机专业的,学过C语言,对计算机有一些疑问,可能问题比较幼稚,但也希望有大神能够向我解释一下,谢谢! 1.我们都知道,任何程序都是由高级语言转换 ...
- 微软开发x86模拟器,让Windows for ARM能运行x86应用
微软公司计划在ARM芯片之上模拟x86指令,并将这种兼容性引入未来的Windows平板与手机当中. 将遗留应用放在这里,其将有种宾至如归的感觉 这一名为Cobalt的项目应该会在今年之内即可与广大用户 ...
- android打开x86模拟器失败
在使用Android Studio打开AVD模拟器时,无法打开模拟器并提示出现错误: intel haxm is required to run this AVD. HAXM is not insta ...
- genymotion模拟器配置X86模拟器加速器
网上下载zip包 http://download.csdn.net/download/we5868123/9430140 直接拖进去即可,虚拟机不能使用管理员权限启动 名字为:解决genymotion ...
- mac 安装bochs汇编模拟器
安装bochs 1. Mac安装bochs 直接用brew进行安装 brew install bochs 通过下载bochs-2.6.11.tar.gz 版本不固定 这个方式暂时不搞: 2. 配置启动 ...
最新文章
- Metasploit 使用后门和Rootkit维持访问
- 抖音日活用户破 6 亿,推荐系统到底有何魔力?
- eureka的惊群效应
- JavaScript 技术篇-通过代码获取dom元素绑定的监听事件,chrome浏览器查看js元素绑定的监听事件
- 一直都很喜欢的软件--基于平台
- 曾凭一己之力推动物理学发展,是清华大学最年轻教授,世界却欠他一个诺贝尔奖!...
- element form自定义校验_SpringBoot分组校验及自定义校验注解
- C#巧妙实现服务器端应用程序和asp网页交互
- 清明上河图30亿像素_清明上河图全图下载
- python自动生成字幕_语音自动转文字和自动生成字幕
- 荣耀4a刷android 6,华为荣耀4a刷机教程_华为荣耀4a强刷官方系统包
- Refseq : accession id to taxonomy lineage.
- 微信扫码登入 改变二维码样式
- 深度学习中IOU的含义
- 复现SCRDet:Towards More Robust Detection for Small, Cluttered and Rotated Objects(ICCV2019)遇到的问题及解决方案
- matlab工具箱及应用 pdf,matlab工具箱中文.pdf
- 微信小程序开发的四种文件
- 《会计基础:前言》学习笔记
- PLS-00103: 出现符号 在需要下列之一时 ( ; is with oracle利用存储过程设计定时器的问题
- html页面 消除横向滚动条,框架网页中去掉横向(水平)滚动条的方法