环境准备
1. 环境清单
-
ubuntu-16.04.2-desktop-amd64.iso
-
nasm-2.14rc16
-
bochs-2.6.9
-
其他基本工具
gcc as ld make dd mount umount cp sync rm objdump objcopy
2. ubuntu 环境准备
2.1 工具及资料
-
VMware 15
-
ubuntu-16.04.2-desktop-amd64.iso 镜像百度云地址
链接:https://pan.baidu.com/s/1GBZYgG4jZobmV6O5ezKE-A 提取码:jsd4
2.2 ubuntu配置信息如以下
3. 基本工具安装
3.1 安装方式
- 在安装如gcc等基本工具时 直接
sudo apt-get install gcc
即可,注意每一个工具都需要安装
3.2 校验方式
-
在命令行中输入对应命令有相关提示即可,如下gcc, 注意:如果提示信息是提示没有相关命令则是没有安装成功, 如随意输入mycommand
root@huang:~# gcc gcc: fatal error: no input files compilation terminated. root@huang:~# mycommand mycommand: command not found
4. nasm安装
- 资料下载: 资料下载
4.1 安装命令
# 拉取安装包
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14rc16/nasm-2.14rc16.tar.gz
# 解压文件
tar -zxvf nasm-2.14rc16.tar.gz
# 进入解压包
cd nasm-2.14rc16/
./configure
make
make install
# 查看安装是否成功
root@huang:~# nasm -v
NASM version 2.14rc16 compiled on Mar 20 2021
5. bochs安装
5.1 安装命令
- 注意:以下安装命令./configure多行实际为一条命令不能分开执行
# 拉取安装包
wget https://nchc.dl.sourceforge.net/project/bochs/bochs/2.6.9/bochs-2.6.9.tar.gz
# 解压
tar -zxvf bochs-2.6.9.tar.gz
# 安装
./configure --with-x11 --with-wx --enable-debugger --enable-disasm --enable-all-optimizations --enable-readline --enable-long-phy-address --enable-ltdl-install --enable-idle-hack --enable-plugins --enable-a20-pin --enable-x86-64 --enable-smp --enable-cpu-level=6 --enable-large-ramfile --enable-repeat-speedups --enable-fast-function-calls --enable-handlers-chaining --enable-trace-linking --enable-configurable-msrs --enable-show-ips --enable-cpp --enable-debugger-gui --enable-iodebug --enable-logging --enable-assert-checks --enable-fpu --enable-vmx=2 --enable-svm --enable-3dnow --enable-alignment-check --enable-monitor-mwait --enable-avx --enable-evex --enable-x86-debugger --enable-pci --enable-usb --enable-voodoo
# make前需要修改
apt-get install -y libxrandr-dev
cp misc/bximage.cpp misc/bximage.cc
cp iodev/hdimage/hdimage.cpp iodev/hdimage/hdimage.cc
cp iodev/hdimage/vmware3.cpp iodev/hdimage/vmware3.cc
cp iodev/hdimage/vmware4.cpp iodev/hdimage/vmware4.cc
cp iodev/hdimage/vpc-img.cpp iodev/hdimage/vpc-img.cc
cp iodev/hdimage/vbox.cpp iodev/hdimage/vbox.cc
# make install
make install
5.2 验证安装
- 命令行中输入bochs 即出现以下内容
# 命令行验证
root@huang:~# bochs
========================================================================
Bochs x86 Emulator 2.6.9
Built from SVN snapshot on April 9, 2017
Compiled on Mar 20 2021 at 10:39:02
========================================================================
00000000000i[ ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/local/lib/bochs/plugins'
00000000000i[ ] BXSHARE not set. using compile time default '/usr/local/share/bochs'
00000000000i[ ] lt_dlhandle is 0x25d6050
00000000000i[PLUGIN] loaded plugin libbx_usb_common.so
00000000000i[ ] lt_dlhandle is 0x25d69d0
00000000000i[PLUGIN] loaded plugin libbx_unmapped.so
00000000000i[ ] lt_dlhandle is 0x25d71d0
00000000000i[PLUGIN] loaded plugin libbx_biosdev.so
00000000000i[ ] lt_dlhandle is 0x25d7b10
00000000000i[PLUGIN] loaded plugin libbx_speaker.so
00000000000i[ ] lt_dlhandle is 0x25d8900
00000000000i[PLUGIN] loaded plugin libbx_extfpuirq.so
00000000000i[ ] lt_dlhandle is 0x25d9140
00000000000i[PLUGIN] loaded plugin libbx_parallel.so
00000000000i[ ] lt_dlhandle is 0x25dad50
00000000000i[PLUGIN] loaded plugin libbx_serial.so
00000000000i[ ] lt_dlhandle is 0x25df100
00000000000i[PLUGIN] loaded plugin libbx_iodebug.so
------------------------------
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]
5.3 验证出错解决
-
错误提示内容
Bochs is exiting with the following message: [ ] .bochsrc:914: Bochs is not compiled with lowlevel sound support
-
错误解决
-
根据提示进入bochs得安装目录钟找到.bochsrc文件并且注释其中得914行
-
具体被注释内容如下
# sound: driver=default, waveout=/dev/dsp. wavein=, midiout=
-