mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
redirect selfdir in the case of pseudo MS
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
ad2d256e46
commit
4d3d93231b
@ -939,7 +939,7 @@ AddBootOption (
|
||||
//
|
||||
// Find free BootXXXX var slot.
|
||||
//
|
||||
Status = FindFreeBootNum (&BootOption->BootNum);
|
||||
Status = FindFreeBootNum(&BootOption->BootNum);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("FindFreeBootNum: %s\n", efiStrError(Status));
|
||||
return Status;
|
||||
@ -950,7 +950,7 @@ AddBootOption (
|
||||
//
|
||||
// Prepare BootOption variable
|
||||
//
|
||||
Status = CompileBootOption (BootOption);
|
||||
Status = CompileBootOption(BootOption);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -958,7 +958,7 @@ AddBootOption (
|
||||
//
|
||||
// Save BootXXXX var
|
||||
//
|
||||
Status = gRT->SetVariable (VarName,
|
||||
Status = gRT->SetVariable(VarName,
|
||||
gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE
|
||||
| EFI_VARIABLE_BOOTSERVICE_ACCESS
|
||||
@ -980,7 +980,7 @@ AddBootOption (
|
||||
//
|
||||
// Update BootOrder - add our new boot option as BootIndex in the list
|
||||
//
|
||||
Status = AddToBootOrder (BootOption->BootNum, BootIndex);
|
||||
Status = AddToBootOrder(BootOption->BootNum, BootIndex);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -1033,7 +1033,7 @@ AddBootOptionForFile (
|
||||
BootOption.OptionalData = OptionalData;
|
||||
BootOption.OptionalDataSize = OptionalDataSize;
|
||||
|
||||
Status = AddBootOption (&BootOption, BootIndex);
|
||||
Status = AddBootOption(&BootOption, BootIndex);
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool(BootOption.FilePathList);
|
||||
DBG("AddBootOptionForFile: Error: %s\n", efiStrError(Status));
|
||||
|
@ -79,7 +79,7 @@ EFI_PART_TYPE_LEGACY_MBR_GUID {0x024DEE41, 0x33E7, 0x11D3, {0x9D, 0x69, 0x00, 0x
|
||||
// 1FEDE521-031C-4BC5-8050-F3D6161E2E92
|
||||
// BD8C1056-9F36-44EC-92A8-A6337F817986 gEfiEdidActiveProtocolGuid
|
||||
// 26baccba-6f42-11d4-bce7-008081883cc7
|
||||
// 63FAECF2-E7EE-4CB9-8A0C-11CE5E89E33C APPLE_EG2_INFO_PROTOCOL_GUID
|
||||
// 63FAECF2-E7EE-4CB9-8A0C-11CE5E89E33C APPLE_EG2_INFO_PROTOCOL_GUID - success!
|
||||
// 03B99B90-ECCF-451D-809E-8341FCB830AC RestartData protocol
|
||||
// 24B73556-2197-4702-82A8-3E1337DAFBF2 Apple Secure Boot enabled configuration
|
||||
// 24B73556-2197-4702-82A8-3E1337DAFBF3 Apple Trusted Boot enabled configuration
|
||||
@ -91,7 +91,10 @@ EFI_PART_TYPE_LEGACY_MBR_GUID {0x024DEE41, 0x33E7, 0x11D3, {0x9D, 0x69, 0x00, 0x
|
||||
// 59D76AE4-37E3-55A7-B460-EF13D46E6020 AppleEncryptedPartitionProtocolGuid
|
||||
// 17A1D98C-9A6C-460B-A3AD-D5C9E76D2177 - protocol before GetVariable(ExtendedFirmwareFeatures...)
|
||||
// EDB4A040-6D8A-11EC-8FAD-3E22FB93ADCF
|
||||
// DDFA34FB-FE1F-48EA-B213-FB4A4CD57BE3
|
||||
// E87B4CCA-E365-42D1-B1F5-1AEEE1A7C640 - #[EB.CS.GEBK|!]
|
||||
// 307F4965-33E3-4ABA-9A1A-0010D0ABA328 - @FileVault
|
||||
// B295BD1C-63E3-48E3-B265-F7DFA2070123 - success
|
||||
// 82ED9A9E-CCBB-4CD2-8A94-F4E3559AF911 - Gibraltar
|
||||
|
||||
/**
|
||||
Apple Debug Log protocol GUID.
|
||||
|
@ -76,10 +76,10 @@ EFI_STATUS Self::__initialize(XBool debugMsg, EFI_HANDLE SelfImageHandle, EFI_LO
|
||||
#endif
|
||||
|
||||
// History : if this Clover was started as BootX64.efi, redirect to /EFI/CLOVER
|
||||
if ( CloverDirFullPath.isEqualIC("\\EFI\\Boot\\BootX64.efi") ) { // keep getCloverDir() in sync !
|
||||
CloverDirFullPath.takeValueFrom("\\EFI\\CLOVER\\CloverX64.efi"); // keep getCloverDir() in sync !
|
||||
if ( CloverDirFullPath.isEqualIC("\\EFI\\Boot\\BootX64.efi") ||
|
||||
CloverDirFullPath.isEqualIC("\\EFI\\Microsoft\\Boot\\bootmgfw.efi")) {
|
||||
CloverDirFullPath.takeValueFrom("\\EFI\\CLOVER\\CLOVERX64.efi"); // keep getCloverDir() in sync !
|
||||
}
|
||||
|
||||
if ( CloverDirFullPath.lastChar() == U'\\' ) { // keep getCloverDir() in sync !
|
||||
log_technical_bug("CloverDirFullPath.lastChar() == U'\\'"); // Just to see if that happens.
|
||||
CloverDirFullPath.deleteCharsAtPos(CloverDirFullPath.length()-1, 1);
|
||||
|
@ -2314,13 +2314,13 @@ void ScanLoader(void)
|
||||
} while ( hasMovedSomething );
|
||||
|
||||
|
||||
DBG("Entries after before ordering\n");
|
||||
DBG("Entries list after ordering\n");
|
||||
for (size_t idx = 0; idx < MainMenu.Entries.sizeIncludingHidden(); idx++) {
|
||||
if ( MainMenu.Entries.ElementAt(idx).getLOADER_ENTRY() ) {
|
||||
// if ( MainMenu.Entries.ElementAt(idx).getLOADER_ENTRY() ) {
|
||||
// DBG(" Entry %zd : %ls%s\n", idx, MainMenu.Entries.ElementAt(idx).Title.wc_str(), MainMenu.Entries.ElementAt(idx).Hidden ? " (hidden)" : "");
|
||||
// }else{
|
||||
DBG(" Entry %zd : %ls%s\n", idx, MainMenu.Entries.ElementAt(idx).Title.wc_str(), MainMenu.Entries.ElementAt(idx).Hidden ? " (hidden)" : "");
|
||||
}else{
|
||||
DBG(" Entry %zd : %ls%s\n", idx, MainMenu.Entries.ElementAt(idx).Title.wc_str(), MainMenu.Entries.ElementAt(idx).Hidden ? " (hidden)" : "");
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -68,7 +68,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_SCAN_TOOL 0
|
||||
#define DEBUG_SCAN_TOOL 1
|
||||
#else
|
||||
#define DEBUG_SCAN_TOOL DEBUG_ALL
|
||||
#endif
|
||||
@ -163,7 +163,8 @@ STATIC void AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.SWPrintf("Add Clover boot options for all entries");
|
||||
SubEntry->LoadOptions.setEmpty();
|
||||
SubEntry->LoadOptions.Add("BO-ADD");
|
||||
SubEntry->LoadOptions.Add(L"BO-ADD");
|
||||
SubEntry->AtDoubleClick = ActionEnter;
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
@ -171,7 +172,7 @@ STATIC void AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.SWPrintf("Remove all Clover boot options");
|
||||
SubEntry->LoadOptions.setEmpty();
|
||||
SubEntry->LoadOptions.Add("BO-REMOVE");
|
||||
SubEntry->LoadOptions.Add(L"BO-REMOVE");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
@ -179,7 +180,7 @@ STATIC void AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.SWPrintf("Print all UEFI boot options to log");
|
||||
SubEntry->LoadOptions.setEmpty();
|
||||
SubEntry->LoadOptions.Add("BO-PRINT");
|
||||
SubEntry->LoadOptions.Add(L"BO-PRINT");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ EFI_STATUS GetRootFromPath(IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, OUT EFI_FILE
|
||||
EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
|
||||
{
|
||||
self.initialize(ImageHandle);
|
||||
// DBG("SelfDirPath = %ls\n", self.getCloverDirFullPath().wc_str());
|
||||
DBG("SelfDirPath = %ls\n", self.getCloverDirFullPath().wc_str());
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1435,7 +1435,7 @@ InitializeUnicodeCollationProtocol (void)
|
||||
}
|
||||
|
||||
//
|
||||
// BUGBUG: Proper impelmentation is to locate all Unicode Collation Protocol
|
||||
// BUGBUG: Proper implementation is to locate all Unicode Collation Protocol
|
||||
// instances first and then select one which support English language.
|
||||
// Current implementation just pick the first instance.
|
||||
//
|
||||
|
@ -3317,7 +3317,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
}
|
||||
MenuExit = MainMenu.RunMainMenu(DefaultIndex, &ChosenEntry);
|
||||
}
|
||||
// DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
|
||||
DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
|
||||
// disable default boot - have sense only in the first run
|
||||
gSettings.Boot.Timeout = -1;
|
||||
if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {
|
||||
@ -3426,6 +3426,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
HelpRefit();
|
||||
break;
|
||||
*/
|
||||
DBG("1\n");
|
||||
if ( ChosenEntry->getLOADER_ENTRY() ) { // Boot OS via .EFI loader
|
||||
SetBootCurrent(ChosenEntry->getLOADER_ENTRY());
|
||||
ChosenEntry->StartLoader();
|
||||
@ -3435,6 +3436,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
ReinitDesktop = false;
|
||||
AfterTool = true;
|
||||
}
|
||||
DBG("2\n");
|
||||
if ( ChosenEntry->getLEGACY_ENTRY() ) { // Boot legacy OS
|
||||
if (StrCmp(gST->FirmwareVendor, L"Phoenix Technologies Ltd.") == 0 &&
|
||||
gST->Hdr.Revision >> 16 == 2 && (gST->Hdr.Revision & ((1 << 16) - 1)) == 0){
|
||||
@ -3450,7 +3452,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
ChosenEntry->StartLegacy();
|
||||
}
|
||||
}
|
||||
|
||||
DBG("3\n");
|
||||
if ( ChosenEntry->getREFIT_MENU_ENTRY_LOADER_TOOL() ) { // Start a EFI tool
|
||||
ChosenEntry->StartTool();
|
||||
TerminateScreen(); //does not happen
|
||||
@ -3460,7 +3462,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
MainLoopRunning = false;
|
||||
AfterTool = true;
|
||||
}
|
||||
|
||||
DBG("4\n");
|
||||
#ifdef ENABLE_SECURE_BOOT
|
||||
log_technical_bug("not done yet");
|
||||
// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
|
||||
@ -3474,8 +3476,9 @@ log_technical_bug("not done yet");
|
||||
// AfterTool = true;
|
||||
// }
|
||||
#endif // ENABLE_SECURE_BOOT
|
||||
|
||||
DBG("come to Clover entry\n");
|
||||
if ( ChosenEntry->getREFIT_MENU_ENTRY_CLOVER() ) { // Clover options
|
||||
DBG("enter Clover entry\n");
|
||||
REFIT_MENU_ENTRY_CLOVER* LoaderEntry = ChosenEntry->getREFIT_MENU_ENTRY_CLOVER();
|
||||
if (LoaderEntry->LoadOptions.notEmpty()) {
|
||||
// we are uninstalling in case user selected Clover Options and EmuVar is installed
|
||||
@ -3485,7 +3488,9 @@ log_technical_bug("not done yet");
|
||||
gEmuVariableControl->UninstallEmulation(gEmuVariableControl);
|
||||
}
|
||||
*/
|
||||
if ( LoaderEntry->LoadOptions.contains("BO-ADD") ) {
|
||||
DBG(" Clover entry not empty\n");
|
||||
if ( LoaderEntry->LoadOptions.contains(L"BO-ADD") ) {
|
||||
DBG(" BO-ADD");
|
||||
XStringW Description;
|
||||
CONST CHAR16 *LoaderName;
|
||||
INTN EntryIndex, NameSize, Name2Size;
|
||||
@ -3506,6 +3511,7 @@ log_technical_bug("not done yet");
|
||||
|
||||
Entry = (LOADER_ENTRY *)MainMenu.Entries[EntryIndex].getLOADER_ENTRY();
|
||||
XStringW& VolName = Entry->Volume->VolName;
|
||||
DBG("add entry for volume %ls\n", VolName.wc_str());
|
||||
if (VolName.isEmpty()) {
|
||||
VolName = NullXStringW;
|
||||
}
|
||||
@ -3520,7 +3526,7 @@ log_technical_bug("not done yet");
|
||||
Name2Size = StrSize(LoaderName);
|
||||
}
|
||||
|
||||
Description = SWPrintf("Clover start %ls at %ls", (LoaderName != NULL)?LoaderName:L"legacy", VolName.wc_str());
|
||||
Description = SWPrintf("Clover UEFI");
|
||||
OptionalDataSize = NameSize + Name2Size + 4 + 2; //signature + VolNameSize
|
||||
OptionalData = (__typeof__(OptionalData))AllocateZeroPool(OptionalDataSize);
|
||||
if (OptionalData == NULL) {
|
||||
@ -3552,13 +3558,13 @@ log_technical_bug("not done yet");
|
||||
|
||||
|
||||
PrintBootOptions(false);
|
||||
} else if ( LoaderEntry->LoadOptions.contains("BO-REMOVE") ) {
|
||||
} else if ( LoaderEntry->LoadOptions.contains(L"BO-REMOVE") ) {
|
||||
PrintBootOptions(false);
|
||||
Status = DeleteBootOptionForFile (LoaderEntry->Volume->DeviceHandle,
|
||||
LoaderEntry->LoaderPath
|
||||
);
|
||||
PrintBootOptions(false);
|
||||
} else if ( LoaderEntry->LoadOptions.contains("BO-PRINT") ) {
|
||||
} else if ( LoaderEntry->LoadOptions.contains(L"BO-PRINT") ) {
|
||||
PrintBootOptions(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user