Skip to content

Commit

Permalink
OcAppleSecureBootLib: Added BridgeOSHardwareModel NVRAM variable
Browse files Browse the repository at this point in the history
This variable is derived from `SecureBootModel` specified in the config
(e.g. j137 becomes J137AP) and is used by macOS 12 during updates
and installations. Setting this variable allows to use macOS 12
with T2 board identifiers, e.g. j137.
  • Loading branch information
vit9696 committed Oct 3, 2021
1 parent 102ede5 commit 7cd3db3
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ OpenCore Changelog
- Added large BaseSystem support in `AdviseFeatures`
- Updated builtin firmware versions for SMBIOS and the rest
- Added tool to extract vendor secure boot certificate from GRUB shim file
- Added `BridgeOSHardwareModel` NVRAM variable to fix T2 SB AP models on macOS 12

#### v0.7.3
- Improved SSDT-PNLF compatibility with CFL+ graphics
Expand Down
Binary file modified Docs/Configuration.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions Docs/Configuration.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4532,6 +4532,12 @@ \subsection{Recommended Variables}\label{nvramvarsrec}

\begin{itemize}
\tightlist
\item
\texttt{4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:BridgeOSHardwareModel}
\break
Bridge OS hardware model variable used to propagate to IODT bridge-model
by \texttt{EfiBoot}. Read by \texttt{hw.target sysctl}, used by
SoftwareUpdateCoreSupport.
\item
\texttt{7C436110-AB2A-4BBB-A880-FE41995C9F82:csr-active-config}
\break
Expand Down
Binary file modified Docs/Differences/Differences.pdf
Binary file not shown.
10 changes: 8 additions & 2 deletions Docs/Differences/Differences.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Sun Sep 12 01:31:15 2021
%DIF ADD ../Configuration.tex Wed Sep 22 18:46:43 2021
%DIF ADD ../Configuration.tex Sun Oct 3 07:48:42 2021

\usepackage{lmodern}
\usepackage{amssymb,amsmath}
Expand Down Expand Up @@ -4606,7 +4606,13 @@ \subsection{Recommended Variables}\label{nvramvarsrec}
\begin{itemize}
\tightlist
\item
\texttt{7C436110-AB2A-4BBB-A880-FE41995C9F82:csr-active-config}
\DIFaddbegin \texttt{\DIFadd{4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:BridgeOSHardwareModel}}
\break
\DIFadd{Bridge OS hardware model variable used to propagate to IODT bridge-model
by }\texttt{\DIFadd{EfiBoot}}\DIFadd{. Read by }\texttt{\DIFadd{hw.target sysctl}}\DIFadd{, used by
SoftwareUpdateCoreSupport.
}\item
\DIFaddend \texttt{7C436110-AB2A-4BBB-A880-FE41995C9F82:csr-active-config}
\break
32-bit System Integrity Protection bitmask. Declared in XNU source code in
\href{https://opensource.apple.com/source/xnu/xnu-4570.71.2/bsd/sys/csr.h.auto.html}{csr.h}.
Expand Down
Binary file modified Docs/Errata/Errata.pdf
Binary file not shown.
19 changes: 19 additions & 0 deletions Library/OcAppleSecureBootLib/OcAppleSecureBootLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ OcAppleSecureBootBootstrapValues (
)
{
EFI_STATUS Status;
CHAR8 BridgeModel[16];
UINTN BridgeModelSize;

ASSERT (Model != NULL);

Expand All @@ -106,6 +108,23 @@ OcAppleSecureBootBootstrapValues (
return Status;
}

for (BridgeModelSize = 0; mSbHardwareModel[BridgeModelSize] != '\0'; ++BridgeModelSize) {
BridgeModel[BridgeModelSize] = AsciiCharToUpper (mSbHardwareModel[BridgeModelSize]);
}
BridgeModel[BridgeModelSize] = '\0';

Status = gRT->SetVariable (
APPLE_BRIDGE_OS_HARDWARE_MODEL_VARIABLE_NAME,
&gAppleVendorVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
BridgeModelSize,
BridgeModel
);

if (EFI_ERROR (Status)) {
return Status;
}

Status = gRT->SetVariable (
L"HardwareModel",
&gAppleSecureBootVariableGuid,
Expand Down
1 change: 1 addition & 0 deletions Library/OcAppleSecureBootLib/OcAppleSecureBootLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

[Guids]
gAppleSecureBootVariableGuid ## SOMETIMES_CONSUMES
gAppleVendorVariableGuid ## SOMETIMES_CONSUMES

[Protocols]
gAppleSecureBootProtocolGuid ## SOMETIMES_PRODUCES
Expand Down

0 comments on commit 7cd3db3

Please sign in to comment.