李则良 2009年06月15日 星期一 23:20 | 2030次浏览 | 4条评论
一直对li
THE LINUX/I386 BOOT PROTOCOL
----------------------------
LINUX/I386启动协议
----------------------------
H. Peter Anvin <hpa@zytor.com>
Last update 2007-05-23
最后更新于2007-05-23
On the i386 platform, the Linux kernel uses a rather complicated boot convention.
在i386平台上,Linux内核采用了一个相当复杂的引导过程。
This has evolved partially due to historical aspects, as well as the desire in the early days to have the kernel itself be a bootable image, the complicated PC memory model and due to changed expectations in the PC industry caused by the effective demise of real-mode DOS as a mainstream operating system.
这个变体部分是由于历史原因,即早期的让内核自己可以做成一个可启动的镜像,复杂的个人计算机的内存模式,以及个人计算机工业方向的改变,这个改变是由于实模式DOS作为主流操作系统的时代的结束所导致的。
Currently, the following versions of the Linux/i386 boot protocol exist.
现在,下面将列出基于i386的linux启动协议版本的变迁过程.
Old kernels: zImage/Image support only. Some very early kernels may not even support a command line.
早期内核:只支持zImage(压缩镜像)/Image(镜像)。还有一些更早的内核甚至连命令行都不支持。
Protocol 2.00:
(Kernel 1.3.73) Added bzImage and initrd support, as well as a formalized way to communicate between the boot loader and the kernel. setup.S made relocatable,although the traditional setup area still assumed writable.
协议2.00:(内核1.3.73开始)增加了bzImage(大压缩镜像)和initrd(激活文件系统)支持,即一种正规的方式让引导加载程序和内核进行通信。setup.S建造一块可移动的,但是仍旧可写的传统的装载区域。
Protocol 2.01:
(Kernel 1.3.76) Added a heap overrun warning.
协议2.01:(内核1.3.76开始)增加了堆溢出警告。
Protocol 2.02:
(Kernel 2.4.0-test3-pre3) New command line protocol.Lower the conventional memory ceiling.No overwrite of the traditional setup area, thus making booting safe for systems which use the EBDA from SMM or 32-bit BIOS entry points. zImage deprecated but still supported.
协议2.02:(内核2.4.0-test3-pre3开始)新的命令行标准。更低常规内存利用。不再覆盖传统的setup区域,因此使得那些使用SMM或32-位BIOS入口地址的EBDA的系统启动更安全。
Protocol 2.03: (Kernel 2.4.18-pre1) Explicitly makes the highest possible initrd address available to the bootloader.
协议2.03:(内核 2.4.18-pre1 )明确确定了高端initrd地址可以被引导装载。
Protocol 2.04: (Kernel 2.6.14) Extend the syssize field to four bytes.
协议2.04:(内核2.6.14) 扩展syssize域到四个字节。
Protocol 2.05: (Kernel 2.6.20) Make protected mode kernel relocatable.Introduce relocatable_kernel and kernel_alignment fields.
协议2.05:(内核2.6.20)使得保护模式下的内核可以重定位。引入relocatable_kernel和kernel_alignment域。
Protocol 2.06: (Kernel 2.6.22) Added a field that contains the size of the boot command line.
协议2.06:(内核2.6.22) 增加了一个域,用来存放启动命令行的大小。
Protocol 2.07: (Kernel 2.6.24) Added paravirtualised boot protocol. Introduced hardware_subarch and hardware_subarch_data and KEEP_SEGMENTS flag in load_flags.
协议2.07:(内核2.6.24)增加了超凡的启动规则。引入了hardware_subarch和hardware_subarch_data域以及load_flags中的KEEP_SEGMENTS标志。
Protocol 2.08: (Kernel 2.6.26) Added crc32 checksum and ELF format payload. Introduced payload_offset and payload_length fields to aid in locating the payload.
协议2.08:(内核2.6.26) 增加了crc32校验和以及ELF格式有效负载。为了标识有效负载引入了payload_offset和payload_length域。
Protocol 2.09: (Kernel 2.6.26) Added a field of 64-bit physical pointer to single linked list of struct setup_data.
协议2.08:(内核2.6.26) 增加了一个64位的物理指针域去管理struct setup_data类型的单链表。
**** MEMORY LAYOUT
**** 内存布局
The traditional memory map for the kernel loader, used for Image or zImage kernels, typically looks like:
使用了Image或zImage的内核引导器,其传统的内存分部大概是这样:
|
0A0000
+------------------------+
| Reserved for BIOS
保留为BIOS使用
Do not use. Reserved for BIOS EBDA. 未使用。为BIOS EBDA使用。
09A000
+------------------------+
| Command line 命令行
|
| Stack/heap 栈或堆
|
For use by the kernel real-mode code. 用于内核实模式的代码。
098000
+------------------------+
| Kernel setup 内核加载程序驻留区
|
The kernel real-mode code. 内核实模式代码。
090200
+------------------------+
| Kernel boot sector
内核启动扇区。
|
The kernel legacy boot sector. 历史遗留下来的内核引导扇区。
090000
+------------------------+
| Protected-mode kernel |
保护模式内核
The bulk of the kernel image.内核镜像的主要部分。
010000
+------------------------+
| Boot loader
引导扇区。
|
<- Boot sector entry point 0000:7C00 启动扇区加载点。
001000
+------------------------+
| Reserved for MBR/BIOS | 保留为MBR或BIOS使用
000800
+------------------------+
| Typically used by MBR | 专门用于MBR
000600
+------------------------+
| BIOS use only
只供BIOS使用
|
000000
+------------------------+
When using bzImage, the protected-mode kernel was relocated to
0x100000 ("high memory"), and the kernel real-mode block (boot sector,
setup, and stack/heap) was made relocatable to any address between
0x10000 and end of low memory. Unfortunately, in protocols 2.00 and
2.01 the 0x90000+ memory range is still used internally by the kernel;
the 2.02 protocol resolves that problem.
It is desirable to keep the "memory ceiling" -- the highest point in
low memory touched by the boot loader -- as low as possible, since
some newer BIOSes have begun to allocate some rather large amounts of
memory, called the Extended BIOS Data Area, near the top of low
memory.
The boot loader should use the "INT 12h" BIOS call to verify
how much low memory is available.
Unfortunately, if INT 12h reports that the amount of memory is too
low, there is usually nothing the boot loader can do but to report an
error to the user. The boot loader should therefore be designed to
take up as little space in low memory as it reasonably can. For
zImage or old bzImage kernels, which need data written into the
0x90000 segment, the boot loader should make sure not to use memory
above the 0x9A000 point; too many BIOSes will break above that point.
For a modern bzImage kernel with boot protocol version >= 2.02, a
memory layout like the following is suggested:
~ ~
| Protected-mode kernel |
100000 +------------------------+
| I/O memory hole
|
0A0000
+------------------------+
| Reserved for BIOS
|
Leave as much as possible unused
~ ~
| Command line
|
(Can also be below the X+10000 mark)
X+10000
+------------------------+
| Stack/heap
|
For use by the kernel real-mode code.
X+08000
+------------------------+
| Kernel setup
|
The kernel real-mode code.
| Kernel boot sector
|
The kernel legacy boot sector.
X +------------------------+
| Boot loader
|
<- Boot sector entry point 0000:7C00
001000
+------------------------+
| Reserved for MBR/BIOS |
000800
+------------------------+
| Typically used by MBR |
000600
+------------------------+
| BIOS use only
|
000000
+------------------------+
... where the address X is as low as the design of the boot loader
permits.
Zeuux © 2024
京ICP备05028076号
回复 夏武 2009年06月16日 星期二 09:28
回复 李则良 2009年06月16日 星期二 10:49
好
谢谢