OcBootManagementLib: Added TimeMachine detection to picker

This commit is contained in:
vit9696 2020-03-06 23:23:16 +03:00
parent c50c664b8c
commit 9684069ced
12 changed files with 70 additions and 37 deletions

View File

@ -1,6 +1,9 @@
OpenCore Changelog
==================
#### v0.5.7
- Added TimeMachine detection to picker
#### v0.5.6
- Various improvements to builtin text renderer
- Fixed locating DMG recovery in APTIO IV firmwares on FAT32

Binary file not shown.

View File

@ -2081,6 +2081,7 @@ behaviour that does not go to any other sections
\begin{itemize}
\tightlist
\item Entry is macOS recovery.
\item Entry is macOS Time Machine.
\item Entry is explicitly marked as \texttt{Auxiliary}.
\item Entry is system (e.g. \texttt{Clean NVRAM}).
\end{itemize}

Binary file not shown.

View File

@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Wed Mar 4 15:32:59 2020
%DIF ADD ../Configuration.tex Wed Mar 4 21:55:23 2020
%DIF DEL PreviousConfiguration.tex Fri Mar 6 09:43:05 2020
%DIF ADD ../Configuration.tex Fri Mar 6 23:22:27 2020
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
@ -2141,7 +2141,8 @@ behaviour that does not go to any other sections
\begin{itemize}
\tightlist
\item Entry is macOS recovery.
\item Entry is explicitly marked as \texttt{Auxiliary}.
\item Entry is \DIFaddbegin \DIFadd{macOS Time Machine.
}\item \DIFadd{Entry is }\DIFaddend explicitly marked as \texttt{Auxiliary}.
\item Entry is system (e.g. \texttt{Clean NVRAM}).
\end{itemize}

View File

