Skip to content

Commit 8b84769

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
Documentation/x86, efi/x86: Clarify EFI handover protocol and its requirements
The EFI handover protocol was introduced on x86 to permit the boot loader to pass a populated boot_params structure as an additional function argument to the entry point. This allows the bootloader to pass the base and size of a initrd image, which is more flexible than relying on the EFI stub's file I/O routines, which can only access the file system from which the kernel image itself was loaded from firmware. This approach requires a fair amount of internal knowledge regarding the layout of the boot_params structure on the part of the boot loader, as well as knowledge regarding the allowed placement of the initrd in memory, and so it has been deprecated in favour of a new initrd loading method that is based on existing UEFI protocols and best practices. So update the x86 boot protocol documentation to clarify that the EFI handover protocol has been deprecated, and while at it, add a note that invoking the EFI handover protocol still requires the PE/COFF image to be loaded properly (as opposed to simply being copied into memory). Also, drop the code32_start header field from the list of values that need to be provided, as this is no longer required. Reviewed-by: Borislav Petkov <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a946916 commit 8b84769

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Documentation/x86/boot.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,15 +1399,21 @@ must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
13991399
must be __BOOT_DS; interrupt must be disabled; %rsi must hold the base
14001400
address of the struct boot_params.
14011401

1402-
EFI Handover Protocol
1403-
=====================
1402+
EFI Handover Protocol (deprecated)
1403+
==================================
14041404

14051405
This protocol allows boot loaders to defer initialisation to the EFI
14061406
boot stub. The boot loader is required to load the kernel/initrd(s)
14071407
from the boot media and jump to the EFI handover protocol entry point
14081408
which is hdr->handover_offset bytes from the beginning of
14091409
startup_{32,64}.
14101410

1411+
The boot loader MUST respect the kernel's PE/COFF metadata when it comes
1412+
to section alignment, the memory footprint of the executable image beyond
1413+
the size of the file itself, and any other aspect of the PE/COFF header
1414+
that may affect correct operation of the image as a PE/COFF binary in the
1415+
execution context provided by the EFI firmware.
1416+
14111417
The function prototype for the handover entry point looks like this::
14121418

14131419
efi_main(void *handle, efi_system_table_t *table, struct boot_params *bp)
@@ -1419,9 +1425,18 @@ UEFI specification. 'bp' is the boot loader-allocated boot params.
14191425

14201426
The boot loader *must* fill out the following fields in bp::
14211427

1422-
- hdr.code32_start
14231428
- hdr.cmd_line_ptr
14241429
- hdr.ramdisk_image (if applicable)
14251430
- hdr.ramdisk_size (if applicable)
14261431

14271432
All other fields should be zero.
1433+
1434+
NOTE: The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF
1435+
entry point, combined with the LINUX_EFI_INITRD_MEDIA_GUID based initrd
1436+
loading protocol (refer to [0] for an example of the bootloader side of
1437+
this), which removes the need for any knowledge on the part of the EFI
1438+
bootloader regarding the internal representation of boot_params or any
1439+
requirements/limitations regarding the placement of the command line
1440+
and ramdisk in memory, or the placement of the kernel image itself.
1441+
1442+
[0] https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0

0 commit comments

Comments
 (0)