# The configuration file for Linux kernel 0.12.
# For detailed information about each parameters see the file
# bochsrc-sample.txt included in bochs.
#=======================================================================
# MEGS
# Set the number of Megabytes of physical memory you want to emulate.
#设置被模拟系统所含的内存容量,默认32M
#=======================================================================
megs: 32
#=======================================================================
# 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.
#VGA BIOS映像文件,默认为:VGABIOS-lgpl-latest
#=======================================================================
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
#=======================================================================
# CPU:
# This defines cpu-related parameters inside Bochs: Examples:
#
# Bochs Machine/Compiler Mips
# ____________________________________________________________________
# 2.2.6 2.6Ghz Intel Core 2 Duo with WinXP/g++ 3.4 21 to 25 Mips
# 2.2.6 2.1Ghz Athlon XP with Linux 2.6/g++ 3.4 12 to 15 Mips
# 2.0.1 1.6Ghz Intel P4 with Win2000/g++ 3.3 5 to 7 Mips
#配置CPU,该项有4个参数分别是:
#count设置CPU个数,当编译Bochs软件包时选用了支持SMP选项,则Bochs目前可以支持最多8个同时运行的线程,如果不是支持SMP,则count只能是1
#ips是指每秒钟仿真的指令条数
#reset_on_triple_fault用来指定当处理器发生三重错误时需要对CPU执行复位操作,而不是仅仅让其停机,
#quantum用来指定控制从一个处理器切换到另一个之前最多可执行的指令数量该选项也仅适用于支持SMP的Bochs执行程序
#=======================================================================
#cpu: count=1, ips=10000000, reset_on_triple_fault=1
#=======================================================================
# FLOPPYA,FLOPPYB:
# Point this to pathname of floppy image file or device
#floppya表示第一个软驱,floppyb表示第二个软驱,如果需要从软盘上引导系统,那么floppya就需要指向一个可引导的磁盘,若想使用磁盘映像文件,那么
#我们就可以在该选项后写上磁盘映像文件的名称,如:floppya: 1_44="bootimage-0.12-hd"
#floppya: 1_44=/dev/fd0, status=inserted Linux系统下直接访问1.44MB A:盘
#floppya: 1_44=b:, status=inserted Win32系统下直接访问1.44MB B:盘
#floppya: 1_44=bootimage.img, status=inserted 指向映像磁盘文件bootimage.img
#floppyb: 1_44=..\Linux\rootimage.img, status=inserted 指向上级目录Linux/下的rootimage.img映像文件
#=======================================================================
floppya: 1_44="bootimage-0.12-hd", status=inserted
floppyb: 1_44="diskb.img", status=inserted
#=======================================================================
# ATA[0-3]-MASTER, ATA[0-3]-SLAVE
#
# This defines the type and characteristics of all attached ata devices:
# type= type of attached device [disk|cdrom]
# mode= only valid for disks [flat|concat|external|dll|sparse|vmware3]
# mode= only valid for disks [undoable|growing|volatile]
# path= path of the image
# cylinders= only valid for disks
# heads= only valid for disks
# spt= only valid for disks
# status= only valid for cdroms [inserted|ejected]
# biosdetect= type of biosdetection [none|auto], only for disks on ata0 [cmos]
# translation=type of translation of the bios, only for disks [none|lba|large|rechs|auto]
# model= string returned by identify device command
# journal= optional filename of the redolog for undoable and volatile disks
#
# Point this at a hard disk image file, cdrom iso file, or physical cdrom
# device. To create a hard disk image, try running bximage. It will help you
# choose the size and then suggest a line that works with it.
#
# In UNIX it may be possible to use a raw device as a Bochs hard disk,
# but WE DON'T RECOMMEND IT. In Windows there is no easy way.
#
# In windows, the drive letter + colon notation should be used for cdroms.
# Depending on versions of windows and drivers, you may only be able to
# access the "first" cdrom in the system. On MacOSX, use path="drive"
# to access the physical drive.
#
# The path is always mandatory. Disk geometry autodetection works with images
# created by bximage if CHS is set to 0/0/0 (cylinders are calculated using
# heads=16 and spt=63). For other hard disk images and modes the cylinders,
# heads, and spt are mandatory.
#
# Default values are:
# mode=flat, biosdetect=auto, translation=auto, model="Generic 1234"
#
# The biosdetect option has currently no effect on the bios
#
# Examples:
# ata0-master: type=disk, mode=flat, path=10M.sample, cylinders=306, heads=4, spt=17
# ata0-slave: type=disk, mode=flat, path=20M.sample, cylinders=615, heads=4, spt=17
# ata1-master: type=disk, mode=flat, path=30M.sample, cylinders=615, heads=6, spt=17
# ata1-slave: type=disk, mode=flat, path=46M.sample, cylinders=940, heads=6, spt=17
# ata2-master: type=disk, mode=flat, path=62M.sample, cylinders=940, heads=8, spt=17
# ata2-slave: type=disk, mode=flat, path=112M.sample, cylinders=900, heads=15, spt=17
# ata3-master: type=disk, mode=flat, path=483M.sample, cylinders=1024, heads=15, spt=63
# ata3-slave: type=cdrom, path=iso.sample, status=inserted
#ata0-master用来指明模拟系统中第1个ATA通道(0通道)上连接的第1个ATA设备(硬盘或CDROM等)
#ata0-slave指明第1个通道上连接的第2个ATA设备例如:type=disk, path="rootimage-0.12-hd", mode=flat, cylinders=487, heads=16, spt=63
#type表示连接的设备类型,可选disk,cdrom
#path映像文件路径
#mode映像文件类型,仅对disk有效,flat,concat,external,dll,sparse,vmware3,undoable,growing,volatile
#cylinders,heads,spt仅对disk有效
#=======================================================================
ata0-master: type=disk, path="rootimage-0.12-hd", mode=flat, cylinders=487, heads=16, spt=63
#ata0-slave: type=disk, path="rootimage-0.12-hd1", mode=flat, cylinders=487, heads=16, spt=63
#ata0,ata1,ata2,ata3这四个参数名用来启动模拟系统中最多4个ATA通道,对于每个启用的通道必须指明两个IO基地址和一个中断请求号
#ata0:enabled=1,ioaddr1=0x1f0,ioaddr2=0x3f0,irq=14
#ata1:enabled=1,ioaddr1=0x170,ioaddr2=0x370,irq=15
#ata2:enabled=1,ioaddr1=0x1e8,ioaddr2=0x3e0,irq=11
#ata3:enabled=1,ioaddr1=0x168,ioaddr2=0x360,irq=9
#=======================================================================
# BOOT:
#用于定义模拟机器中用于引导启动的驱动器,可以指定软盘、硬盘或CDROM也可以使用驱动器号c、b
#=======================================================================
boot: floppy
#boot: disk
#boot: a
#boot: c
#=======================================================================
# disable the mouse, since DLX is text only
#=======================================================================
mouse: enabled=0
#=======================================================================
# LOG:
#指定log的路径名可以让Bochs记录执行的一些日志信息,如果在Bochs中运行的系统不能正常运行,就可以参考其中的信息来找原因
#=======================================================================
#log: /dev/null
log: bochsout.txt
#=======================================================================
# LOG CONTROLS
#=======================================================================
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
#debug: action=ignore
#=======================================================================
# VGA_UPDATE_INTERVAL:
#=======================================================================
vga_update_interval: 300000
一、首先通过bochsrc-0.12-fd.bxrc软盘启动:
更换软盘
二、直接通过硬盘bochsrc-0.12-hd.bxrc启动:
直接回车
输入:root即可进入系统
三、在window中读写linux系统中的文件
1、首先查看配置文件bochsrc-0.12-hd.bxrc中floppyb: 1_44="diskb.img", status=inserted选项可知此软盘对应的是diskb.img文件,在读写之前先用UltraISO程序查看一下该文件的内容,如下图所示:
2、在linux0.12系统中使用mcopy hello.c b:拷贝一个文件到floppyb中即diskb.img中,会出现
Reset-floppy called错误如下图所示:
3、当出现此错误时,将其关闭在重新启动,先执行mdir a: 然后在执行mdir b: 如下图所示:
4、然后在执行mcopy hello.c b:,如下图所示:
5、然后在使用UltraISO打开diskb.img镜像文件,可以查看到拷贝进去的文件,如下图所示:
6、同理通过UltraISO向diskb.img文件中添加一个helloworld.txt文件,如下图所示:
7、然后再次使用mcopy b:helloworld.txt拷贝到系统中去(注意:文件名字不能过长),如下图所示:
8、这就实现了和模拟系统文件互相拷贝。