《x86汇编语言 从实模式到保护模式》第8章Linux环境实验记录

实验环境:ubuntu16.04LTS,bochs2.6.11

实验环境搭建可参考链接: 《Orange’s 一个操作系统的实现》第一、二章(搭建工作环境ubuntu16.04LTS+bochs2.6.11).

1.编译配书源码

nasm c08_mbr.asm -o c08_mbr.bin
nasm c08.asm -o c08.asm

2.创建硬盘映像

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] 

What kind of image should I create?
Please type flat, sparse, growing, vpc or vmware4. [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] 

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

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

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

3.使用dd写硬盘

dd if=c08_mbr.bin of=c.img bs=512 conv=notrunc

dd if=c08.bin of=c.img bs=512 seek=100 conv=notrunc

4.修改bochs配置文件

############################
# Configurate filefor Bochs#
############################
 
# how much memorythe emulated machine will have
megs: 32
 
# filename of ROMimages
romimage:file=/usr/local/share/bochs/BIOS-bochs-latest
vgaromimage:file=/usr/local/share/bochs/VGABIOS-lgpl-latest
 
# what disk imageswill be used
#floppya:1_44=a.img, status=inserted
 
# choose the bootdisk.
boot: disk
 
# where do we sendlog messages?
log: bochsout.txt
 
# disable themouse
mouse: enabled=0
 
# enable keymapping, using Us layout as default
keyboard:keymap=/usr/local/share/bochs/keymaps/x11-pc-us.map


ata0-master: type=disk, path="c.img", mode=flat

5.执行

bochs -f bochsrc
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值