提交 82cc8c65 编写于 作者: V vit9696

OpenCoreMisc: Implement Apple BootPicker support

上级 81ff1081
...@@ -15,6 +15,8 @@ OpenCore Changelog ...@@ -15,6 +15,8 @@ OpenCore Changelog
- Added `PickerAttributes` option to colour picker - Added `PickerAttributes` option to colour picker
- Added `ProtectSecureBoot` option through FwRuntimeServices - Added `ProtectSecureBoot` option through FwRuntimeServices
- Replaced `RequireVault` and `RequireSignature` with `Vault` - Replaced `RequireVault` and `RequireSignature` with `Vault`
- Added `BootKicker` tool to support launching Apple BootPicker
- Added BootPicker support as an external UI in OC through `PickerMode`
#### v0.5.5 #### v0.5.5
- Fixed CPU bus ratio calculation for Nehalem and Westmere - Fixed CPU bus ratio calculation for Nehalem and Westmere
......
...@@ -2110,7 +2110,7 @@ behaviour that does not go to any other sections ...@@ -2110,7 +2110,7 @@ behaviour that does not go to any other sections
\textbf{Failsafe}: \texttt{false}\\ \textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Enable \texttt{modifier hotkey} handling in boot picker. \textbf{Description}: Enable \texttt{modifier hotkey} handling in boot picker.
In addition to \texttt{action hotkeys}, which are partially described in \texttt{UsePicker} In addition to \texttt{action hotkeys}, which are partially described in \texttt{PickerMode}
section and are normally handled by Apple BDS, there exist modifier keys, which are section and are normally handled by Apple BDS, there exist modifier keys, which are
handled by operating system bootloader, namely \texttt{boot.efi}. These keys handled by operating system bootloader, namely \texttt{boot.efi}. These keys
allow to change operating system behaviour by providing different boot modes. allow to change operating system behaviour by providing different boot modes.
...@@ -2157,16 +2157,30 @@ behaviour that does not go to any other sections ...@@ -2157,16 +2157,30 @@ behaviour that does not go to any other sections
automatic booting of the default boot entry. Use 0 to disable timer. automatic booting of the default boot entry. Use 0 to disable timer.
\item \item
\texttt{UsePicker}\\ \texttt{PickerMode}\\
\textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\ \textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Use OpenCore built-in boot picker for boot management. \textbf{Description}: Choose boot picker used for boot management.
\texttt{UsePicker} set to \texttt{false} entirely disables all boot management Picker describes underlying boot management with an optional user interface
in OpenCore except policy enforcement. In this case a custom user interface may responsible for handling boot options. The following values are supported:
\begin{itemize}
\tightlist
\item \texttt{Builtin} --- boot management is handled by OpenCore, a simple
text only user interface is used.
\item \texttt{External} --- an external boot management protocol is used
if available. Otherwise \texttt{Builtin} mode is used.
\item \texttt{Apple} --- Apple boot management is used if available.
Otherwise \texttt{Builtin} mode is used.
\end{itemize}
Upon success \texttt{External} mode will entirely disable all boot management
in OpenCore except policy enforcement. In \texttt{Apple} mode it may additionally
bypass policy enforcement. To implement \texttt{External} mode a custom user interface may
utilise \href{https://github.com/acidanthera/OcSupportPkg}{OcSupportPkg} utilise \href{https://github.com/acidanthera/OcSupportPkg}{OcSupportPkg}
\texttt{OcBootManagementLib} to implement a user friendly boot picker oneself. \texttt{OcBootManagementLib}. Reference example of external graphics interface is provided in
Reference example of external graphics interface is provided in
\href{https://github.com/acidanthera/OcSupportPkg/tree/master/Tests/ExternalUi}{ExternalUi} \href{https://github.com/acidanthera/OcSupportPkg/tree/master/Tests/ExternalUi}{ExternalUi}
test driver. test driver.
...@@ -2199,10 +2213,10 @@ behaviour that does not go to any other sections ...@@ -2199,10 +2213,10 @@ behaviour that does not go to any other sections
\emph{Note}: Activated \texttt{KeySupport}, \texttt{AppleUsbKbDxe}, or similar driver is required \emph{Note}: Activated \texttt{KeySupport}, \texttt{AppleUsbKbDxe}, or similar driver is required
for key handling to work. On many firmwares it is not possible to get all the keys function. for key handling to work. On many firmwares it is not possible to get all the keys function.
In addition to \texttt{OPT} OpenCore supports \texttt{Escape} key In addition to \texttt{OPT} OpenCore supports \texttt{Escape} key to display picker when
\texttt{ShowPicker}. This key exists for firmwares with PS/2 keyboards that \texttt{ShowPicker} is disabled. This key exists for \texttt{Apple} picker mode and for
fail to report held \texttt{OPT} key and require continual presses of \texttt{Escape} firmwares with PS/2 keyboards that fail to report held \texttt{OPT} key and require continual
key to enter the boot menu. presses of \texttt{Escape} key to enter the boot menu.
\end{enumerate} \end{enumerate}
...@@ -3686,7 +3700,7 @@ build -a X64 -b RELEASE -t XCODE5 -p MdeModulePkg/MdeModulePkg.dsc ...@@ -3686,7 +3700,7 @@ build -a X64 -b RELEASE -t XCODE5 -p MdeModulePkg/MdeModulePkg.dsc
\hyperref[uefiinputprops]{Input Properties} section below. \hyperref[uefiinputprops]{Input Properties} section below.
\item \item
\texttt{Input}\\ \texttt{Output}\\
\textbf{Type}: \texttt{plist\ dict}\\ \textbf{Type}: \texttt{plist\ dict}\\
\textbf{Failsafe}: None\\ \textbf{Failsafe}: None\\
\textbf{Description}: Apply individual settings designed for output (text and graphics) in \textbf{Description}: Apply individual settings designed for output (text and graphics) in
......
\documentclass[]{article} \documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE %DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Thu Feb 6 00:43:28 2020 %DIF DEL PreviousConfiguration.tex Thu Feb 6 00:43:28 2020
%DIF ADD ../Configuration.tex Sun Feb 9 01:08:55 2020 %DIF ADD ../Configuration.tex Sun Feb 9 14:29:44 2020
\usepackage{lmodern} \usepackage{lmodern}
\usepackage{amssymb,amsmath} \usepackage{amssymb,amsmath}
...@@ -2394,7 +2394,7 @@ behaviour that does not go to any other sections ...@@ -2394,7 +2394,7 @@ behaviour that does not go to any other sections
\textbf{Failsafe}: \texttt{false}\\ \textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Enable \texttt{modifier hotkey} handling in boot picker. \textbf{Description}: Enable \texttt{modifier hotkey} handling in boot picker.
In addition to \texttt{action hotkeys}, which are partially described in \texttt{UsePicker} In addition to \texttt{action hotkeys}, which are partially described in \texttt{\DIFdelbegin \DIFdel{UsePicker}\DIFdelend \DIFaddbegin \DIFadd{PickerMode}\DIFaddend }
section and are normally handled by Apple BDS, there exist modifier keys, which are section and are normally handled by Apple BDS, there exist modifier keys, which are
handled by operating system bootloader, namely \texttt{boot.efi}. These keys handled by operating system bootloader, namely \texttt{boot.efi}. These keys
allow to change operating system behaviour by providing different boot modes. allow to change operating system behaviour by providing different boot modes.
...@@ -2502,16 +2502,32 @@ behaviour that does not go to any other sections ...@@ -2502,16 +2502,32 @@ behaviour that does not go to any other sections
automatic booting of the default boot entry. Use 0 to disable timer. automatic booting of the default boot entry. Use 0 to disable timer.
\item \item
\texttt{UsePicker}\\ \texttt{\DIFdelbegin \DIFdel{UsePicker}\DIFdelend \DIFaddbegin \DIFadd{PickerMode}\DIFaddend }\\
\textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\ \textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Use OpenCore built-in boot picker for boot management. \textbf{Description}: \DIFdelbegin \DIFdel{Use OpenCore built-in boot picker }\DIFdelend \DIFaddbegin \DIFadd{Choose boot picker used }\DIFaddend for boot management.
\texttt{UsePicker} set to \texttt{false} entirely disables all boot management \DIFaddbegin \DIFadd{Picker describes underlying boot management with an optional user interface
in OpenCore except policy enforcement. In this case a custom user interface may responsible for handling boot options. The following values are supported:
}
\begin{itemize}
\tightlist
\item \DIFaddend \texttt{\DIFdelbegin \DIFdel{UsePicker}\DIFdelend \DIFaddbegin \DIFadd{Builtin}\DIFaddend } \DIFdelbegin \DIFdel{set to }\DIFdelend \DIFaddbegin \DIFadd{--- boot management is handled by OpenCore, a simple
text only user interface is used.
}\item \DIFaddend \texttt{\DIFdelbegin \DIFdel{false}%DIFDELCMD < \MBLOCKRIGHTBRACE %%%
\DIFdel{entirely disables }\DIFdelend \DIFaddbegin \DIFadd{External}} \DIFadd{--- an external boot management protocol is used
if available. Otherwise }\texttt{\DIFadd{Builtin}} \DIFadd{mode is used.
}\item \texttt{\DIFadd{Apple}} \DIFadd{--- Apple boot management is used if available.
Otherwise }\texttt{\DIFadd{Builtin}} \DIFadd{mode is used.
}\end{itemize}
\DIFadd{Upon success }\texttt{\DIFadd{External}} \DIFadd{mode will entirely disable }\DIFaddend all boot management
in OpenCore except policy enforcement. In \DIFdelbegin \DIFdel{this case }\DIFdelend \DIFaddbegin \texttt{\DIFadd{Apple}} \DIFadd{mode it may additionally
bypass policy enforcement. To implement }\texttt{\DIFadd{External}} \DIFadd{mode }\DIFaddend a custom user interface may
utilise \href{https://github.com/acidanthera/OcSupportPkg}{OcSupportPkg} utilise \href{https://github.com/acidanthera/OcSupportPkg}{OcSupportPkg}
\texttt{OcBootManagementLib} to implement a user friendly boot picker oneself. \texttt{OcBootManagementLib}\DIFdelbegin \DIFdel{to implement a user friendly boot picker oneself}\DIFdelend . Reference example of external graphics interface is provided in
Reference example of external graphics interface is provided in
\href{https://github.com/acidanthera/OcSupportPkg/tree/master/Tests/ExternalUi}{ExternalUi} \href{https://github.com/acidanthera/OcSupportPkg/tree/master/Tests/ExternalUi}{ExternalUi}
test driver. test driver.
...@@ -2544,10 +2560,10 @@ behaviour that does not go to any other sections ...@@ -2544,10 +2560,10 @@ behaviour that does not go to any other sections
\emph{Note}: Activated \texttt{KeySupport}, \texttt{AppleUsbKbDxe}, or similar driver is required \emph{Note}: Activated \texttt{KeySupport}, \texttt{AppleUsbKbDxe}, or similar driver is required
for key handling to work. On many firmwares it is not possible to get all the keys function. for key handling to work. On many firmwares it is not possible to get all the keys function.
In addition to \texttt{OPT} OpenCore supports \texttt{Escape} key In addition to \texttt{OPT} OpenCore supports \texttt{Escape} key \DIFaddbegin \DIFadd{to display picker when
\texttt{ShowPicker}. This key exists for firmwares with PS/2 keyboards that }\DIFaddend \texttt{ShowPicker} \DIFaddbegin \DIFadd{is disabled}\DIFaddend . This key exists for \DIFaddbegin \texttt{\DIFadd{Apple}} \DIFadd{picker mode and for
fail to report held \texttt{OPT} key and require continual presses of \texttt{Escape} }\DIFaddend firmwares with PS/2 keyboards that fail to report held \texttt{OPT} key and require continual
key to enter the boot menu. presses of \texttt{Escape} key to enter the boot menu.
\end{enumerate} \end{enumerate}
...@@ -4099,7 +4115,7 @@ build -a X64 -b RELEASE -t XCODE5 -p MdeModulePkg/MdeModulePkg.dsc ...@@ -4099,7 +4115,7 @@ build -a X64 -b RELEASE -t XCODE5 -p MdeModulePkg/MdeModulePkg.dsc
\hyperref[uefiinputprops]{Input Properties} section below. \hyperref[uefiinputprops]{Input Properties} section below.
\item \item
\DIFaddbegin \texttt{\DIFadd{Input}}\\ \DIFaddbegin \texttt{\DIFadd{Output}}\\
\textbf{\DIFadd{Type}}\DIFadd{: }\texttt{\DIFadd{plist\ dict}}\\ \textbf{\DIFadd{Type}}\DIFadd{: }\texttt{\DIFadd{plist\ dict}}\\
\textbf{\DIFadd{Failsafe}}\DIFadd{: None}\\ \textbf{\DIFadd{Failsafe}}\DIFadd{: None}\\
\textbf{\DIFadd{Description}}\DIFadd{: Apply individual settings designed for output (text and graphics) in \textbf{\DIFadd{Description}}\DIFadd{: Apply individual settings designed for output (text and graphics) in
......
...@@ -583,6 +583,8 @@ ...@@ -583,6 +583,8 @@
<dict> <dict>
<key>HibernateMode</key> <key>HibernateMode</key>
<string>None</string> <string>None</string>
<key>PickerMode</key>
<string>Builtin</string>
<key>HideSelf</key> <key>HideSelf</key>
<true/> <true/>
<key>PickerAttributes</key> <key>PickerAttributes</key>
...@@ -595,8 +597,6 @@ ...@@ -595,8 +597,6 @@
<integer>0</integer> <integer>0</integer>
<key>Timeout</key> <key>Timeout</key>
<integer>5</integer> <integer>5</integer>
<key>UsePicker</key>
<true/>
</dict> </dict>
<key>Debug</key> <key>Debug</key>
<dict> <dict>
......
...@@ -583,6 +583,8 @@ ...@@ -583,6 +583,8 @@
<dict> <dict>
<key>HibernateMode</key> <key>HibernateMode</key>
<string>None</string> <string>None</string>
<key>PickerMode</key>
<string>Builtin</string>
<key>HideSelf</key> <key>HideSelf</key>
<true/> <true/>
<key>PickerAttributes</key> <key>PickerAttributes</key>
...@@ -595,8 +597,6 @@ ...@@ -595,8 +597,6 @@
<integer>0</integer> <integer>0</integer>
<key>Timeout</key> <key>Timeout</key>
<integer>5</integer> <integer>5</integer>
<key>UsePicker</key>
<true/>
</dict> </dict>
<key>Debug</key> <key>Debug</key>
<dict> <dict>
......
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
OpenCorePkg/Application/Bootstrap/Bootstrap.inf OpenCorePkg/Application/Bootstrap/Bootstrap.inf
OpenCorePkg/Platform/OpenCore/OpenCore.inf OpenCorePkg/Platform/OpenCore/OpenCore.inf
OcSupportPkg/Application/BootKicker/BootKicker.inf
OcSupportPkg/Application/CleanNvram/CleanNvram.inf OcSupportPkg/Application/CleanNvram/CleanNvram.inf
OcSupportPkg/Application/VerifyMsrE2/VerifyMsrE2.inf OcSupportPkg/Application/VerifyMsrE2/VerifyMsrE2.inf
OcSupportPkg/Platform/AppleUsbKbDxe/UsbKbDxe.inf OcSupportPkg/Platform/AppleUsbKbDxe/UsbKbDxe.inf
......
...@@ -365,17 +365,32 @@ OcMiscBoot ( ...@@ -365,17 +365,32 @@ OcMiscBoot (
EFI_STATUS Status; EFI_STATUS Status;
OC_PICKER_CONTEXT *Context; OC_PICKER_CONTEXT *Context;
OC_PICKER_CMD PickerCommand; OC_PICKER_CMD PickerCommand;
OC_PICKER_MODE PickerMode;
UINTN ContextSize; UINTN ContextSize;
UINT32 Index; UINT32 Index;
UINT32 EntryIndex; UINT32 EntryIndex;
OC_INTERFACE_PROTOCOL *Interface; OC_INTERFACE_PROTOCOL *Interface;
UINTN BlessOverrideSize; UINTN BlessOverrideSize;
CHAR16 **BlessOverride; CHAR16 **BlessOverride;
CONST CHAR8 *AsciiPicker;
AsciiPicker = OC_BLOB_GET (&Config->Misc.Boot.PickerMode);
if (AsciiStrCmp (AsciiPicker, "Builtin") == 0) {
PickerMode = OcPickerModeBuiltin;
} else if (AsciiStrCmp (AsciiPicker, "External") == 0) {
PickerMode = OcPickerModeExternal;
} else if (AsciiStrCmp (AsciiPicker, "Apple") == 0) {
PickerMode = OcPickerModeApple;
} else {
DEBUG ((DEBUG_WARN, "OC: Unknown PickirMode: %a, using builtin\n", AsciiPicker));
PickerMode = OcPickerModeBuiltin;
}
// //
// Do not use our boot picker unless asked. // Do not use our boot picker unless asked.
// //
if (!Config->Misc.Boot.UsePicker) { if (PickerMode == OcPickerModeExternal) {
DEBUG ((DEBUG_INFO, "OC: Handing off to external boot controller\n")); DEBUG ((DEBUG_INFO, "OC: Handing off to external boot controller\n"));
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
...@@ -383,19 +398,19 @@ OcMiscBoot ( ...@@ -383,19 +398,19 @@ OcMiscBoot (
NULL, NULL,
(VOID **) &Interface (VOID **) &Interface
); );
if (EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
if (Interface->Revision != OC_INTERFACE_REVISION) {
DEBUG ((
DEBUG_INFO,
"OC: Incompatible external GUI protocol - %u vs %u\n",
Interface->Revision,
OC_INTERFACE_REVISION
));
Interface = NULL;
}
} else {
DEBUG ((DEBUG_INFO, "OC: Missing external GUI protocol - %r\n", Status)); DEBUG ((DEBUG_INFO, "OC: Missing external GUI protocol - %r\n", Status));
return; Interface = NULL;
}
if (Interface->Revision != OC_INTERFACE_REVISION) {
DEBUG ((
DEBUG_INFO,
"OC: Incompatible external GUI protocol - %u vs %u\n",
Interface->Revision,
OC_INTERFACE_REVISION
));
return;
} }
} else { } else {
Interface = NULL; Interface = NULL;
...@@ -470,6 +485,7 @@ OcMiscBoot ( ...@@ -470,6 +485,7 @@ OcMiscBoot (
Context->CustomRead = OcToolLoadEntry; Context->CustomRead = OcToolLoadEntry;
Context->PrivilegeContext = Privilege; Context->PrivilegeContext = Privilege;
Context->RequestPrivilege = OcShowSimplePasswordRequest; Context->RequestPrivilege = OcShowSimplePasswordRequest;
Context->PickerMode = PickerMode;
Context->ConsoleAttributes = Config->Misc.Boot.PickerAttributes; Context->ConsoleAttributes = Config->Misc.Boot.PickerAttributes;
if ((Config->Misc.Security.ExposeSensitiveData & OCS_EXPOSE_VERSION_UI) != 0) { if ((Config->Misc.Security.ExposeSensitiveData & OCS_EXPOSE_VERSION_UI) != 0) {
......
...@@ -29,6 +29,7 @@ package() { ...@@ -29,6 +29,7 @@ package() {
cp FwRuntimeServices.efi tmp/EFI/OC/Drivers/ || exit 1 cp FwRuntimeServices.efi tmp/EFI/OC/Drivers/ || exit 1
cp NvmExpressDxe.efi tmp/EFI/OC/Drivers/ || exit 1 cp NvmExpressDxe.efi tmp/EFI/OC/Drivers/ || exit 1
cp XhciDxe.efi tmp/EFI/OC/Drivers/ || exit 1 cp XhciDxe.efi tmp/EFI/OC/Drivers/ || exit 1
cp BootKicker.efi tmp/EFI/OC/Tools/ || exit 1
cp CleanNvram.efi tmp/EFI/OC/Tools/ || exit 1 cp CleanNvram.efi tmp/EFI/OC/Tools/ || exit 1
cp VerifyMsrE2.efi tmp/EFI/OC/Tools/ || exit 1 cp VerifyMsrE2.efi tmp/EFI/OC/Tools/ || exit 1
cp "${selfdir}/Docs/Configuration.pdf" tmp/Docs/ || exit 1 cp "${selfdir}/Docs/Configuration.pdf" tmp/Docs/ || exit 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册