参考: Linux内核完全注释-修正版V5.0-赵炯
1.引导
# 环境
# centos6.5
# as86安装
# 搜索地址
https://rpmfind.net/linux/rpm2html/search.php?query=as86&submit=Search+...&system=&arch=
wget -c https://rpmfind.net/linux/centos/6.10/os/x86_64/Packages/dev86-0.16.17-15.1.el6.x86_64.rpm
rpm -ivh dev86-0.16.17-15.1.el6.x86_64.rpm
# boot.s
----------
!
! boot.s
!
.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
.text
BOOTSEG = 0x07c0
entry start
start:
jmpi go,BOOTSEG
go: mov ax,cs
mov ds,ax
mov es,ax
mov [msg1+17],ah
mov cx,#20
mov dx,#0x1004
mov bx,#0x000c
mov bp,#msg1
mov ax,#0x1301
int 0x10
loop1: jmp loop1
msg1: .ascii "Vincent's OS -- VOS"
.byte 13,10
.org 510
.word 0xAA55
.text
endtext:
.data
enddata:
.bss
endbss:
-----------
# 编译
as86 -0 -a -o boot.o boot.s
# 链接
ld86 -0 -s -o boot boot.o
# 生成镜像,去掉前32字节
dd bs=32 if=boot of=/root/a.img skip=1
# 下载模拟器
https://sourceforge.net/projects/bochs/files/bochs/2.3.6# 这里选择2.3.6 exe
# 安装后,进入目录,新建配置文件
# bochsrc
----------
megs:32
romimage:file=$BXSHARE/BIOS-bochs-latest
vgaromimage:file=$BXSHARE/VGABIOS-lgpl-latest
floppya:1_44=a.img,status=inserted
boot:floppy
log:bochsout.txt
mouse:enabled=0
----------
# 运行模拟器
.\bochs.exe -f bochsrc
image.png
网友评论