mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
Implement scratching the debug.log at start.
This commit is contained in:
parent
28a0dc1e8b
commit
f745d8b0b3
@ -79,13 +79,21 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open log file from current root
|
// Open log file from current root
|
||||||
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
|
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
if ( GlobalConfig.ScratchDebugLogAtStart && Status == EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
EFI_STATUS StatusDelete;
|
||||||
|
StatusDelete = LogFile->Delete(LogFile);
|
||||||
|
if ( StatusDelete == EFI_SUCCESS) {
|
||||||
|
Status = EFI_NOT_FOUND; // to get it created next.
|
||||||
|
}else{
|
||||||
|
DebugLog(1, "Cannot delete log file %ls from current root : %s\n", DEBUG_LOG, efiStrError(StatusDelete));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the log file is not found try to create it
|
// If the log file is not found try to create it
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
|
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
||||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
|
||||||
}
|
}
|
||||||
RootDir->Close(RootDir);
|
RootDir->Close(RootDir);
|
||||||
RootDir = NULL;
|
RootDir = NULL;
|
||||||
@ -94,12 +102,20 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
|
|||||||
// try on first EFI partition
|
// try on first EFI partition
|
||||||
Status = egFindESP(&RootDir);
|
Status = egFindESP(&RootDir);
|
||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
|
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
if ( GlobalConfig.ScratchDebugLogAtStart && Status == EFI_SUCCESS)
|
||||||
|
{
|
||||||
|
EFI_STATUS StatusDelete;
|
||||||
|
StatusDelete = LogFile->Delete(LogFile);
|
||||||
|
if ( StatusDelete == EFI_SUCCESS) {
|
||||||
|
Status = EFI_NOT_FOUND; // to get it created next.
|
||||||
|
}else{
|
||||||
|
DebugLog(1, "Cannot delete log file %ls from 1st EFI partition : %s\n", DEBUG_LOG, efiStrError(StatusDelete));
|
||||||
|
}
|
||||||
|
}
|
||||||
// If the log file is not found try to create it
|
// If the log file is not found try to create it
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
|
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
||||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
|
||||||
}
|
}
|
||||||
RootDir->Close(RootDir);
|
RootDir->Close(RootDir);
|
||||||
RootDir = NULL;
|
RootDir = NULL;
|
||||||
|
@ -2264,7 +2264,21 @@ GetEarlyUserSettings (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prop = BootDict->propertyForKey("Debug");
|
Prop = BootDict->propertyForKey("Debug");
|
||||||
GlobalConfig.DebugLog = IsPropertyNotNullAndTrue(Prop);
|
if ( Prop ) {
|
||||||
|
if ( Prop->isString() ) {
|
||||||
|
if ( Prop->getString()->stringValue().equalIC("true") ) GlobalConfig.DebugLog = true;
|
||||||
|
else if ( Prop->getString()->stringValue().equalIC("false") ) GlobalConfig.DebugLog = false;
|
||||||
|
else if ( Prop->getString()->stringValue().equalIC("scratch") ) {
|
||||||
|
GlobalConfig.DebugLog = true;
|
||||||
|
GlobalConfig.ScratchDebugLogAtStart = true;
|
||||||
|
}
|
||||||
|
else MsgLog("MALFORMED config.plist : property Boot/Debug must be true, false, or scratch\n");
|
||||||
|
}else if ( Prop->isBool() ) {
|
||||||
|
GlobalConfig.DebugLog = Prop->getBool()->boolValue();
|
||||||
|
}else{
|
||||||
|
MsgLog("MALFORMED config.plist : property Boot/Debug must be a string (true, false, or scratch) or <true/> or <false/>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Prop = BootDict->propertyForKey("Fast");
|
Prop = BootDict->propertyForKey("Fast");
|
||||||
GlobalConfig.FastBoot = IsPropertyNotNullAndTrue(Prop);
|
GlobalConfig.FastBoot = IsPropertyNotNullAndTrue(Prop);
|
||||||
|
@ -822,6 +822,7 @@ public:
|
|||||||
BOOLEAN LegacyFirst;
|
BOOLEAN LegacyFirst;
|
||||||
BOOLEAN NoLegacy;
|
BOOLEAN NoLegacy;
|
||||||
BOOLEAN DebugLog;
|
BOOLEAN DebugLog;
|
||||||
|
BOOLEAN ScratchDebugLogAtStart;
|
||||||
BOOLEAN FastBoot;
|
BOOLEAN FastBoot;
|
||||||
BOOLEAN NeverHibernate;
|
BOOLEAN NeverHibernate;
|
||||||
BOOLEAN StrictHibernate;
|
BOOLEAN StrictHibernate;
|
||||||
@ -867,7 +868,8 @@ public:
|
|||||||
};
|
};
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
REFIT_CONFIG() : Timeout(-1), DisableFlags(0), TextOnly(FALSE), Quiet(TRUE), LegacyFirst(FALSE), NoLegacy(FALSE), DebugLog(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
|
REFIT_CONFIG() : Timeout(-1), DisableFlags(0), TextOnly(FALSE), Quiet(TRUE), LegacyFirst(FALSE), NoLegacy(FALSE),
|
||||||
|
DebugLog(FALSE), ScratchDebugLogAtStart(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
|
||||||
RtcHibernateAware(FALSE), HibernationFixup(FALSE), SignatureFixup(FALSE), Theme(), ScreenResolution(), ConsoleMode(0), CustomIcons(FALSE), IconFormat(ICON_FORMAT_DEF), NoEarlyProgress(FALSE), Timezone(0xFF),
|
RtcHibernateAware(FALSE), HibernationFixup(FALSE), SignatureFixup(FALSE), Theme(), ScreenResolution(), ConsoleMode(0), CustomIcons(FALSE), IconFormat(ICON_FORMAT_DEF), NoEarlyProgress(FALSE), Timezone(0xFF),
|
||||||
ShowOptimus(FALSE), Codepage(0xC0), CodepageSize(0xC0) {};
|
ShowOptimus(FALSE), Codepage(0xC0), CodepageSize(0xC0) {};
|
||||||
REFIT_CONFIG(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed
|
REFIT_CONFIG(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed
|
||||||
|
Loading…
Reference in New Issue
Block a user