环境:
virtual-box:版本 6.0.10 r132072 (Qt5.6.2)运行的的ubuntu18.04系统。
nasm汇编器:NASM version 2.13.02
1)安装bochs
sudo apt-get install bochs bochs-x
注意:bochs-x要安装,否则会出现>>PANIC<< dlopen failed for module ‘x’: file not found错误,因为没有xwindows组件,无法显示图像。
2)img引导启动软盘制作
安装了bochs后,该软件提供一个bximage工具可以制作img文件。
制作步骤如下:
注意到有一行提示:floppya: image=“boot.img”, status=inserted,这行是用于的bochs配置。
我们创建bochs的配置文件如下:
vim bochsrc.txt
在这里插入代码片
# You many now use double quotes around pathnames, in case
# your pathname includes spaces.
#=======================================================================
# MEGS
#内存16MB
#=======================================================================
megs: 16
#=======================================================================
# ROMIMAGE:
# The ROM BIOS controls what the PC does when it first powers on.
#BIOS选择BIOS-bochs-latest
#=======================================================================
romimage: file=$BXSHARE/BIOS-bochs-latest
#=======================================================================
# VGAROMIMAGE
# You now need to load a VGA ROM BIOS into C0000.
#VGABIOS选择VGABIOS-lgpl-latest
#=======================================================================
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
#=======================================================================
# FLOPPYA, FLOPPYB:
# Point this to pathname of floppy image file or device
#软盘a选择boot.img,状态为inserted
#=======================================================================
floppya: 1_44="boot.img", status=inserted
#=======================================================================
# BOOT:
#引导启动盘选择a盘
#=======================================================================
boot: a
#boot: c
#=======================================================================
# LOG:
# Give the path of the log file you'd like Bochs debug and misc.
#log输出选择/dev/null设备,丢弃。log文件输出会很大!!!
#=======================================================================
log: /dev/null
#log: bochsout.txt
#=======================================================================
# VGA_UPDATE_INTERVAL:
#=======================================================================
3)bochs使用方法
bochs -h
可以查看bochs的使用方法,如下:
其中的
bochs -f bochsrx.txt
就可以指定使用我们的配置文件bochsrx.txt运行一个模拟系统。不过,目前的floppya中的boot.img并没有内容。没有系统可以运行。