64位Ubuntu 13.04 安装Bochs 2.3.5

bochs 2.3.5源码编译

网上编译bochs的资料非常多,基本的问题都有解决方案,我重点讲不常见的问题。 基本安装步骤

tar vxzf bochs-2.3.5.tar.gz
cd bochs-2.3.5
sudo ./configure --enable-debugger --enable-disasm --enable-x86-64 LDFLAGS=-L/usr/lib/i386-linux-gnu
sudo make sudo make install 

bochs是c++实现的,因此其依赖环境会有build-esstianl g++ devlib等,需事先安装环境

sudo apt-get install build-essential
sudo apt-get install xorg-dev //GUI界面
sudo apt-get install bison

在执行./configure时,出现apt-get orgx-dev后依旧出现仍然提示ERROR: X windows gui was selected, but X windows libraries were not found 采用解决办法:

只要编译的时候连接了 -lX11这个库就可以了,所以可以让configure阶段出错的地方不退出,并且在make的时候link X11这个库,编辑configure, 将退出的地方注释掉

echo ERROR: X windows gui was selected, but X windows libraries were not found.
    #exit 1
configure命令后加 LDFLAGS=-L/usr/lib/i386-linux-gnu 


该问题不能用--with-nogui解决,否则无法输出hello os,因为需要使用gui

make之前需要修改一份文件bx_debug/symbol.cc

在97行之后加入代码如下,
using namespace std;

#ifdef __GNUC__ //修改
using namespace __gnu_cxx; //修改
#endif //修改

struct symbol_entry_t


在编译安装完成之后,需要在img文件夹里创建bochsrc.txt。内容如下:


############################################################### 
# Configuration file for Bochs(Linux) 
###############################################################
 
#=======================================================================
# filename of ROM images 
#=======================================================================
romimage: file=$BXSHARE/BIOS-bochs-latest 
 
#=======================================================================
# VGAROMIMAGE
# You now need to load a VGA ROM BIOS into C0000.
#=======================================================================
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=0, map=
 
#=======================================================================
# how much memory the emulated machine will have
#=======================================================================
megs: 32