Skip to content

Commit

Permalink
move self initialisation up
Browse files Browse the repository at this point in the history
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
  • Loading branch information
SergeySlice committed Mar 21, 2021
1 parent 977f3e2 commit c93da72
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Qemu/launch
Expand Up @@ -75,7 +75,7 @@ then
./qemu_portable/qemu-system-x86_64 \
-L qemu_portable \
-m 2048 \
-cpu core2duo \
-cpu Penryn \
-bios ./bios.bin-1.13.0 \
-machine q35 \
-device ahci,id=ahi \
Expand Down
24 changes: 17 additions & 7 deletions rEFIt_UEFI/Platform/BootLog.cpp
Expand Up @@ -208,12 +208,6 @@ static UINTN GetDebugLogFile()
EFI_FILE_PROTOCOL *RootDir;
EFI_FILE_PROTOCOL *LogFile;

EFI_TIME Now;
Status = gRT->GetTime(&Now, NULL);
if ( debugLogFileName.isEmpty() ) {
debugLogFileName = S8Printf("misc\\%d-%d-%d_%d-%d_%ls.log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, self.getCloverEfiFileName().wc_str());
}

// get RootDir from device we are loaded from
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if (EFI_ERROR(Status)) {
Expand Down Expand Up @@ -386,11 +380,28 @@ void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
MemLogfVA(TRUE, DebugMode, FormatString, Marker);
VA_END(Marker);
}
#if NEW_LOG
void InitBooterLog(void)
{
SetMemLogCallback(MemLogCallback);
}

#else
void InitBooterLog(void)
{
EFI_TIME Now;
EFI_STATUS Status;

Status = gRT->GetTime(&Now, NULL);
if (!EFI_ERROR(Status)) {
debugLogFileName = SWPrintf("misc\\%d-%d-%d_%d-%d-%d_%ls.log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second, self.getCloverEfiFileName().wc_str());
} else {
debugLogFileName = L"misc\\debug.log"_XSW;
}

SetMemLogCallback(MemLogCallback);
}
#endif

EFI_STATUS SetupBooterLog(BOOLEAN AllowGrownSize)
{
Expand Down Expand Up @@ -434,7 +445,6 @@ EFI_STATUS SaveBooterLog(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *File
return egSaveFile(BaseDir, FileName, (UINT8*)MemLogBuffer, MemLogLen);
}


void DbgHeader(CONST CHAR8 *str)
{
CHAR8 strLog[50];
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/entry_scan/loader.cpp
Expand Up @@ -1008,7 +1008,7 @@ void LOADER_ENTRY::AddDefaultMenu()

}

SubScreen->AddMenuEntry(&MenuEntryReturn, false);
// SubScreen->AddMenuEntry(&MenuEntryReturn, false); //one-way ticket to avoid confusion
// DBG(" Added '%ls': OSType='%d', OSVersion='%s'\n",Title,LoaderType,OSVersion);
}

Expand Down
8 changes: 4 additions & 4 deletions rEFIt_UEFI/refit/main.cpp
Expand Up @@ -2714,6 +2714,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,

gRT->GetTime(&Now, NULL);

Status = InitRefitLib(gImageHandle);
if (EFI_ERROR(Status))
return Status;

// firmware detection
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
if (!gFirmwareRevision) {
Expand All @@ -2740,10 +2744,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,



Status = InitRefitLib(gImageHandle);
if (EFI_ERROR(Status))
return Status;

//dumping SETTING structure
// if you change something in Platform.h, please uncomment and test that all offsets
// are natural aligned i.e. pointers are 8 bytes aligned
Expand Down

0 comments on commit c93da72

Please sign in to comment.