ubuntu下安装bochs

来源:互联网 发布:超星尔雅网络课程登陆 编辑:程序博客网 时间:2024/05/20 13:15
准备工作:
首先,安装以下软件:
sudo   apt-get    bulid-essional (如果以前安装过就免了)
sudo apt-get install xorg-dev
sudo apt-get install bison

安装bochs:
然后到bochs官方网站下载源码包 bochs-2.4.2.tar.gz
解压此文件:tar vxzf bochs-2.4.2.tar.gz
cd bochs-2.4.2
./configure --enable-debugger --enable-disasm
make
sudo make install

注意:在以上过程中可能会遇到错误,不必惊慌,到百度上去找答案吧,而且每次在执行

sudo apt-get install 这条命令时应该退出终端,然后再从头开始一步一步来。


配置bochs:
安装好bochs之后,我们需要对bochs进行配置,其实就是对文件bochrsc进行修改!
《orange's :一个操作系统的实现》的附带光盘里有一个已经配置好的bochrsc,但
是它是针对bochs2.3版本的,所以不能用!!!我们需要重新修改bochrsc!
首先将附带光盘里的chapter1子目录下的文件夹a 移动到/home/roothoo/,(主要是为

是让a.img 和 bochsrc在同一文件夹下,其次,这个文件夹如果没有,可以自己新建个文

件夹),然后对bochrc进行修改如下:

注意,#是注释符号!即#之后的语句是无效的,其实#就相当于C+语言中的//
###############################################################
# Configuration file for Bochs
###############################################################

# how much memory the emulated machine will have
megs: 32

# filename of ROM images
#romimage: file=/usr/local/share/bochs/BIOS-bochs-latest
romimage: file=$BXSHARE/BIOS-bochs-latest
#vgaromimage: /usr/local/share/vgabios/vgabios.bin
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest

# what disk images will be used
floppya: 1_44=a.img, status=inserted

# choose the boot disk.
boot: floppy

# where do we send log messages?
# log: bochsout.txt

# disable the mouse
mouse: enabled=0

# enable key mapping, using US layout as default.
keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-us.map

注意看字体为红色的那两句!

修改好之后,别忘了保存!
最后,我们运行bochs
cd      /home/roothoo/a   #我们切换到a.img 和 bochsrc所在的文件夹,
bochs     -f    bochsrc    #以bochsrc为配置文件启动bochs
然后选择6,
然后再按c键,
OK!!!

ENJOY! -_-


其中针对可能出现的一些问题,列出了以下解决方案:

问题1:   checking for C compiler default output file name… configure: error: C compiler cannot create       executables   解决办法:   [thornbird@thornbird bochs-2.4]$ sudo apt-get install libc6-dev问题2:   ...   checking how to run the C++ preprocessor... /lib/cpp   configure: error: C++ preprocessor "/lib/cpp" fails sanity check   See `config.log' for more details.   解决方法:   [thornbird@thornbird bochs-2.4]$ sudo apt-get install build-essential  问题3:   [thornbird@thornbird bochs-2.4]$ make   make: *** 没有指明目标并且找不到 makefile.停止。   解决方法:   [thornbird@thornbird bochs-2.4]$ sudo apt-get install build-essential   问题4:   ...   checking for wxWidgets library version...   checking for default gui on this platform... x11   ERROR: X windows gui was selected, but X windows libraries were not found.   解决方法: 配置的时候加上"--with-nogui "   或者改成:[thornbird@thornbird bochs-2.4]$sudo apt-get install xorg-dev (建议)问题5:    Package gtk+-2.0 was not found in the pkg-config search path.Perhaps you should add the directory         containing    `gtk+-2.0.pc'to the PKG_CONFIG_PATH environment variableNo package 'gtk+-2.0' foundERROR:      pkg-config was not found, or unable to access the gtk+-2.0 package.Install pkg-config and      the       gtk+ development package,or disable the gui debugger, or the wxWidgets display library (whichever is    being used).    解决方法:    [thornbird@thornbird bochs-2.4]$sudo apt-get install libgtk2.0-dev  问题6:    install: 无法获取"./bochsdbg" 的文件状态(stat): 没有该文件或目录    解决办法:需要在make后,将bochs拷贝一份,命名为bochsdbg    [thornbird@thornbird bochs-2.4]$ cp bochs bochsdbg 


原创粉丝点击