|
iPXE
|
#include <errno.h>#include <stdlib.h>#include <string.h>#include <wchar.h>#include <ipxe/efi/efi.h>#include <ipxe/efi/efi_snp.h>#include <ipxe/efi/efi_download.h>#include <ipxe/efi/efi_file.h>#include <ipxe/efi/efi_path.h>#include <ipxe/efi/efi_strings.h>#include <ipxe/efi/efi_wrap.h>#include <ipxe/efi/efi_pxe.h>#include <ipxe/efi/efi_driver.h>#include <ipxe/efi/efi_image.h>#include <ipxe/efi/efi_shim.h>#include <ipxe/efi/efi_fdt.h>#include <ipxe/image.h>#include <ipxe/init.h>#include <ipxe/features.h>#include <ipxe/uri.h>#include <ipxe/console.h>Go to the source code of this file.
Macros | |
| #define | EINFO_EEFI_LOAD |
| #define | EINFO_EEFI_LOAD_PROHIBITED |
| #define | EEFI_LOAD_PROHIBITED __einfo_error ( EINFO_EEFI_LOAD_PROHIBITED ) |
| #define | EEFI_LOAD(efirc) |
| #define | EINFO_EEFI_START |
| #define | EEFI_START(efirc) EPLATFORM ( EINFO_EEFI_START, efirc ) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| FEATURE (FEATURE_IMAGE, "EFI", DHCP_EB_FEATURE_EFI, 1) | |
| static EFI_DEVICE_PATH_PROTOCOL * | efi_image_path (struct image *image, EFI_DEVICE_PATH_PROTOCOL *parent) |
| Create device path for image. More... | |
| static wchar_t * | efi_image_cmdline (struct image *image) |
| Create command line for image. More... | |
| __weak int | efi_fdt_install (const char *cmdline __unused) |
| Install EFI Flattened Device Tree table (when no FDT support is present) More... | |
| __weak int | efi_fdt_uninstall (void) |
| Uninstall EFI Flattened Device Tree table (when no FDT support is present) More... | |
| static int | efi_image_exec (struct image *image) |
| Execute EFI image. More... | |
| static int | efi_image_probe (struct image *image) |
| Probe EFI image. More... | |
| static int | efi_pe_image_probe (struct image *image) |
| Probe EFI PE image. More... | |
| struct image_type efi_image_type [] | __image_type (PROBE_NORMAL) |
| EFI image types. More... | |
| #define EINFO_EEFI_LOAD |
Definition at line 47 of file efi_image.c.
| #define EINFO_EEFI_LOAD_PROHIBITED |
Definition at line 50 of file efi_image.c.
| #define EEFI_LOAD_PROHIBITED __einfo_error ( EINFO_EEFI_LOAD_PROHIBITED ) |
Definition at line 53 of file efi_image.c.
| #define EEFI_LOAD | ( | efirc | ) |
Definition at line 55 of file efi_image.c.
| #define EINFO_EEFI_START |
Definition at line 57 of file efi_image.c.
| #define EEFI_START | ( | efirc | ) | EPLATFORM ( EINFO_EEFI_START, efirc ) |
Definition at line 60 of file efi_image.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| FEATURE | ( | FEATURE_IMAGE | , |
| "EFI" | , | ||
| DHCP_EB_FEATURE_EFI | , | ||
| 1 | |||
| ) |
|
static |
Create device path for image.
| image | EFI image |
| parent | Parent device path |
| path | Device path, or NULL on failure |
The caller must eventually free() the device path.
Definition at line 72 of file efi_image.c.
References efi_path_len(), efi_path_terminate(), efi_snprintf(), end, FILEPATH_DEVICE_PATH::Header, len, EFI_DEVICE_PATH_PROTOCOL::Length, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, memcpy(), image::name, NULL, FILEPATH_DEVICE_PATH::PathName, SIZE_OF_FILEPATH_DEVICE_PATH, strlen(), EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, and zalloc().
Referenced by efi_image_exec().
Create command line for image.
| image | EFI image |
| cmdline | Command line, or NULL on failure |
Definition at line 114 of file efi_image.c.
References cmdline, image::cmdline, efi_asprintf(), image::name, and NULL.
Referenced by efi_image_exec().
Install EFI Flattened Device Tree table (when no FDT support is present)
| cmdline | Command line, or NULL |
| rc | Return status code |
Definition at line 133 of file efi_image.c.
Referenced by efi_image_exec().
| __weak int efi_fdt_uninstall | ( | void | ) |
Uninstall EFI Flattened Device Tree table (when no FDT support is present)
| rc | Return status code |
Definition at line 142 of file efi_image.c.
Referenced by efi_image_exec().
|
static |
Execute EFI image.
| image | EFI image |
| rc | Return status code |
Definition at line 152 of file efi_image.c.
References assert(), EFI_SYSTEM_TABLE::BootServices, cmdline, image::cmdline, console_reset(), DBGC, device, EFI_LOADED_IMAGE_PROTOCOL::DeviceHandle, EEFI_LOAD, EEFI_START, efi_can_load(), efi_download_install(), efi_download_uninstall(), efi_driver_reconnect_all(), efi_fdt_install(), efi_fdt_uninstall(), efi_file_install(), efi_file_uninstall(), efi_image_cmdline(), efi_image_handle, efi_image_path(), efi_loaded_image_protocol_guid, efi_open, efi_pxe_install(), efi_pxe_uninstall(), EFI_SECURITY_VIOLATION, efi_shim_install(), efi_shim_uninstall(), efi_snp_claim(), efi_snp_release(), efi_systab, efi_unwrap(), efi_wrap_image(), EfiBootServicesCode, ENODEV, ENOMEM, FALSE, find_image_tag(), image::flags, free, handle, efi_snp_device::handle, IMAGE_HIDDEN, EFI_LOADED_IMAGE_PROTOCOL::ImageCodeType, last_opened_snpdev(), image::len, EFI_BOOT_SERVICES::LoadImage, EFI_LOADED_IMAGE_PROTOCOL::LoadOptions, EFI_LOADED_IMAGE_PROTOCOL::LoadOptionsSize, image::name, efi_snp_device::netdev, NULL, EFI_LOADED_IMAGE_PROTOCOL::ParentHandle, efi_snp_device::path, rc, register_image(), image::rwdata, shim(), EFI_BOOT_SERVICES::StartImage, strerror(), type, EFI_BOOT_SERVICES::UnloadImage, unregister_image(), and wcslen().
|
static |
Probe EFI image.
| image | EFI file |
| rc | Return status code |
Definition at line 374 of file efi_image.c.
References EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI_LOAD, efi_image_handle, EFI_SECURITY_VIOLATION, efi_systab, END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, FALSE, handle, image::len, EFI_BOOT_SERVICES::LoadImage, image::name, NULL, rc, image::rwdata, strerror(), EFI_DEVICE_PATH_PROTOCOL::Type, and EFI_BOOT_SERVICES::UnloadImage.
|
static |
Probe EFI PE image.
| image | EFI file |
| rc | Return status code |
The extremely broken UEFI Secure Boot model provides no way for us to unambiguously determine that a valid EFI executable image was rejected by LoadImage() because it failed signature verification. We must therefore use heuristics to guess whether not an image that was rejected by LoadImage() could still be loaded via a separate PE loader such as the UEFI shim.
Definition at line 432 of file efi_image.c.
References image::data, DBGC, EFI_IMAGE_DOS_HEADER::e_lfanew, EFI_IMAGE_DOS_HEADER::e_magic, EFI_IMAGE_DOS_SIGNATURE, EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC, EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC, EFI_IMAGE_NT_SIGNATURE, ENOEXEC, image::len, magic, EFI_IMAGE_OPTIONAL_HEADER32::Magic, image::name, EFI_IMAGE_NT_HEADERS32::OptionalHeader, EFI_IMAGE_OPTIONAL_HEADER_UNION::Pe32, and EFI_IMAGE_NT_HEADERS32::Signature.
| struct image_type efi_image_type [] __image_type | ( | PROBE_NORMAL | ) |
EFI image types.
1.8.15