diff --git a/Changelog.md b/Changelog.md index 24a7ea2d2fc69f91dc14745d800efc3652a92543..47bb42d35cd8773d9524105cbd09fa64b59b951f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -39,6 +39,7 @@ OpenCore Changelog - Added serial port initialisation for serial debug logging - Disabled empty debug log file creation to avoid ESP cluttering - Added `TscSyncTimeout` quirk to workaround debug kernel assertions +- Added first-class Windows support to bless model #### v0.5.8 - Fixed invalid CPU object reference in SSDT-PLUG diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex index 70e34b92a0f22f53be5b1e4ff4f36355a98c4120..5b2d51cd852175898874a4e8a63b2dd826ce77d9 100755 --- a/Docs/Configuration.tex +++ b/Docs/Configuration.tex @@ -2254,10 +2254,11 @@ entry choice will update till next manual reconfiguration. Designed to be filled with \texttt{plist\ string} entries containing absolute UEFI paths to customised bootloaders, for example, - \texttt{\textbackslash EFI\textbackslash Microsoft\textbackslash Boot\textbackslash bootmgfw.efi} - for Microsoft bootloader. This allows unusual boot paths to be automaticlly + \texttt{\textbackslash EFI\textbackslash debian\textbackslash grubx64.efi} + for Debian bootloader. This allows unusual boot paths to be automaticlly discovered by the boot picker. Designwise they are equivalent to predefined blessed path, such as - \texttt{\textbackslash System\textbackslash Library\textbackslash CoreServices\textbackslash boot.efi}, + \texttt{\textbackslash System\textbackslash Library\textbackslash CoreServices\textbackslash boot.efi} + or \texttt{\textbackslash EFI\textbackslash Microsoft\textbackslash Boot\textbackslash bootmgfw.efi}, but unlike predefined bless paths they have highest priority. \item @@ -5366,10 +5367,6 @@ functioning. Feature highlights: \begin{itemize} \item MBR (Master Boot Record) installations are legacy and will not be supported. - \item To install Windows, macOS, and OpenCore on the same drive you can specify - Windows bootloader path - (\texttt{\textbackslash EFI\textbackslash Microsoft\textbackslash Boot\textbackslash bootmgfw.efi}) - in \texttt{BlessOverride} section. \item All the modifications applied (to ACPI, NVRAM, SMBIOS, etc.) are supposed to be operating system agnostic, i.e. apply equally regardless of the OS booted. This enables Boot Camp software experience on Windows. diff --git a/Include/Microsoft/MicrosoftWindows.h b/Include/Microsoft/MicrosoftWindows.h new file mode 100644 index 0000000000000000000000000000000000000000..e87aec1e748075c19f8302388372cb871401b618 --- /dev/null +++ b/Include/Microsoft/MicrosoftWindows.h @@ -0,0 +1,15 @@ +/** @file + Copyright (c) 2020, vit9696. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause +**/ + +#ifndef MICROSOFT_WINDOWS_H +#define MICROSOFT_WINDOWS_H + +/// +/// Windows bootloader path. +/// REF: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/bcd-system-store-settings-for-uefi +/// +#define MS_BOOTER_DEFAULT_FILE_NAME L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi" + +#endif // MICROSOFT_WINDOWS_H diff --git a/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c b/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c index f546611e9ffce590af6a56d5ff12f9f310f8669d..6ed9d3b8756ef8e51865138ee17d1db847ccf57f 100644 --- a/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c +++ b/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c @@ -13,6 +13,7 @@ **/ #include +#include #include #include @@ -48,18 +49,38 @@ typedef struct { /// /// An array of file paths to search for in case no file is blessed. +/// On Apple Macs this list includes: +/// 1. APPLE_BOOTER_DEFAULT_FILE_NAME -- \System\Library\CoreServices\boot.efi +/// 2. APPLE_REMOVABLE_MEDIA_FILE_NAME -- \EFI\APPLE\X64\BOOT.EFI +/// 3. EFI_REMOVABLE_MEDIA_FILE_NAME -- \EFI\BOOT\BOOTX64.EFI +/// 4. APPLE_BOOTER_ROOT_FILE_NAME -- \boot.efi +/// +/// Since in real world only 1st and 3rd entries are used, we do not include +/// 2nd and 4th until further notice. However, we do include a custom entry +/// for Windows, for the reason OpenCore, unlike Apple EFI, may override +/// BOOTx64.efi, and this is not the case for Apple EFI. So we end up with: +/// 1. APPLE_BOOTER_DEFAULT_FILE_NAME -- \System\Library\CoreServices\boot.efi +/// 2. MS_BOOTER_DEFAULT_FILE_NAME -- \EFI\Microsoft\Boot\bootmgfw.efi +/// 3. EFI_REMOVABLE_MEDIA_FILE_NAME -- \EFI\BOOT\BOOTX64.EFI +/// +/// This resolves a problem when Windows installer does not replace our BOOTx64.efi +/// file with Windows file and then NVRAM reset or Boot Camp software reboot to macOS +/// results in the removal of the Windows boot entry from NVRAM making Windows +/// disappear from the list of OpenCore entries without BlessOverride. +/// +/// Linux and related entries are not present here, because they have fine working +/// software for boot management and do not use BOOTx64.efi in the first place. /// GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR16 *gAppleBootPolicyPredefinedPaths[] = { APPLE_BOOTER_DEFAULT_FILE_NAME, - APPLE_REMOVABLE_MEDIA_FILE_NAME, - EFI_REMOVABLE_MEDIA_FILE_NAME, - APPLE_BOOTER_ROOT_FILE_NAME + MS_BOOTER_DEFAULT_FILE_NAME, + EFI_REMOVABLE_MEDIA_FILE_NAME }; GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyNumPredefinedPaths = ARRAY_SIZE (gAppleBootPolicyPredefinedPaths); -GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyCoreNumPredefinedPaths = 1; +GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyCoreNumPredefinedPaths = 2; EFI_STATUS EFIAPI