用bochs调试mbr--安装问题

来源:互联网 发布:iptables端口转发 编辑:程序博客网 时间:2024/05/17 08:12

1.下载bochs 2.4版本
2.打开bochs目录下的dlxlinux文件夹
3.在这个文件夹下放入镜像文件(xxx.img)
(百度bochs xp镜像下载)
4.配置bochsrc.bxrc(根据自己命名的img文件替换下面的代码)

# how much memory the emulated machine will havemegs: 512#   #号表示注释 类似于C++中的// 这里的意思是设置512MB内存# filename of ROM imagesromimage: file=../BIOS-bochs-latestvgaromimage: file=../VGABIOS-lgpl-latest#设置主板的bios和显卡的bios     ../这个的意思是返回上一层目录 也就是C:\bochs目录# what disk images will be used floppya: 1_44=floppya.img, status=insertedfloppyb: 1_44=floppyb.img, status=inserted#设置软盘的参数 # hard diskata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14ata0-master: type=disk, path="xp.img", mode=flat, cylinders=3047, heads=16, spt=63#注意这里 一定要填对  我的硬盘参数是这个  我应该这么填# choose the boot disk.boot: c#从光驱引导 填c表示从“硬盘”启动,这个可是指我们的虚拟硬盘# default config interface is textconfig.#config_interface: textconfig#config_interface: wx#display_library: x# other choices: win32 sdl wx carbon amigaos beos macintosh nogui rfb term svga# where do we send log messages?log: bochsout.txt#日志文件  可以不用关心 # disable the mouse, since DLX is text onlymouse: enabled=0#默认不启用鼠标 #如果要启用或者禁用鼠标请按ctrl+第三个鼠标键(也就是滚轮 滚轮也是可以按下去的)ata0-slave: type=cdrom, path="XP.iso", status=inserted#这个原来没有是需要自己添加  指定了一个cdrom

ata0-master: type=disk, path=”xp.img”, mode=flat, cylinders=3047, heads=16, spt=63
上面这一句需要与你的镜像文件匹配,参数需要算
参数算法:

1.使用DiskGenius2.打开虚拟硬盘文件(xxx.img)3.spt是每道扇区数(自己看)4.cyl = (int) (hdsize*1024.0*1024.0/16.0/63.0/512.0)hdsize是这个虚拟硬盘的大小,单位兆5.总扇区数(diskgenius上看)=cyl*spt*headers

以上算法算出三个参数,自行修改bxrc文件
5.配置run.bat文件

cd "C:\bochs\dlxlinux"..\bochs -q -f bochsrc.bxrc

这样是打开虚拟机
6.双击run.bat即可

调试的话修改run.bat内容,可能下篇会写

原创粉丝点击