打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Linux内核x86架构引导协议4(翻译)

字段名称:    type_of_loader

类型:           write (obligatory)

偏移/大小:   0x210/1

协议:    2.00+

 

       内核加载程序的ID号。这个ID号是预先分配的。如果你有ID号就应该按照0xTV格式进行填写。其中,T是ID,V是版本号。如果没有就填0xff。

如果你的内核加载程序有一个分配的ID号(见下表)。

如果ID大于0x10,那么超出的部分会写到ext_loader_type字段。同样,超过4位后也会将版本号写到ext_loader_ver字段。

例如:.当T=0x15,V=0x234时,应该写成:

type_of_loader       = 0xe4

ext_loader_type      = 0x05

ext_loader_ver              = 0x23

已分配的内核加载程序ID为:

ID

程序名

0

LILO

1

Loadlin

2

bootsect-loader       (0x20, all other values reserved)

3

Syslinux

4

Etherboot/gPXE

5

ELILO

7

GRUB

8

U-Boot

9

Xen

A

Gujin

B

Qemu

C

Arcturus Networks uCbootloader

E

Extended(see ext_loader_type)

F

Special(0xFF = undefined)

 

如果你想为自己的内核加载程序分配ID请联系:hpa@zytor.com。

 

字段名称:    loadflags

类型:           修改 (obligatory)

偏移/大小:   0x211/1

协议:    2.00+

该字段是位掩码。每位的含义定义如下:

第0位(读):    LOADED_HIGH

              0:内核的保护模式部分需要加载到0x10000处

              1:内核的保护模式部分需要加载到0x100000处(高位内存1MB处).

 

第5位(写):QUIET_FLAG

              0:打印early信息。

              1:禁止打印early信息。

This requests to the kernel (decompressor and early

              kernel) to not write early messages that require

              accessing the display hardware directly.

 

第5位(写): KEEP_SEGMENTS

       协议: 2.07+

              0:在进入32位模式时重新加载段寄存器。

              1:在进入32位模式时不重新加载段寄存器。

              Assume that %cs %ds %ss %es are all set to flat segments with

              a base of 0 (or the equivalent for their environment).

 

第7位 (写): CAN_USE_HEAP

       0:heap_end_ptr无效,setup的某些功能会被禁用。

       1:heap_end_ptr有效。

 

字段名称:    setup_move_size

类型:           修改(obligatory)

偏移/大小:   0x212/2

协议:    2.00-2.01

       当使用2.00或者2.01版的协议时,如果内核的实模式部分没有被加载到0x90000处,需要再加载过程中时进行移动。Fill in this field if you want additional data (such as the kernel command line) moved in addition to the real-mode kernel itself.

The unit is bytes starting with the beginning of the boot sector.

       在2.02及更高版本的协议中,该位被忽略。如果实模式部分代码被加载到0x90000处也可以为忽略。

 

字段名称:    code32_start

类型:           修改 (可选, 重定位)

偏移/大小:   0x214/4

协议:    2.00+

      

  The address to jump to in protected mode.  This defaults to the load

  address of the kernel, and can be used by the boot loader to

  determine the proper load address.

 

为了以下两个目的,会设置该位:

1、用于加载程序钩子(见“高级:加载程序钩子”)

2、如果加载程序没有安装钩子,并且它没有将内核加载到标志位置,那么就需要修改这个字段,将该字段该位指向加载地址。

 

字段名称:    ramdisk_image

类型:           write (obligatory)

偏移/大小:   0x218/4

协议:    2.00+

       初始内存盘或内存文件系统的32位线性地址。如果没有初始内存盘/内存文件系统,需要将该字段设为0(默认)。

 

字段名称:    ramdisk_size

类型:           write (obligatory)

偏移/大小:   0x21c/4

协议:    2.00+

       初始内存盘或内存文件系统的大小。如果没有初始内存盘/内存文件系统,需要将该字段设为0(默认)。

 

字段名称:    bootsect_kludge

类型:           kernel internal

偏移/大小:   0x220/4

协议:    2.00+

       该字段已废弃。

 

字段名称:    heap_end_ptr

类型:           write (obligatory)

偏移/大小:   0x224/2

协议:    2.01+

       将设置该字段为setup末尾的堆栈偏移(相对于内核实模式部分的开始。)最小为0x200。

 

字段名称:    ext_loader_ver

类型:           write (optional)

偏移/大小:   0x226/1

协议:    2.02+

 

  This field is used as an extension of the version number in the

  type_of_loader field.  The total version number is considered to be

  (type_of_loader & 0x0f) + (ext_loader_ver << 4).

 

  The use of this field is boot loader specific.  If not written, it

  is zero.

 

  Kernels prior to 2.6.31 did not recognize this field, but it is safe

  to write for protocol version 2.02 or higher.

 

字段名称:    ext_loader_type

类型:           write (obligatory if (type_of_loader & 0xf0) == 0xe0)

偏移/大小:   0x227/1

协议:    2.02+

 

  This field is used as an extension of the type number in

  type_of_loader field.  If the type in type_of_loader is 0xE, then

  the actual type is (ext_loader_type + 0x10).

 

  This field is ignored if the type in type_of_loader is not 0xE.

 

  Kernels prior to 2.6.31 did not recognize this field, but it is safe

  to write for protocol version 2.02 or higher.

 

字段名称:    cmd_line_ptr

类型:           write (obligatory)

偏移/大小:   0x228/4

协议:    2.02+

 

本字段表示内核命令行的线性地址。内核命令行可以处于setup堆到0xA0000之前的任意位置。不需要的保证和内核实模式部分在相同的64K段内。

       即使你的内核加载程序不支持内核命令参数,也应该填充这个字段。比如指向一个空字符串(最好还是指向一个包含“auto”的字符串)如果本字段为0,内核会断定你的内核加载程序不支持2.02以上版本的引导协议。

 

