OpenCoreMisc: Implement file logging

This commit is contained in:
vit9696 2019-05-03 03:47:37 +03:00
parent 1e6b69f4b1
commit d5eaad375c
5 changed files with 15 additions and 6 deletions

Binary file not shown.

View File

@ -1413,9 +1413,10 @@ u=$(nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-path | sed 's/.*GPT,\([^,]*\
ioreg -lw0 -p IODeviceTree | grep boot-log | sort | sed 's/.*<\(.*\)>.*/\1/' | xxd -r -p
\end{lstlisting}
UEFI variable log may get truncated on some firmwares.
Using non-volatile flag will write the log to NVRAM flash after every
printed line. To obtain UEFI variable log use the following command
UEFI variable log does not include some messages and has no performance data. For safety
reasons log size is limited to 32 kilobytes. Some firmwares may truncate it much earlier
or drop completely if they have no memory. Using non-volatile flag will write the log to
NVRAM flash after every printed line. To obtain UEFI variable log use the following command
in macOS:
\begin{lstlisting}[label=nvramlog, style=ocbash]
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-log |
@ -1429,7 +1430,11 @@ nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-log |
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version
\end{lstlisting}
\emph{Note}: File logging is currently not implemented.
File logging will create a file named \texttt{opencore.log} at EFI volume root with
log contents. Please be warned that some file system drivers present in firmwares are
not reliable, and may corrupt data when writing files through UEFI. Log is attempted
to be written in the safest manner, and thus is very slow. Ensure that
\texttt{DisableWatchDog} is set to \texttt{true} when you use a slow drive.
\end{enumerate}

View File

@ -60,6 +60,8 @@
#define OPEN_CORE_CONFIG_PATH L"config.plist"
#define OPEN_CORE_LOG_PATH L"opencore.log"
#define OPEN_CORE_ACPI_PATH L"ACPI\\Custom\\"
#define OPEN_CORE_UEFI_DRIVER_PATH L"Drivers\\"

View File

@ -123,7 +123,9 @@ OcMiscEarlyInit (
Config->Misc.Debug.Target,
Config->Misc.Debug.DisplayDelay,
(UINTN) Config->Misc.Debug.DisplayLevel,
(UINTN) Config->Misc.Security.HaltLevel
(UINTN) Config->Misc.Security.HaltLevel,
OPEN_CORE_LOG_PATH,
Storage->FileSystem
);
DEBUG ((

View File

@ -93,7 +93,7 @@ OcReportVersion (
OC_VERSION_VARIABLE_NAME,
&gOcVendorVariableGuid,
OPEN_CORE_NVRAM_ATTR,
sizeof (mOpenCoreVersion),
AsciiStrLen (mOpenCoreVersion),
&mOpenCoreVersion[0]
);
}