diff options
Diffstat (limited to 'Documentation/x86/boot.txt')
| -rw-r--r-- | Documentation/x86/boot.txt | 122 |
1 files changed, 114 insertions, 8 deletions
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index e0203662f9e9..8da3a795083f 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt | |||
| @@ -50,6 +50,10 @@ Protocol 2.08: (Kernel 2.6.26) Added crc32 checksum and ELF format | |||
| 50 | Protocol 2.09: (Kernel 2.6.26) Added a field of 64-bit physical | 50 | Protocol 2.09: (Kernel 2.6.26) Added a field of 64-bit physical |
| 51 | pointer to single linked list of struct setup_data. | 51 | pointer to single linked list of struct setup_data. |
| 52 | 52 | ||
| 53 | Protocol 2.10: (Kernel 2.6.31) Added a protocol for relaxed alignment | ||
| 54 | beyond the kernel_alignment added, new init_size and | ||
| 55 | pref_address fields. Added extended boot loader IDs. | ||
| 56 | |||
| 53 | **** MEMORY LAYOUT | 57 | **** MEMORY LAYOUT |
| 54 | 58 | ||
| 55 | The traditional memory map for the kernel loader, used for Image or | 59 | The traditional memory map for the kernel loader, used for Image or |
| @@ -168,12 +172,13 @@ Offset Proto Name Meaning | |||
| 168 | 021C/4 2.00+ ramdisk_size initrd size (set by boot loader) | 172 | 021C/4 2.00+ ramdisk_size initrd size (set by boot loader) |
| 169 | 0220/4 2.00+ bootsect_kludge DO NOT USE - for bootsect.S use only | 173 | 0220/4 2.00+ bootsect_kludge DO NOT USE - for bootsect.S use only |
| 170 | 0224/2 2.01+ heap_end_ptr Free memory after setup end | 174 | 0224/2 2.01+ heap_end_ptr Free memory after setup end |
| 171 | 0226/2 N/A pad1 Unused | 175 | 0226/1 2.02+(3 ext_loader_ver Extended boot loader version |
| 176 | 0227/1 2.02+(3 ext_loader_type Extended boot loader ID | ||
| 172 | 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line | 177 | 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line |
| 173 | 022C/4 2.03+ ramdisk_max Highest legal initrd address | 178 | 022C/4 2.03+ ramdisk_max Highest legal initrd address |
| 174 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel | 179 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel |
| 175 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not | 180 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not |
| 176 | 0235/1 N/A pad2 Unused | 181 | 0235/1 2.10+ min_alignment Minimum alignment, as a power of two |
| 177 | 0236/2 N/A pad3 Unused | 182 | 0236/2 N/A pad3 Unused |
| 178 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line | 183 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line |
| 179 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture | 184 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture |
| @@ -182,6 +187,8 @@ Offset Proto Name Meaning | |||
| 182 | 024C/4 2.08+ payload_length Length of kernel payload | 187 | 024C/4 2.08+ payload_length Length of kernel payload |
| 183 | 0250/8 2.09+ setup_data 64-bit physical pointer to linked list | 188 | 0250/8 2.09+ setup_data 64-bit physical pointer to linked list |
| 184 | of struct setup_data | 189 | of struct setup_data |
| 190 | 0258/8 2.10+ pref_address Preferred loading address | ||
| 191 | 0260/4 2.10+ init_size Linear memory required during initialization | ||
| 185 | 192 | ||
| 186 | (1) For backwards compatibility, if the setup_sects field contains 0, the | 193 | (1) For backwards compatibility, if the setup_sects field contains 0, the |
| 187 | real value is 4. | 194 | real value is 4. |
| @@ -190,6 +197,8 @@ Offset Proto Name Meaning | |||
| 190 | field are unusable, which means the size of a bzImage kernel | 197 | field are unusable, which means the size of a bzImage kernel |
| 191 | cannot be determined. | 198 | cannot be determined. |
| 192 | 199 | ||
| 200 | (3) Ignored, but safe to set, for boot protocols 2.02-2.09. | ||
| 201 | |||
| 193 | If the "HdrS" (0x53726448) magic number is not found at offset 0x202, | 202 | If the "HdrS" (0x53726448) magic number is not found at offset 0x202, |
| 194 | the boot protocol version is "old". Loading an old kernel, the | 203 | the boot protocol version is "old". Loading an old kernel, the |
| 195 | following parameters should be assumed: | 204 | following parameters should be assumed: |
| @@ -343,18 +352,32 @@ Protocol: 2.00+ | |||
| 343 | 0xTV here, where T is an identifier for the boot loader and V is | 352 | 0xTV here, where T is an identifier for the boot loader and V is |
| 344 | a version number. Otherwise, enter 0xFF here. | 353 | a version number. Otherwise, enter 0xFF here. |
| 345 | 354 | ||
| 355 | For boot loader IDs above T = 0xD, write T = 0xE to this field and | ||
| 356 | write the extended ID minus 0x10 to the ext_loader_type field. | ||
| 357 | Similarly, the ext_loader_ver field can be used to provide more than | ||
| 358 | four bits for the bootloader version. | ||
| 359 | |||
| 360 | For example, for T = 0x15, V = 0x234, write: | ||
| 361 | |||
| 362 | type_of_loader <- 0xE4 | ||
| 363 | ext_loader_type <- 0x05 | ||
| 364 | ext_loader_ver <- 0x23 | ||
| 365 | |||
| 346 | Assigned boot loader ids: | 366 | Assigned boot loader ids: |
| 347 | 0 LILO (0x00 reserved for pre-2.00 bootloader) | 367 | 0 LILO (0x00 reserved for pre-2.00 bootloader) |
| 348 | 1 Loadlin | 368 | 1 Loadlin |
| 349 | 2 bootsect-loader (0x20, all other values reserved) | 369 | 2 bootsect-loader (0x20, all other values reserved) |
| 350 | 3 SYSLINUX | 370 | 3 Syslinux |
| 351 | 4 EtherBoot | 371 | 4 Etherboot/gPXE |
| 352 | 5 ELILO | 372 | 5 ELILO |
| 353 | 7 GRUB | 373 | 7 GRUB |
| 354 | 8 U-BOOT | 374 | 8 U-Boot |
| 355 | 9 Xen | 375 | 9 Xen |
| 356 | A Gujin | 376 | A Gujin |
| 357 | B Qemu | 377 | B Qemu |
| 378 | C Arcturus Networks uCbootloader | ||
| 379 | E Extended (see ext_loader_type) | ||
| 380 | F Special (0xFF = undefined) | ||
| 358 | 381 | ||
| 359 | Please contact <hpa@zytor.com> if you need a bootloader ID | 382 | Please contact <hpa@zytor.com> if you need a bootloader ID |
| 360 | value assigned. | 383 | value assigned. |
| @@ -453,6 +476,35 @@ Protocol: 2.01+ | |||
| 453 | Set this field to the offset (from the beginning of the real-mode | 476 | Set this field to the offset (from the beginning of the real-mode |
| 454 | code) of the end of the setup stack/heap, minus 0x0200. | 477 | code) of the end of the setup stack/heap, minus 0x0200. |
| 455 | 478 | ||
| 479 | Field name: ext_loader_ver | ||
| 480 | Type: write (optional) | ||
| 481 | Offset/size: 0x226/1 | ||
| 482 | Protocol: 2.02+ | ||
| 483 | |||
| 484 | This field is used as an extension of the version number in the | ||
| 485 | type_of_loader field. The total version number is considered to be | ||
| 486 | (type_of_loader & 0x0f) + (ext_loader_ver << 4). | ||
| 487 | |||
| 488 | The use of this field is boot loader specific. If not written, it | ||
| 489 | is zero. | ||
| 490 | |||
| 491 | Kernels prior to 2.6.31 did not recognize this field, but it is safe | ||
| 492 | to write for protocol version 2.02 or higher. | ||
| 493 | |||
| 494 | Field name: ext_loader_type | ||
| 495 | Type: write (obligatory if (type_of_loader & 0xf0) == 0xe0) | ||
| 496 | Offset/size: 0x227/1 | ||
| 497 | Protocol: 2.02+ | ||
| 498 | |||
| 499 | This field is used as an extension of the type number in | ||
| 500 | type_of_loader field. If the type in type_of_loader is 0xE, then | ||
| 501 | the actual type is (ext_loader_type + 0x10). | ||
| 502 | |||
| 503 | This field is ignored if the type in type_of_loader is not 0xE. | ||
| 504 | |||
| 505 | Kernels prior to 2.6.31 did not recognize this field, but it is safe | ||
| 506 | to write for protocol version 2.02 or higher. | ||
| 507 | |||
| 456 | Field name: cmd_line_ptr | 508 | Field name: cmd_line_ptr |
| 457 | Type: write (obligatory) | 509 | Type: write (obligatory) |
| 458 | Offset/size: 0x228/4 | 510 | Offset/size: 0x228/4 |
| @@ -482,11 +534,19 @@ Protocol: 2.03+ | |||
| 482 | 0x37FFFFFF, you can start your ramdisk at 0x37FE0000.) | 534 | 0x37FFFFFF, you can start your ramdisk at 0x37FE0000.) |
| 483 | 535 | ||
| 484 | Field name: kernel_alignment | 536 | Field name: kernel_alignment |
| 485 | Type: read (reloc) | 537 | Type: read/modify (reloc) |
| 486 | Offset/size: 0x230/4 | 538 | Offset/size: 0x230/4 |
| 487 | Protocol: 2.05+ | 539 | Protocol: 2.05+ (read), 2.10+ (modify) |
| 540 | |||
| 541 | Alignment unit required by the kernel (if relocatable_kernel is | ||
| 542 | true.) A relocatable kernel that is loaded at an alignment | ||
| 543 | incompatible with the value in this field will be realigned during | ||
| 544 | kernel initialization. | ||
| 488 | 545 | ||
| 489 | Alignment unit required by the kernel (if relocatable_kernel is true.) | 546 | Starting with protocol version 2.10, this reflects the kernel |
| 547 | alignment preferred for optimal performance; it is possible for the | ||
| 548 | loader to modify this field to permit a lesser alignment. See the | ||
| 549 | min_alignment and pref_address field below. | ||
| 490 | 550 | ||
| 491 | Field name: relocatable_kernel | 551 | Field name: relocatable_kernel |
| 492 | Type: read (reloc) | 552 | Type: read (reloc) |
| @@ -498,6 +558,22 @@ Protocol: 2.05+ | |||
| 498 | After loading, the boot loader must set the code32_start field to | 558 | After loading, the boot loader must set the code32_start field to |
| 499 | point to the loaded code, or to a boot loader hook. | 559 | point to the loaded code, or to a boot loader hook. |
| 500 | 560 | ||
| 561 | Field name: min_alignment | ||
| 562 | Type: read (reloc) | ||
| 563 | Offset/size: 0x235/1 | ||
| 564 | Protocol: 2.10+ | ||
| 565 | |||
| 566 | This field, if nonzero, indicates as a power of two the minimum | ||
| 567 | alignment required, as opposed to preferred, by the kernel to boot. | ||
| 568 | If a boot loader makes use of this field, it should update the | ||
| 569 | kernel_alignment field with the alignment unit desired; typically: | ||
| 570 | |||
| 571 | kernel_alignment = 1 << min_alignment | ||
| 572 | |||
| 573 | There may be a considerable performance cost with an excessively | ||
| 574 | misaligned kernel. Therefore, a loader should typically try each | ||
| 575 | power-of-two alignment from kernel_alignment down to this alignment. | ||
| 576 | |||
| 501 | Field name: cmdline_size | 577 | Field name: cmdline_size |
| 502 | Type: read | 578 | Type: read |
| 503 | Offset/size: 0x238/4 | 579 | Offset/size: 0x238/4 |
| @@ -582,6 +658,36 @@ Protocol: 2.09+ | |||
| 582 | sure to consider the case where the linked list already contains | 658 | sure to consider the case where the linked list already contains |
| 583 | entries. | 659 | entries. |
| 584 | 660 | ||
| 661 | Field name: pref_address | ||
| 662 | Type: read (reloc) | ||
| 663 | Offset/size: 0x258/8 | ||
| 664 | Protocol: 2.10+ | ||
| 665 | |||
| 666 | This field, if nonzero, represents a preferred load address for the | ||
| 667 | kernel. A relocating bootloader should attempt to load at this | ||
| 668 | address if possible. | ||
| 669 | |||
| 670 | A non-relocatable kernel will unconditionally move itself and to run | ||
| 671 | at this address. | ||
| 672 | |||
| 673 | Field name: init_size | ||
| 674 | Type: read | ||
| 675 | Offset/size: 0x25c/4 | ||
| 676 | |||
| 677 | This field indicates the amount of linear contiguous memory starting | ||
| 678 | at the kernel runtime start address that the kernel needs before it | ||
| 679 | is capable of examining its memory map. This is not the same thing | ||
| 680 | as the total amount of memory the kernel needs to boot, but it can | ||
| 681 | be used by a relocating boot loader to help select a safe load | ||
| 682 | address for the kernel. | ||
| 683 | |||
| 684 | The kernel runtime start address is determined by the following algorithm: | ||
| 685 | |||
| 686 | if (relocatable_kernel) | ||
| 687 | runtime_start = align_up(load_address, kernel_alignment) | ||
| 688 | else | ||
| 689 | runtime_start = pref_address | ||
| 690 | |||
| 585 | 691 | ||
| 586 | **** THE IMAGE CHECKSUM | 692 | **** THE IMAGE CHECKSUM |
| 587 | 693 | ||
