| 996 | //#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log" |
| 997 | |
| 998 | VOID LEGACY_ENTRY::StartLegacy() |
| 999 | { |
| 1000 | EFI_STATUS Status = EFI_UNSUPPORTED; |
| 1001 | |
| 1002 | // Unload EmuVariable before booting legacy. |
| 1003 | // This is not needed in most cases, but it seems to interfere with legacy OS |
| 1004 | // booted on some UEFI bioses, such as Phoenix UEFI 2.0 |
| 1005 | if (gEmuVariableControl != NULL) { |
| 1006 | gEmuVariableControl->UninstallEmulation(gEmuVariableControl); |
| 1007 | } |
| 1008 | |
| 1009 | if (gSettings.LastBootedVolume) { |
| 1010 | SetStartupDiskVolume(Volume, NullXStringW); |
| 1011 | } else if (gSettings.DefaultVolume.notEmpty()) { |
| 1012 | // DefaultVolume specified in Config.plist: |
| 1013 | // we'll remove macOS Startup Disk vars which may be present if it is used |
| 1014 | // to reboot into another volume |
| 1015 | RemoveStartupDiskVolume(); |
| 1016 | } |
| 1017 | |
| 1018 | |
| 1019 | egClearScreen(&MenuBackgroundPixel); |
| 1020 | BeginExternalScreen(TRUE/*, L"Booting Legacy OS"*/); |
| 1021 | XImage BootLogoX; |
| 1022 | BootLogoX.LoadXImage(ThemeX.ThemeDir, Volume->LegacyOS->IconName); |
| 1023 | BootLogoX.Draw((UGAWidth - BootLogoX.GetWidth()) >> 1, |
| 1024 | (UGAHeight - BootLogoX.GetHeight()) >> 1); |
| 1025 | |
| 1026 | //try my LegacyBoot |
| 1027 | switch (Volume->BootType) { |
| 1028 | case BOOTING_BY_CD: |
| 1029 | Status = bootElTorito(Volume); |
| 1030 | break; |
| 1031 | case BOOTING_BY_MBR: |
| 1032 | Status = bootMBR(Volume); |
| 1033 | break; |
| 1034 | case BOOTING_BY_PBR: |
| 1035 | if (gSettings.LegacyBoot == "LegacyBiosDefault"_XS8) { |
| 1036 | Status = bootLegacyBiosDefault(gSettings.LegacyBiosDefaultEntry); |
| 1037 | } else if (gSettings.LegacyBoot == "PBRtest"_XS8) { |
| 1038 | Status = bootPBRtest(Volume); |
| 1039 | } else if (gSettings.LegacyBoot == "PBRsata"_XS8) { |
| 1040 | Status = bootPBR(Volume, TRUE); |
| 1041 | } else { |
| 1042 | // default |
| 1043 | Status = bootPBR(Volume, FALSE); |
| 1044 | } |
| 1045 | break; |
| 1046 | default: |
| 1047 | break; |
| 1048 | } |
| 1049 | CheckError(Status, L"while LegacyBoot"); |
| 1050 | |
| 1051 | FinishExternalScreen(); |
| 1052 | } |
| 1053 | |
| 1054 | // |
| 1055 | // pre-boot tool functions |
no test coverage detected