@ -72,8 +72,9 @@ typedef struct OC_PICKER_CONTEXT_ OC_PICKER_CONTEXT;
**/
typedef enum OC_BOOT_ENTRY_TYPE_ {
OcBootUnknown,
OcBootApple,
OcBootAppleOs,
OcBootAppleRecovery,
OcBootAppleTimeMachine,
OcBootWindows,
OcBootCustom,
OcBootSystem

View File

@ -87,20 +87,21 @@ typedef enum {
OcVoiceOverAudioFileLoading = 0x1039,
OcVoiceOverAudioFilemacOS = 0x103A,
OcVoiceOverAudioFilemacOS_Recovery = 0x103B,
OcVoiceOverAudioFileOtherOS = 0x103C,
OcVoiceOverAudioFilePasswordAccepted = 0x103D,
OcVoiceOverAudioFilePasswordIncorrect = 0x103E,
OcVoiceOverAudioFilePasswordRetryLimit = 0x103F,
OcVoiceOverAudioFileReloading = 0x1040,
OcVoiceOverAudioFileResetNVRAM = 0x1041,
OcVoiceOverAudioFileSelected = 0x1042,
OcVoiceOverAudioFileShowAuxiliary = 0x1043,
OcVoiceOverAudioFileTimeout = 0x1044,
OcVoiceOverAudioFileUEFI_Shell = 0x1045,
OcVoiceOverAudioFileWelcome = 0x1046,
OcVoiceOverAudioFileWindows = 0x1047,
OcVoiceOverAudioFilemacOS_TimeMachine = 0x103C,
OcVoiceOverAudioFileOtherOS = 0x103D,
OcVoiceOverAudioFilePasswordAccepted = 0x103E,
OcVoiceOverAudioFilePasswordIncorrect = 0x103F,
OcVoiceOverAudioFilePasswordRetryLimit = 0x1040,
OcVoiceOverAudioFileReloading = 0x1041,
OcVoiceOverAudioFileResetNVRAM = 0x1042,
OcVoiceOverAudioFileSelected = 0x1043,
OcVoiceOverAudioFileShowAuxiliary = 0x1044,
OcVoiceOverAudioFileTimeout = 0x1045,
OcVoiceOverAudioFileUEFI_Shell = 0x1046,
OcVoiceOverAudioFileWelcome = 0x1047,
OcVoiceOverAudioFileWindows = 0x1048,
OcVoiceOverAudioFileMax = 0x1048,
OcVoiceOverAudioFileMax = 0x1049,
} OC_VOICE_OVER_AUDIO_FILE;
STATIC_ASSERT (OcVoiceOverAudioFileIndexMax - OcVoiceOverAudioFileIndexBase == 9 + 26, "Invalid index count");

View File

@ -178,10 +178,12 @@ OcPlayAudioEntry (
{
OcPlayAudioFile (Context, OcVoiceOverAudioFileIndexBase + Number, FALSE);
if (Entry->Type == OcBootApple) {
if (Entry->Type == OcBootAppleOs) {
OcPlayAudioFile (Context, OcVoiceOverAudioFilemacOS, FALSE);
} else if (Entry->Type == OcBootAppleRecovery) {
OcPlayAudioFile (Context, OcVoiceOverAudioFilemacOS_Recovery, FALSE);
} else if (Entry->Type == OcBootAppleTimeMachine) {
OcPlayAudioFile (Context, OcVoiceOverAudioFilemacOS_TimeMachine, FALSE);
} else if (Entry->Type == OcBootWindows) {
OcPlayAudioFile (Context, OcVoiceOverAudioFileWindows, FALSE);
} else if (StrStr (Entry->Name, OC_MENU_UEFI_SHELL_ENTRY) != NULL) {

View File

@ -301,6 +301,7 @@ InternalSetBootEntryFlags (
FILEPATH_DEVICE_PATH *FilePath;
UINTN Len;
UINTN Index;
UINTN Index2;
BOOLEAN Result;
INTN CmpResult;
@ -313,6 +314,21 @@ InternalSetBootEntryFlags (
return;
}
STATIC CONST CHAR16 *BootInstanceNames[] = {
L"com.apple.recovery.boot",
L"tmbootpicker.efi"
};
STATIC UINTN BootInstanceLengths[] = {
L_STR_LEN (L"com.apple.recovery.boot"),
L_STR_LEN (L"tmbootpicker.efi")
};
STATIC UINT32 BootInstanceTypes[] = {
OcBootAppleRecovery,
OcBootAppleTimeMachine
};
//
// TODO: Move this to a new OcIsAppleRecoveryBootDevicePath function.
//
@ -328,20 +344,21 @@ InternalSetBootEntryFlags (
BootEntry->IsFolder = (FilePath->PathName[Len - 1] == L'\\');
if (BootEntry->Type == OcBootUnknown) {
Result = OcOverflowSubUN (
Len,
L_STR_LEN (L"com.apple.recovery.boot"),
&Len
);
if (!Result) {
for (Index = 0; Index < Len; ++Index) {
CmpResult = -1;
for (Index = 0; Index < ARRAY_SIZE (BootInstanceNames) && CmpResult != 0; ++Index) {
Result = OcOverflowSubUN (Len, BootInstanceLengths[Index], &Len);
if (Result) {
continue;
}
for (Index2 = 0; Index2 < Len; ++Index2) {
CmpResult = CompareMem (
&FilePath->PathName[Index],
L"com.apple.recovery.boot",
L_STR_SIZE_NT (L"com.apple.recovery.boot")
);
&FilePath->PathName[Index2],
BootInstanceNames[Index],
BootInstanceLengths[Index] * sizeof (BootInstanceNames[Index][0])
);
if (CmpResult == 0) {
BootEntry->Type = OcBootAppleRecovery;
BootEntry->Type = BootInstanceTypes[Index];
break;
}
}
@ -356,7 +373,7 @@ InternalSetBootEntryFlags (
}
if (BootEntry->Type == OcBootUnknown && OcIsAppleBootDevicePath (BootEntry->DevicePath)) {
BootEntry->Type = OcBootApple;
BootEntry->Type = OcBootAppleOs;
}
}
@ -561,9 +578,11 @@ InternalFillValidBootEntries (
InternalSetBootEntryFlags (&Entries[EntryIndex]);
//
// This entry can still be legacy HFS non-dmg recovery, ensure that it is not.
// This entry can still be legacy HFS non-dmg recovery or Time Machine, ensure that it is not.
//
if (Context->HideAuxiliary && Entries[EntryIndex].Type == OcBootAppleRecovery) {
if (Context->HideAuxiliary
&& (Entries[EntryIndex].Type == OcBootAppleRecovery
|| Entries[EntryIndex].Type == OcBootAppleTimeMachine)) {
ZeroMem (&Entries[EntryIndex], sizeof (Entries[EntryIndex]));
FreePool (DevicePath);
continue;

View File

@ -110,7 +110,7 @@ OcDescribeBootEntry (
if (BootEntry->Name != NULL
&& (!StrCmp (BootEntry->Name, L"Recovery HD")
|| !StrCmp (BootEntry->Name, L"Recovery"))) {
if (BootEntry->Type == OcBootUnknown || BootEntry->Type == OcBootApple) {
if (BootEntry->Type == OcBootUnknown || BootEntry->Type == OcBootAppleOs) {
BootEntry->Type = OcBootAppleRecovery;
}
RecoveryBootName = InternalGetAppleRecoveryName (FileSystem, BootDirectoryName);

View File

@ -763,9 +763,9 @@ OcGetDefaultBootEntry (
}
if (Context->PickerCommand == OcPickerBootApple) {
if (BootEntries[BootEntryIndex].Type != OcBootApple) {
if (BootEntries[BootEntryIndex].Type != OcBootAppleOs) {
for (Index = 0; Index < NumBootEntries; ++Index) {
if (BootEntries[Index].Type == OcBootApple) {
if (BootEntries[Index].Type == OcBootAppleOs) {
BootEntryIndex = (UINT32) Index;
DEBUG ((DEBUG_INFO, "OCB: Override default to Apple %u\n", BootEntryIndex));
break;
@ -1217,7 +1217,9 @@ InternalLoadBootEntry (
LoadedImage->LoadOptions = NULL;
if (BootEntry->LoadOptions == NULL
&& (BootEntry->Type == OcBootApple || BootEntry->Type == OcBootAppleRecovery)) {
&& (BootEntry->Type == OcBootAppleOs
|| BootEntry->Type == OcBootAppleRecovery
|| BootEntry->Type == OcBootAppleTimeMachine)) {
Args = Context->AppleBootArgs;
ArgsLen = (UINT32)AsciiStrLen (Args);
} else {

View File

@ -140,6 +140,9 @@ OcAudioAcquireFile (
case OcVoiceOverAudioFilemacOS_Recovery:
BasePath = "macOS_Recovery";
break;
case OcVoiceOverAudioFilemacOS_TimeMachine:
BasePath = "macOS_TimeMachine";
break;
case OcVoiceOverAudioFileOtherOS:
BasePath = "OtherOS";
break;