OpenCorePlatform: Add support for exposing OEM info

This commit is contained in:
vit9696 2020-01-25 12:23:14 +03:00
parent 40e864ac9e
commit 4b5959ecd8
6 changed files with 62 additions and 24 deletions

View File

@ -9,6 +9,7 @@ OpenCore Changelog
- Added PMC ACPI sample for 300-series chipsets
- Improved driver connection performance on APTIO IV
- Fixed boot option saving in LogoutHook.command
- Added support for OEM information in `ExposeSensitiveData`
#### v0.5.4
- Added Enter key handling in boot menu for quick proceed

Binary file not shown.

View File

@ -2361,6 +2361,7 @@ nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-log |
\item \texttt{0x01} --- Expose printable booter path as an UEFI variable.
\item \texttt{0x02} --- Expose OpenCore version as an UEFI variable.
\item \texttt{0x04} --- Expose OpenCore version in boot picker menu title.
\item \texttt{0x08} --- Expose OEM information as a set of UEFI variables.
\end{itemize}
Exposed booter path points to OpenCore.efi or its booter depending on the load order.
@ -2378,6 +2379,13 @@ u=$(nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-path | sed 's/.*GPT,\([^,]*\
To obtain OpenCore version use the following command in macOS:
\begin{lstlisting}[label=nvramver, style=ocbash]
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version
\end{lstlisting}
To obtain OEM information use the following commands in macOS:
\begin{lstlisting}[label=nvramver, style=ocbash]
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product # SMBIOS Type1 ProductName
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-vendor # SMBIOS Type2 Manufacturer
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-board # SMBIOS Type2 ProductName
\end{lstlisting}
\item

Binary file not shown.

View File

@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Wed Jan 22 16:59:51 2020
%DIF ADD ../Configuration.tex Wed Jan 22 16:59:51 2020
%DIF DEL PreviousConfiguration.tex Fri Jan 17 12:56:17 2020
%DIF ADD ../Configuration.tex Sat Jan 25 12:18:44 2020
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
@ -2421,7 +2421,8 @@ nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-log |
\item \texttt{0x01} --- Expose printable booter path as an UEFI variable.
\item \texttt{0x02} --- Expose OpenCore version as an UEFI variable.
\item \texttt{0x04} --- Expose OpenCore version in boot picker menu title.
\end{itemize}
\DIFaddbegin \item \texttt{\DIFadd{0x08}} \DIFadd{--- Expose OEM information as a set of UEFI variables.
}\DIFaddend \end{itemize}
Exposed booter path points to OpenCore.efi or its booter depending on the load order.
To obtain booter path use the following command in macOS:
@ -2440,7 +2441,16 @@ u=$(nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-path | sed 's/.*GPT,\([^,]*\
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version
\end{lstlisting}
\item
\DIFaddbegin \DIFadd{To obtain OEM information use the following commands in macOS:
}\DIFmodbegin
\begin{lstlisting}[label=nvramver, style=ocbash,alsolanguage=DIFcode]
%DIF > nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product # SMBIOS Type1 ProductName
%DIF > nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-vendor # SMBIOS Type2 Manufacturer
%DIF > nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-board # SMBIOS Type2 ProductName
\end{lstlisting}
\DIFmodend
\DIFaddend \item
\texttt{HaltLevel}\\
\textbf{Type}: \texttt{plist\ integer}, 64 bit\\
\textbf{Failsafe}: \texttt{0x80000000} (\texttt{DEBUG\_ERROR})\\

View File

@ -165,10 +165,11 @@ OcPlatformUpdateDataHub (
STATIC
VOID
OcPlatformUpdateSmbios (
IN OC_GLOBAL_CONFIG *Config,
IN OC_CPU_INFO *CpuInfo,
IN MAC_INFO_DATA *MacInfo,
IN OC_SMBIOS_UPDATE_MODE UpdateMode
IN OC_GLOBAL_CONFIG *Config,
IN OC_CPU_INFO *CpuInfo,
IN MAC_INFO_DATA *MacInfo,
IN OUT OC_SMBIOS_TABLE *SmbiosTable,
IN OC_SMBIOS_UPDATE_MODE UpdateMode
)
{
EFI_STATUS Status;
@ -355,12 +356,12 @@ OcPlatformUpdateSmbios (
Data.PlatformFeature = MacInfo->Smbios.PlatformFeature;
if (MacInfo->DataHub.SmcRevision != NULL) {
SmbiosGetSmcVersion (MacInfo->DataHub.SmcRevision, SmcVersion);
OcSmbiosGetSmcVersion (MacInfo->DataHub.SmcRevision, SmcVersion);
Data.SmcVersion = SmcVersion;
}
}
Status = CreateSmbios (&Data, UpdateMode, CpuInfo);
Status = OcSmbiosCreate (SmbiosTable, &Data, UpdateMode, CpuInfo);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "OC: Failed to update SMBIOS - %r\n", Status));
}
@ -553,6 +554,9 @@ OcLoadPlatformSupport (
OC_SMBIOS_UPDATE_MODE SmbiosUpdateMode;
MAC_INFO_DATA InfoData;
MAC_INFO_DATA *UsedMacInfo;
EFI_STATUS Status;
OC_SMBIOS_TABLE SmbiosTable;
BOOLEAN ExposeOem;
if (Config->PlatformInfo.Automatic) {
GetMacInfo (OC_BLOB_GET (&Config->PlatformInfo.Generic.SystemProductName), &InfoData);
@ -565,23 +569,38 @@ OcLoadPlatformSupport (
OcPlatformUpdateDataHub (Config, CpuInfo, UsedMacInfo);
}
if (Config->PlatformInfo.UpdateSmbios) {
SmbiosUpdateStr = OC_BLOB_GET (&Config->PlatformInfo.UpdateSmbiosMode);
ExposeOem = (Config->Misc.Security.ExposeSensitiveData & OCS_EXPOSE_OEM_INFO) != 0;
if (AsciiStrCmp (SmbiosUpdateStr, "TryOverwrite") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateTryOverwrite;
} else if (AsciiStrCmp (SmbiosUpdateStr, "Create") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateCreate;
} else if (AsciiStrCmp (SmbiosUpdateStr, "Overwrite") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateOverwrite;
} else if (AsciiStrCmp (SmbiosUpdateStr, "Custom") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateCustom;
if (ExposeOem || Config->PlatformInfo.UpdateSmbios) {
Status = OcSmbiosTablePrepare (&SmbiosTable);
if (!EFI_ERROR (Status)) {
if (ExposeOem) {
OcSmbiosExposeOemInfo (&SmbiosTable);
}
if (Config->PlatformInfo.UpdateSmbios) {
SmbiosUpdateStr = OC_BLOB_GET (&Config->PlatformInfo.UpdateSmbiosMode);
if (AsciiStrCmp (SmbiosUpdateStr, "TryOverwrite") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateTryOverwrite;
} else if (AsciiStrCmp (SmbiosUpdateStr, "Create") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateCreate;
} else if (AsciiStrCmp (SmbiosUpdateStr, "Overwrite") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateOverwrite;
} else if (AsciiStrCmp (SmbiosUpdateStr, "Custom") == 0) {
SmbiosUpdateMode = OcSmbiosUpdateCustom;
} else {
DEBUG ((DEBUG_WARN, "OC: Invalid SMBIOS update mode %a\n", SmbiosUpdateStr));
SmbiosUpdateMode = OcSmbiosUpdateCreate;
}
OcPlatformUpdateSmbios (Config, CpuInfo, UsedMacInfo, &SmbiosTable, SmbiosUpdateMode);
}
OcSmbiosTableFree (&SmbiosTable);
} else {
DEBUG ((DEBUG_WARN, "OC: Invalid SMBIOS update mode %a\n", SmbiosUpdateStr));
SmbiosUpdateMode = OcSmbiosUpdateCreate;
DEBUG ((DEBUG_WARN, "OC: Unable to obtain SMBIOS - %r\n", Status));
}
OcPlatformUpdateSmbios (Config, CpuInfo, UsedMacInfo, SmbiosUpdateMode);
}
if (Config->PlatformInfo.UpdateNvram) {