操作系统之旅(004)—— 使用bochs

下载bochs2.6.8(下载地址)
通过共享文件夹拷贝到Ubuntu下,解压并安装

解压bochs源代码压缩包,Terminal进入bochs代码根目录,输入命令:

./configure --prefix=/home/reborn/Applications/bochs-2.6.8 --enable-debugger --enable-disasm --enable-iodebug --enable-x86-debugger --with-x --with-x11

提示没有C编译器,执行命令:sudo apt install gcc,然后再此执行configure命令

提示缺少C++相关库,执行命令:sudo apt install build-essential,然后再此执行configure命令

提示缺少x windows相关库,执行命令:sudo apt install libx11-dev,然后再次执行configure命令提示缺少gtk相关库,执行命令:sudo apt install libgtk2.0-dev,然后再次执行configure命令configure没有提示错误,继续执行make命令,make install命令,完成安装。然后再安装一个gdb版bochs,./configure --prefix=/home/reborn/Applications/bochs-gdb --enable-gdb-stubmakemake install下面测试bochs。cd到linux代码目录下,执行命令:/home/reborn/Applications/bochs-2.6.8/bin/bximage

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
选择1,
Create image

Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd] 
输入fd,回车
Choose the size of floppy disk image to create, in megabytes.
Please type 160k, 180k, 320k, 360k, 720k, 1.2M, 1.44M, 1.68M, 1.72M, or 2.88M.
 [1.44M] 
默认1.44m,直接回车
What should be the name of the image?
[a.img] bootimg-fd.img
给软盘映像起个名,回车

创建一个bochs配置文件,touch linux.bxrc
用文本编辑器打开此文件,输入以下并保存
megs: 16
romimage: file=/home/reborn/Applications/bochs-2.6.8/share/bochs/BIOS-bochs-latest
vgaromimage: file=/home/reborn/Applications/bochs-2.6.8/share/bochs/VGABIOS-lgpl-latest
boot: floppy
log: bochs.log
mouse: enabled=0
keyboard: keymap=/home/reborn/Applications/bochs-2.6.8/share/bochs/keymaps/x11-pc-us.map
floppya: image="bootimage-fd.img", status=inserted
命令:dd if=bootsect.bin of=bootimage-fd.img bs=512 count=1 conv=notrunc
命令:/home/reborn/Applications/bochs-2.6.8/bin/bochs -f linux.bxrc
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.log
Next at t=0
(0) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
<bochs:1>
输入c,回车,如图显示Loading system ...说明前一节和本节成功。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值