OpenCore
1.0.4
OpenCore Bootloader
|
#include <Library/BaseOverflowLib.h>
#include <Library/OcAppleKernelLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcConfigurationLib.h>
#include <Library/OcCpuLib.h>
#include <Library/OcCryptoLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
#include <Library/OcStorageLib.h>
#include <Protocol/OcBootstrap.h>
Go to the source code of this file.
Macros | |
#define | OPEN_CORE_VERSION "1.0.4" |
#define | OPEN_CORE_ROOT_PATH L"EFI\\OC" |
#define | OPEN_CORE_APP_PATH L"OpenCore.efi" |
#define | OPEN_CORE_CONFIG_PATH L"config.plist" |
#define | OPEN_CORE_LOG_PREFIX_PATH L"opencore" |
#define | OPEN_CORE_ACPI_PATH L"ACPI\\" |
#define | OPEN_CORE_UEFI_DRIVER_PATH L"Drivers\\" |
#define | OPEN_CORE_KEXT_PATH L"Kexts\\" |
#define | OPEN_CORE_TOOL_PATH L"Tools\\" |
Functions | |
OC_RSA_PUBLIC_KEY * | OcGetVaultKey (VOID) |
VOID | OcLoadAcpiSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config) |
VOID | OcLoadDevPropsSupport (IN OC_GLOBAL_CONFIG *Config) |
VOID | OcLoadDrivers (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, OUT EFI_HANDLE **DriversToConnect OPTIONAL, IN BOOLEAN LoadEarly) |
VOID | OcLoadKernelSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN OC_CPU_INFO *CpuInfo) |
EFI_STATUS | OcKernelApplyQuirk (IN KERNEL_QUIRK_NAME Quirk, IN KERNEL_CACHE_TYPE CacheType, IN UINT32 DarwinVersion, IN OUT VOID *Context, IN OUT PATCHER_CONTEXT *KernelPatcher) |
VOID | OcKernelInjectKexts (IN OC_GLOBAL_CONFIG *Config, IN KERNEL_CACHE_TYPE CacheType, IN VOID *Context, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN UINT32 LinkedExpansion, IN UINT32 ReservedExeSize) |
VOID | OcKernelApplyPatches (IN OC_GLOBAL_CONFIG *Config, IN OC_CPU_INFO *CpuInfo, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN KERNEL_CACHE_TYPE CacheType, IN VOID *Context, IN OUT UINT8 *Kernel, IN UINT32 Size) |
VOID | OcKernelBlockKexts (IN OC_GLOBAL_CONFIG *Config, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN KERNEL_CACHE_TYPE CacheType, IN VOID *Context) |
EFI_STATUS | OcKernelProcessPrelinked (IN OC_GLOBAL_CONFIG *Config, IN UINT32 DarwinVersion, IN BOOLEAN Is32Bit, IN OUT UINT8 *Kernel, IN UINT32 *KernelSize, IN UINT32 AllocatedSize, IN UINT32 LinkedExpansion, IN UINT32 ReservedExeSize) |
VOID | OcUnloadKernelSupport (VOID) |
VOID | OcLoadNvramSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config) |
VOID | OcGetLegacySecureBootECID (IN OC_GLOBAL_CONFIG *Config, OUT UINT64 *ApECID) |
CONST CHAR8 * | OcGetDefaultSecureBootModel (IN OC_GLOBAL_CONFIG *Config, IN OC_CPU_INFO *CpuInfo) |
VOID | OcLoadPlatformSupport (IN OC_GLOBAL_CONFIG *Config, IN OC_CPU_INFO *CpuInfo) |
VOID | OcLoadUefiSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN OC_CPU_INFO *CpuInfo, IN UINT8 *Signature) |
VOID | OcLoadUefiInputSupport (IN OC_GLOBAL_CONFIG *Config) |
VOID | OcLoadUefiOutputSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config) |
VOID | OcLoadUefiAudioSupport (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config) |
VOID | OcScheduleExitBootServices (IN EFI_EVENT_NOTIFY Handler, IN VOID *Context) |
CONST CHAR8 * | OcMiscGetVersionString (VOID) |
EFI_STATUS | OcMiscEarlyInit (IN OC_STORAGE_CONTEXT *Storage, OUT OC_GLOBAL_CONFIG *Config, IN OC_RSA_PUBLIC_KEY *VaultKey OPTIONAL) |
VOID | OcMiscMiddleInit (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN CONST CHAR16 *RootPath, IN EFI_DEVICE_PATH_PROTOCOL *LoadPath, IN EFI_HANDLE StorageHandle, OUT UINT8 *Signature OPTIONAL) |
EFI_STATUS | OcMiscLateInit (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config) |
VOID | OcMiscLoadSystemReport (IN OC_GLOBAL_CONFIG *Config, IN EFI_HANDLE LoadHandle OPTIONAL) |
VOID | OcMiscBoot (IN OC_STORAGE_CONTEXT *Storage, IN OC_GLOBAL_CONFIG *Config, IN OC_PRIVILEGE_CONTEXT *Privilege OPTIONAL, IN OC_IMAGE_START StartImage, IN BOOLEAN CustomBootGuid, IN EFI_HANDLE LoadHandle) |
VOID | OcMiscUefiQuirksLoaded (IN OC_GLOBAL_CONFIG *Config) |
BOOLEAN | OcPlatformIs64BitSupported (IN UINT32 KernelVersion) |
VOID | OcUnloadDrivers (IN OC_GLOBAL_CONFIG *Config) |
EFI_STATUS | OcDriverInfoDump (IN EFI_FILE_PROTOCOL *Root) |
Copyright (C) 2021, vit9696. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcMainLib.h.
#define OPEN_CORE_ACPI_PATH L"ACPI\\" |
Definition at line 56 of file OcMainLib.h.
#define OPEN_CORE_APP_PATH L"OpenCore.efi" |
Definition at line 50 of file OcMainLib.h.
#define OPEN_CORE_CONFIG_PATH L"config.plist" |
Definition at line 52 of file OcMainLib.h.
#define OPEN_CORE_KEXT_PATH L"Kexts\\" |
Definition at line 60 of file OcMainLib.h.
#define OPEN_CORE_LOG_PREFIX_PATH L"opencore" |
Definition at line 54 of file OcMainLib.h.
#define OPEN_CORE_ROOT_PATH L"EFI\\OC" |
OpenCore build type reported to log and NVRAM.
Definition at line 48 of file OcMainLib.h.
#define OPEN_CORE_TOOL_PATH L"Tools\\" |
Definition at line 62 of file OcMainLib.h.
#define OPEN_CORE_UEFI_DRIVER_PATH L"Drivers\\" |
Definition at line 58 of file OcMainLib.h.
#define OPEN_CORE_VERSION "1.0.4" |
OpenCore version reported to log and NVRAM. OPEN_CORE_VERSION must follow X.Y.Z format, where X.Y.Z are single digits.
Definition at line 33 of file OcMainLib.h.
EFI_STATUS OcDriverInfoDump | ( | IN EFI_FILE_PROTOCOL * | Root | ) |
Dump loaded image driver info to the specified directory.
[in] | Root | Directory to write CPU data. |
EFI_SUCCESS | on success. |
Definition at line 328 of file OpenCoreUefiUnloadDrivers.c.
CONST CHAR8 * OcGetDefaultSecureBootModel | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN OC_CPU_INFO * | CpuInfo ) |
Obtain default Secure Boot hardware model.
[in] | Config | Configuration. |
[in] | CpuInfo | CPU information. |
Definition at line 958 of file OpenCorePlatform.c.
VOID OcGetLegacySecureBootECID | ( | IN OC_GLOBAL_CONFIG * | Config, |
OUT UINT64 * | ApECID ) |
Obtain Legacy Secure Boot ECID (system-id).
[in] | Config | Configuration. |
[out] | ApECID | Legacy Secure Boot ECID. |
Definition at line 873 of file OpenCorePlatform.c.
OC_RSA_PUBLIC_KEY * OcGetVaultKey | ( | VOID | ) |
Obtain cryptographic key if it was installed.
[in] | Bootstrap | bootstrap protocol. |
Definition at line 37 of file OpenCoreVault.c.
VOID OcKernelApplyPatches | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN OC_CPU_INFO * | CpuInfo, | ||
IN UINT32 | DarwinVersion, | ||
IN BOOLEAN | Is32Bit, | ||
IN KERNEL_CACHE_TYPE | CacheType, | ||
IN VOID * | Context, | ||
IN OUT UINT8 * | Kernel, | ||
IN UINT32 | Size ) |
Apply kernel patch.
Definition at line 76 of file OpenCoreKernelPatch.c.
EFI_STATUS OcKernelApplyQuirk | ( | IN KERNEL_QUIRK_NAME | Quirk, |
IN KERNEL_CACHE_TYPE | CacheType, | ||
IN UINT32 | DarwinVersion, | ||
IN OUT VOID * | Context, | ||
IN OUT PATCHER_CONTEXT * | KernelPatcher ) |
Apply kernel quirk.
Definition at line 33 of file OpenCoreKernelPatch.c.
VOID OcKernelBlockKexts | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN UINT32 | DarwinVersion, | ||
IN BOOLEAN | Is32Bit, | ||
IN KERNEL_CACHE_TYPE | CacheType, | ||
IN VOID * | Context ) |
Apply kernel block patch.
Definition at line 393 of file OpenCoreKernelPatch.c.
VOID OcKernelInjectKexts | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN KERNEL_CACHE_TYPE | CacheType, | ||
IN VOID * | Context, | ||
IN UINT32 | DarwinVersion, | ||
IN BOOLEAN | Is32Bit, | ||
IN UINT32 | LinkedExpansion, | ||
IN UINT32 | ReservedExeSize ) |
Inject kexts.
Definition at line 685 of file OpenCoreKernel.c.
EFI_STATUS OcKernelProcessPrelinked | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN UINT32 | DarwinVersion, | ||
IN BOOLEAN | Is32Bit, | ||
IN OUT UINT8 * | Kernel, | ||
IN UINT32 * | KernelSize, | ||
IN UINT32 | AllocatedSize, | ||
IN UINT32 | LinkedExpansion, | ||
IN UINT32 | ReservedExeSize ) |
Process prelinked.
Definition at line 767 of file OpenCoreKernel.c.
VOID OcLoadAcpiSupport | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config ) |
Load ACPI compatibility support like custom tables.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
Definition at line 212 of file OpenCoreAcpi.c.
VOID OcLoadDevPropsSupport | ( | IN OC_GLOBAL_CONFIG * | Config | ) |
Load device properties compatibility support.
[in] | Config | OpenCore configuration. |
Definition at line 31 of file OpenCoreDevProps.c.
VOID OcLoadDrivers | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config, | ||
OUT EFI_HANDLE **DriversToConnect | OPTIONAL, | ||
IN BOOLEAN | LoadEarly ) |
Load drivers.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
[in] | DriversToConnect | Drivers which require later connection. |
[in] | LoadEarly | If TRUE load any early phase drivers, otherwise load normal phase. |
Definition at line 88 of file OpenCoreUefi.c.
VOID OcLoadKernelSupport | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config, | ||
IN OC_CPU_INFO * | CpuInfo ) |
Load Kernel compatibility support like kexts.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
[in] | CpuInfo | CPU information. |
Definition at line 1530 of file OpenCoreKernel.c.
VOID OcLoadNvramSupport | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config ) |
Load NVRAM compatibility support.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
Definition at line 207 of file OpenCoreNvram.c.
VOID OcLoadPlatformSupport | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN OC_CPU_INFO * | CpuInfo ) |
Load platform compatibility support like DataHub or SMBIOS.
[in] | Config | OpenCore configuration. |
[in] | CpuInfo | CPU information. |
Definition at line 757 of file OpenCorePlatform.c.
VOID OcLoadUefiAudioSupport | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config ) |
Load UEFI audio compatibility support.
[in] | Storage | OpenCore storage. |
[out] | Config | OpenCore configuration. |
Definition at line 268 of file OpenCoreUefiAudio.c.
VOID OcLoadUefiInputSupport | ( | IN OC_GLOBAL_CONFIG * | Config | ) |
Load UEFI input compatibility support.
[out] | Config | OpenCore configuration. |
Definition at line 104 of file OpenCoreUefiInOut.c.
VOID OcLoadUefiOutputSupport | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config ) |
Load UEFI output compatibility support.
[in] | Storage | OpenCore storage. |
[out] | Config | OpenCore configuration. |
Definition at line 184 of file OpenCoreUefiInOut.c.
VOID OcLoadUefiSupport | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config, | ||
IN OC_CPU_INFO * | CpuInfo, | ||
IN UINT8 * | Signature ) |
Load UEFI compatibility support like drivers.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
[in] | CpuInfo | CPU information. |
[out] | Signature | OpenCore SHA-1 booter signature, all zero when unavailable. |
Definition at line 887 of file OpenCoreUefi.c.
VOID OcMiscBoot | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config, | ||
IN OC_PRIVILEGE_CONTEXT *Privilege | OPTIONAL, | ||
IN OC_IMAGE_START | StartImage, | ||
IN BOOLEAN | CustomBootGuid, | ||
IN EFI_HANDLE | LoadHandle ) |
Load late miscellaneous support like boot screen config.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
[in] | Privilege | OpenCore privilege context. |
[in] | StartImage | Image starting routine used. |
[in] | LoadHandle | OpenCore loading handle. |
[in] | CustomBootGuid | Use custom (gOcVendorVariableGuid) for Boot#### variables. |
< Always true for entries
Definition at line 798 of file OpenCoreMisc.c.
EFI_STATUS OcMiscEarlyInit | ( | IN OC_STORAGE_CONTEXT * | Storage, |
OUT OC_GLOBAL_CONFIG * | Config, | ||
IN OC_RSA_PUBLIC_KEY *VaultKey | OPTIONAL ) |
Load early miscellaneous support like configuration.
[in] | Storage | OpenCore storage. |
[out] | Config | OpenCore configuration. |
[in] | VaultKey | Vault key. |
EFI_SUCCESS | when allowed to continue. |
< Should be unreachable.
< Should be unreachable.
< Should be unreachable.
< Should be unreachable.
< Should be unreachable.
Definition at line 439 of file OpenCoreMisc.c.
CONST CHAR8 * OcMiscGetVersionString | ( | VOID | ) |
Get human readable version string.
null-terminated | 7-bit ASCII version string. |
Force the assertions in case we forget about them.
Definition at line 372 of file OpenCoreMisc.c.
EFI_STATUS OcMiscLateInit | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config ) |
Load late miscellaneous support like Apple hibernation or panic saving.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
EFI_SUCCESS | on success, informational. |
Definition at line 743 of file OpenCoreMisc.c.
VOID OcMiscLoadSystemReport | ( | IN OC_GLOBAL_CONFIG * | Config, |
IN EFI_HANDLE LoadHandle | OPTIONAL ) |
Load system report.
[in] | LoadHandle | OpenCore loading handle. |
EFI_SUCCESS | on success, informational. |
Definition at line 787 of file OpenCoreMisc.c.
VOID OcMiscMiddleInit | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_GLOBAL_CONFIG * | Config, | ||
IN CONST CHAR16 * | RootPath, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | LoadPath, | ||
IN EFI_HANDLE | StorageHandle, | ||
OUT UINT8 *Signature | OPTIONAL ) |
Load middle miscellaneous support like device path.
[in] | Storage | OpenCore storage. |
[in] | Config | OpenCore configuration. |
[in] | RootPath | Root load path (e.g. path to OC directory). |
[in] | LoadPath | OpenCore loading device path (absolute). |
[in] | StorageHandle | OpenCore storage loading handle (e.g. FS handle). |
[out] | Signature | OpenCore SHA-1 booter signature, optional. |
EFI_SUCCESS | on success, informational. |
Definition at line 639 of file OpenCoreMisc.c.
VOID OcMiscUefiQuirksLoaded | ( | IN OC_GLOBAL_CONFIG * | Config | ) |
Load miscellaneous support after UEFI quirks.
[in] | Config | OpenCore configuration. |
Definition at line 1053 of file OpenCoreMisc.c.
BOOLEAN OcPlatformIs64BitSupported | ( | IN UINT32 | KernelVersion | ) |
Determine platform support for 64-bit kernel mode based on kernel version.
[in] | KernelVersion | Kernel version. |
Definition at line 1022 of file OpenCorePlatform.c.
VOID OcScheduleExitBootServices | ( | IN EFI_EVENT_NOTIFY | Handler, |
IN VOID * | Context ) |
Schedule Exit Boot Services event in TPL_APPLICATION mode.
[in] | Handler | Handler function to invoke. |
[in] | Context | Handler function context. |
Definition at line 72 of file OpenCoreUefi.c.
VOID OcUnloadDrivers | ( | IN OC_GLOBAL_CONFIG * | Config | ) |
Unload loaded images by name.
[in] | Config | OpenCore configuration. |
Definition at line 263 of file OpenCoreUefiUnloadDrivers.c.
VOID OcUnloadKernelSupport | ( | VOID | ) |
Cleanup Kernel compatibility support on failure.
Definition at line 1581 of file OpenCoreKernel.c.