假设你已经装好了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吧