操作系统真象还原 第二章

 1.创建hd60M.img

yangjun@yangjun-Inspiron-7559:~/bochs$ bin/bximage
========================================================================
                                bximage
  Disk Image Creation / Conversion / Resize and Commit Tool for Bochs
         $Id: bximage.cc 13481 2018-03-30 21:04:04Z vruppert $
========================================================================

1. Create new floppy or hard disk image
2. Convert hard disk image to other format (mode)
3. Resize hard disk image
4. Commit 'undoable' redolog to base image
5. Disk image info

0. Quit

Please choose one [0] 1

Create image

Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd] hd

What kind of image should I create?
Please type flat, sparse, growing, vpc or vmware4. [flat] flat

Choose the size of hard disk sectors.
Please type 512, 1024 or 4096. [512] 

Enter the hard disk size in megabytes, between 10 and 8257535
[10] 60

What should be the name of the image?
[c.img] hd60M.img

The disk image 'hd60M.img' already exists.  Are you sure you want to replace it?
Please type yes or no. [no] yes

Creating hard disk image 'hd60M.img' with CHS=121/16/63 (sector size = 512)

The following line should appear in your bochsrc:
  ata0-master: type=disk, path="hd60M.img", mode=flat

2. 编译mbr,并写入Img

yangjun@yangjun-Inspiron-7559:~/opensource/system/code/c2/a/boot$ nasm -o mbr.bin mbr.S
yangjun@yangjun-Inspiron-7559:~/opensource/system/code/c2/a/boot$ dd if=mbr.bin of=/home/yangjun/bochs/hd60M.img bs=512 count=1 conv=notrunc
记录了1+0 的读入
记录了1+0 的写出
512字节已复制,0.000480522 s,1.1 MB/s

3. 配置bochsrc.disk

megs : 512

#注意路径 必须是你安装的路径 别弄错了
romimage: file=/home/yangjun/bochs/share/bochs/BIOS-bochs-latest
vgaromimage: file=/home/yangjun/bochs/share/bochs/VGABIOS-lgpl-latest

boot: disk

log: bochs.out

mouse:enabled=0
keyboard:keymap=/home/yangjun/bochs/share/bochs/keymaps/x11-pc-us.map

ata0:enabled=1,ioaddr1=0x1f0,ioaddr2=0x3f0,irq=14
ata0-master: type=disk, path="hd60M.img", mode=flat

#gdbstub:enabled=1,port=1234,text_base=0,data_base=0,bss_base=0

4. 运行bochs

yangjun@yangjun-Inspiron-7559:~/bochs$ bin/bochs -f bochsrc.disk 
========================================================================
                       Bochs x86 Emulator 2.6.10
              Built from SVN snapshot on December 1, 2019
                  Compiled on Sep  4 2022 at 08:32:20
========================================================================
00000000000i[      ] BXSHARE not set. using compile time default '/home/yangjun/bochs/share/bochs'
00000000000i[      ] reading configuration from bochsrc.disk
00000000000e[      ] bochsrc.disk:15: ataX-master/slave CHS set to 0/0/0 - autodetection enabled
------------------------------
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: [6] 
00000000000i[      ] installing x module as the Bochs GUI
00000000000i[      ] using log file bochs.out
Next at t=0
(0) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
<bochs:1> c

5. 结果成功

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值