OS Boot Sequence
来源:互联网 发布:中文域名骗局中科瑞 编辑:程序博客网 时间:2024/06/07 17:25
当BIOS INT 19h被执行以后,系统进入OS Booting阶段。
下面定义几个程序段名称:
NameDescriptionSize limitMaster Booter放置于Hard disk的第一个扇区(即MBR),用于装载boot block的程序。466 bytesBoot Sector放置与Floppy的第一个扇区,或者Hard disk的某一分区的第一个扇区的用于装载Secondary boot,或其它程序的可运行程序。512 bytesSecondary Boot放置于非Floppy/Hard disk的第一个扇区,以及Hard disk的任意分区的第一个扇区之外的任意其它位置,用于装载OS,或其它程序的可运行程序。no limit
当用硬盘启动OS的时候,以上调用顺序为 MB -> BS -> SB -> OS;
当用软盘启动OS的时候,以上调用顺序为 BS -> SB -> OS。
当机器被打开时,等电源稳定之后,电源会发送一个“加电成功信号”给芯片,以启动时钟生成器(8284);
1.2.4.2 软盘启动
相对于硬盘启动过程,软盘启动则要简单的多,只需要将boot sector程序放置于软盘的第一个扇区。当INT 19从软盘启动的时候,会自动将boot sector读入内存的7C00h的位置,然后跳转到7C00h开始执行。
1.2.4.1 硬盘启动
硬盘的第一个扇区(sector)被称作MBR(Master Boot Record)。由于硬盘可以有多个分区,所以在MBR上,不仅放置着用于启动的可执行代码master boot,还放着磁盘分区表(DPT),占用66个字节,所以MBR中的可执行代码必须在512 - 66 = 446个字节以内。
OffsetContentSize0hMaster booting programmax 466 bytes01BEhDisk Partition Table64 bytes01FEhSignature (HEX 55 AA)2 bytes
Table 1.2.1- MBR Layout
OffsetContentSize01BEhPartition 1 data table16 bytes01CEhPartition 2 data table16 bytes01DEhPartition 3 data table16 bytes01FEhPartition 4 data table16 bytes
Table 1.2.2 - DPT Layout
OffsetContentData Type00hboot indicatorbyte01hbeginning sector head numberbyte02hbeginning sector (2 high bits of cylinder #)byte03hbeginning cylinder# (low order bits of cylinder #)byte04hsystem indicatorbyte05hending sector head numberbyte06hending sector (2 high bits of cylinder #)byte07hending cylinder# (low order bits of cylinder #)byte08hnumber of sectors preceding the partitiondword(4 bytes)0Bhnumber of sectors in the partitiondword
Table 1.2.3 - Layout of Partition Data Table
Boot indicator (BYTE)
00 - non-bootable partition
80 - bootable partition (one partition only)
System Indicator (BYTE)
00 - unknown operating system
01 - DOS with 12 bit FAT, 16 bit sector number
02 - XENIX
04 - DOS with 16 bit FAT, 16 bit sector number
05 - DOS Extended partition (DOS 3.3+)
06 - DOS 4.0 (Compaq 3.31), 32 bit sector number
51 - Ontrack extended partition
64 - Novell
75 - PCIX
DB - CP/M
FF – BBT
Signature
Hex 55AA marks the end of valid boot sector.
This is also required in each of the partition boot records.
What does master booter should do?
INT 19会将MBR的512 bytes load到内存0x7c00中,然后JUMP到0x7c00处,开始执行MBR的可执行程序master booter,Master booter最起码需要做这些事情:
- 检测MAGIC(Signature)是否为合法值(Hex 55AA);
将自己移动到其它位置,将0x7C00到0x7c00+512K的空间让出来,以备其后将boot sector程序装入这个位置,这样才能和直接从软盘直接装入boot sector程序相一致;具体移动到什么位置,则根据设计而定,理论上,可以移动到任何非冲突位置(即没有被预留为其它程序所用的位置);但一般情况下,都是在0X000800至0X0A0000之间寻找一端空间存放。
查看分区表,将被设为活动的分区的第一个Sector装入0X7C00的位置,正常的情况下,此Sector放置的就是boot sector程序;
最终,master booter跳转到0X7C00的位置,开始执行boot sector。
- OS Boot Sequence
- System Boot Sequence
- ARM Linux Boot Sequence
- ARM Linux Boot Sequence
- ARM Linux Boot Sequence
- ARM Linux Boot Sequence
- 初识Linux--Boot Sequence
- ARM Linux Boot Sequence
- Android Init Boot Sequence
- ARM Linux Boot Sequence
- android boot sequence
- Linux Boot Sequence
- Solaris SPARC Boot Sequence
- Linux Kernel boot sequence
- smp boot up sequence
- USB Boot / Portable OS
- Change the grub boot sequence:
- 1.6 Boot Sequence 学习笔记
- minix masterboot解读
- joj1063
- centOs 安装rrdtool 步骤
- poj3487 稳定婚姻问题
- Android四种Activity的加载模式
- OS Boot Sequence
- 关于标识唯一性的一段测试代码
- 打造我自己的NetBSD
- 《深入理解计算机系统》链接之符号表
- Android中的broadCastReceiver
- 数据结构_内部排序_链式基数排序
- Red Hat企业版5 卸载virbr0
- 项目经理修炼之道(2) -- 必须读的书
- jquery 浏览器类型判断