ubuntu下源码安装bochs

本文详细介绍了如何通过下载、解压、配置、编译和安装Bochs虚拟机,最终在桌面环境中实现其运行的过程。包括配置安装路径、启动方式、环境变量设置等步骤,以及如何在终端中执行Bochs以开始模拟操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

假设你已经装好了gcc,g++

下载bochs最新源码

http://sourceforge.net/projects/bochs/files/bochs/

我下载的是bochs-2.6.8.tar.gz

解压 tar -xvf bochs-2.6.8.tar.gz

进入解压目录cd bochs-2.6.8,目录里你会发现configure配置文件

输入./configure --help你将会知道如何进行配置

eagle@eagle-QJC4:~/Downloads/bochs-2.6.8$ ./configure --help

`configure' configures this package to adapt to many kinds of systems.


Usage: ./configure [OPTION]... [VAR=VALUE]...


To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.


Defaults for the options are specified in brackets.


Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']


Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

                                                                                   这两句是设置安装路径

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.


For better control, use the options below.


Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]

等等......



bochs默认安装在/usr/local/ 目录下(上面红字部分),我将其改到了桌面,命令如下

 sudo ./configure --prefix=/home/eagle/Desktop/bochs --exec-prefix=/home/eagle/Desktop/bochs --enable-debugger --enable-disasm

当然你也可以把红色的部分换到你喜欢的路径

后面的--enable-debugger 意思是允许调试 --enable-disasm意思是允许反汇编也可以不设置

之后执行

make

make install

执行完后你会发现自己的桌面上多了一个名为bochs的文件夹呢.

打开bochs文件夹会有两个文件夹 bin  和  share

bin里面是安装好的bochs执行./bochseagle@eagle-QJC4:~/Desktop/bochs/bin$ ./bochs 
========================================================================
                       Bochs x86 Emulator 2.6.8
                Built from SVN snapshot on May 3, 2015
                  Compiled on Dec  5 2015 at 10:44:41
========================================================================
00000000000i[      ] BXSHARE not set. using compile time default '/home/eagle/Desktop/bochs/share/bochs'
------------------------------
Bochs Configuration: Main Menu
------------------------------


This is the Bochs Configuration Interface, where you can describe the
machine that you want to simulate.  Bochs has already searched for a
configuration file (typically called bochsrc.txt) and loaded it if it
could be found.  When you are satisfied with the configuration, go
ahead and start the simulation.


You can also start bochs with the -q option to skip these menus.


1. Restore factory default configuration
2. Read options from...
3. Edit options
4. Save options to...
5. Restore the Bochs state from...
6. Begin simulation
7. Quit now


Please choose one: [2] 


这说明安装好了呢!!!


你可以在当前目录执行./bochs运行,也可以把安装好的bochs放到环境变量里,这样你就可以在

任何地方直接敲入bochs直接运行bochs了呢!!

$ vim ~/.bashrc

#BOCHS
export BOCHS=/home/eagle/Desktop/bochs
export PATH=...............$BOCHS/bin:$PATH

上面的...............表示前面还有其他设置直接在$PATH前面添加$BOCHS/bin:即可

之后保存退出,    :wq

好了,自由的使用bochs吧

Chapter 1 x86 体系结构与PC 系统概要.....................................1 1.1 x86 CPU 结构...............................................................................................................1 1.1.1 冯诺依曼架构和CISC 指令集......................................................................1 1.1.2 CPU 结构........................................................................................................1 1.1.3 CPU 工作模式................................................................................................2 1.2 x86 体系结构概览........................................................................................................3 1.3 PC 系统.........................................................................................................................5 1.3.1 PC 系统概述...................................................................................................5 2.3.2 总线拓扑.........................................................................................................6 2.3.3 存储器与I/O 编址.........................................................................................6 2.3.4 关于系统的启动与引导.................................................................................8 Chapter 2 Bochs 工程概述....................................................... 11 2.1 开源项目Bochs 介绍.................................................................................................11 2.2 版本2.2.1 源码组织..................................................................................................11 2.3 工程类结构.................................................................................................................12 2.4 主体框架结构分析.....................................................................................................13 2.4.1 Bochs 工程中的重要类................................................................................13 (1) VM 控制台界面类.............................................................................................13 (2) CPU 模拟............................................................................................................14 (3) Memory 模拟......................................................................................................14 (4).I/O device 模拟...................................................................................................15 2.4.2 入口函数main()及Win32 Gui 初始化........................................................15 2.5 Bochs 的工作方式......................................................................................................18 Chapter 3 CPU 类的源码分析...................................................20 3.1 CPU 类概述................................................................................................................20 3.1.1 CPU 逻辑结构框图......................................................................................20 3.1.2 类BX_CPU_C 成员归纳.............................................................................20 3.2 类BX_CPU_C 源码分析..........................................................................................21 3.2.1 CPU 特性声明..............................................................................................21 3.2.2 类bxInstruction_c 成员分析........................................................................22 3.2.3 类BX_CPU_C 源码注释.............................................................................22 3.3 通用寄存器.................................................................................................................29 3.3.1 数据结构与注释...........................................................................................29 3.3.2 通用寄存器归纳...........................................................................................30 3.4 段寄存器、全局寄存器GDI 和IDT ........................................................................31 3.4.1 数据结构与注释...........................................................................................31 3.4.2 段寄存器结构分析.......................................................................................33 3.5 CPU 状态字EFLAGS................................................................................................35 3.5.1 数据结构与注释...........................................................................................35
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值