字段名称:    ramdisk_max

类型:           read

偏移/大小:   0x22c/4

协议:    2.03+

       内存盘或内存文件系统可以被放置的最大地址。在2.02及之前的版本中,这个字段并不存在,并且最大地址是0x37FFFFFF。(这个值足够大,所以是安全的。如果你的内存盘恰好是131072个字节(0x20000)并且这个字段0x37FFFFFF,你最大可以把你的内存盘放到0x37fe0000)。

 

字段名称:    kernel_alignment

类型:           read/modify (reloc)

偏移/大小:   0x230/4

协议:    2.05+ (read), 2.10+ (modify)

       内核对齐要求(如果内核时可重定位的)。当加载可重定向的内核时,需要将内核加载到符合该字段所要求的对齐的位置。

       从2.10版开始,这个字段被用来表达内核的最优对齐要求以便发挥内核的最佳性能,内核加载程序可以将其修改为允许的最少对齐。参考字段min_alignment和pref_address。

 

字段名称:    relocatable_kernel

类型:           read (reloc)

偏移/大小:   0x234/1

协议:    2.05+

       如果该字段为非0值,内核的保护模式部分可以被加载到符合kernel_alignment要求的任意位置。加载完成后,code32_start必须指向内核被加载的位置,或者指向一个内核加载程序钩子。

 

字段名称:    min_alignment

类型:           read (reloc)

偏移/大小:   0x235/1

协议:    2.10+

 

  This field, if nonzero, indicates as a power of two the minimum

  alignment required, as opposed to preferred, by the kernel to boot.

  If a boot loader makes use of this field, it should update the

  kernel_alignment field with the alignment unit desired; typically:

 

       kernel_alignment = 1 << min_alignment

 

  There may be a considerable performance cost with an excessively

  misaligned kernel.  Therefore, a loader should typically try each

  power-of-two alignment from kernel_alignment down to this alignment.

 

字段名称:    cmdline_size

类型:           read

偏移/大小:   0x238/4

协议:    2.06+

除0结束符之外的内核命令行参数的最大大小。也就是说内核命令行可以包含cmdline_size个字符。在2.05及更早的版本中,命令行参数的最大大小是255。

 

字段名称:    hardware_subarch

类型:           write (optional, defaults to x86/PC)

偏移/大小:   0x23c/4

协议:    2.07+

 

  In a paravirtualized environment the hardware low level architectural

  pieces such as interrupt handling, page table handling, and

  accessing process control registers needs to be done differently.

 

  This field allows the bootloader to inform the kernel we are in one

  one of those environments.

 

  0x00000000       The default x86/PC environment

  0x00000001       lguest

  0x00000002       Xen

  0x00000003       Moorestown MID

 

字段名称:    hardware_subarch_data

类型:           write (subarch-dependent)

偏移/大小:   0x240/8

协议:    2.07+

 

  A pointer to data that is specific to hardware subarch

  This field is currently unused for the default x86/PC environment,

  do not modify.

 

字段名称:    payload_offset

类型:           read

偏移/大小:   0x248/4

协议:    2.08+

 

  If non-zero then this field contains the offset from the beginning

  of the protected-mode code to the payload.

 

  The payload may be compressed. The format of both the compressed and

  uncompressed data should be determined using the standard magic

  numbers.  The currently supported compression formats are gzip

  (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A) and LZMA

  (magic number 5D 00).  The uncompressed payload is currently always ELF

  (magic number 7F 45 4C 46).

 

字段名称:    payload_length

类型:           read

偏移/大小:   0x24c/4

协议:    2.08+

 

  The length of the payload.

 

字段名称:    setup_data

类型:           write (special)

偏移/大小:   0x250/8

协议:    2.09+

 

  The 64-bit physical pointer to NULL terminated single linked list of

  struct setup_data. This is used to define a more extensible boot

  parameters passing mechanism. The definition of struct setup_data is

  as follow:

 

  struct setup_data {

         u64 next;

         u32 type;

         u32 len;

         u8  data[0];

  };

 

  Where, the next is a 64-bit physical pointer to the next node of

  linked list, the next field of the last node is 0; the type is used

  to identify the contents of data; the len is the length of data

  field; the data holds the real payload.

 

  This list may be modified at a number of points during the bootup

  process.  Therefore, when modifying this list one should always make

  sure to consider the case where the linked list already contains

  entries.

 

字段名称:    pref_address

类型:           read (reloc)

偏移/大小:   0x258/8

协议:    2.10+

       如果该字段为非0值,那么这个值就是内核保护模式部分被加载到的最优位置。可重定向内核应该尽量最加载到这个位置。而不可重定向的内核会无条件地将自己移动到这个地方并运行。

 

字段名称:    init_size

类型:           read

偏移/大小:   0x25c/4

 

  This field indicates the amount of linear contiguous memory starting

  at the kernel runtime start address that the kernel needs before it

  is capable of examining its memory map.  This is not the same thing

  as the total amount of memory the kernel needs to boot, but it can

  be used by a relocating boot loader to help select a safe load

  address for the kernel.

 

  The kernel runtime start address is determined by the following algorithm:

 

  if (relocatable_kernel)

       runtime_start = align_up(load_address, kernel_alignment)

  else

       runtime_start = pref_address
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
linux 启动协议分析--由boot.txt翻译而来
Linux启动流程之ROM
基于ARM嵌入式 Linux 快速启动
Linux Boot,Kernel 和 Service 介绍
名词解释:什么是安卓的内核kernel?
模块打包方式和加载时机
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服