OcAppleImg4Lib: Optimise model lookup and fix some doc issues

This commit is contained in:
vit9696 2020-08-10 11:18:40 +03:00
parent 8837838fb3
commit d99f0640f6
10 changed files with 98 additions and 61 deletions

View File

@ -89,5 +89,4 @@ AppleModelYear:
- 2020
MinimumOSVersion: "10.15.6"
MaximumOSVersion: null
# FIXME: or J185F
AppleModelId: "J185"

View File

@ -85,5 +85,4 @@ AppleModelYear:
- 2020
MinimumOSVersion: "10.15.6"
MaximumOSVersion: null
# FIXME: or J185
AppleModelId: "J185F"

View File

@ -5,6 +5,31 @@ abort() {
exit 1
}
latexbuild() {
# Perform file cleanup.
rm -f ./*.aux ./*.log ./*.out ./*.pdf ./*.toc
# Perform a first pass
pdflatex -draftmode $1 $2 || \
abort "Unable to create $1 draft"
# Perform a number of TOC passes.
while grep 'Rerun to get ' "${1}.log" ; do
pdflatex -draftmode $1 $2 || \
abort "Unable to create $1 draft with TOC"
done
# Create a real PDF.
pdflatex $1 $2 || \
abort "Unable to create $1 PDF"
# Perform a number of TOC passes for PDF (usually not needed).
while grep 'Rerun to get ' "${1}.log" ; do
pdflatex -draftmode $1 $2 || \
abort "Unable to create $1 PDF with TOC"
done
}
cd "$(dirname "$0")" || abort "Wrong directory"
if [ "$(which latexdiff)" = "" ]; then
@ -15,36 +40,16 @@ if [ "$(which pdflatex)" = "" ]; then
abort "pdflatex is missing, check your TeX Live installation"
fi
rm -f ./*.aux ./*.log ./*.out ./*.pdf ./*.toc
pdflatex -draftmode Configuration.tex || \
abort "Unable to create configuration pdf"
pdflatex -draftmode Configuration.tex || \
abort "Unable to create configuration pdf with TOC"
pdflatex Configuration.tex || \
abort "Unable to create configuration pdf with TOC"
latexbuild Configuration
cd Differences || abort "Unable to process annotations"
rm -f ./*.aux ./*.log ./*.out ./*.pdf ./*.toc
latexdiff -s ONLYCHANGEDPAGE PreviousConfiguration.tex ../Configuration.tex \
> Differences.tex || \
abort "Unable to differentiate"
pdflatex -draftmode -interaction=nonstopmode Differences
pdflatex -draftmode -interaction=nonstopmode Differences
pdflatex -interaction=nonstopmode Differences
latexbuild Differences -interaction=nonstopmode
cd ../Errata || abort "Unable to process annotations"
rm -f ./*.aux ./*.log ./*.out ./*.pdf ./*.toc
pdflatex -draftmode Errata.tex || \
abort "Unable to create errata pdf"
pdflatex -draftmode Errata.tex || \
abort "Unable to create errata pdf with TOC"
pdflatex Errata.tex || \
abort "Unable to create errata pdf with TOC"
latexbuild Errata
exit 0

Binary file not shown.

View File

@ -3,7 +3,6 @@
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{upquote}
@ -2376,7 +2375,7 @@ entry choice will update till next manual reconfiguration.
\hyperref[miscsecurityprops]{Security Properties} section below.
\item
\texttt{Tools}\\
\texttt{Tools}\label{misctools}\\
\textbf{Type}: \texttt{plist\ array}\\
\textbf{Description}: Add tool entries to boot picker.
@ -2386,7 +2385,8 @@ entry choice will update till next manual reconfiguration.
\emph{Note}: Select tools, for example, UEFI Shell, are very
dangerous and \textbf{MUST NOT} appear in production configurations, especially
in vaulted ones and protected with secure boot, as they may be used to easily
bypass secure boot chain.
bypass secure boot chain. For tool examples check the \hyperref[uefitools]{UEFI}
section of this document.
\end{enumerate}
@ -3026,7 +3026,7 @@ 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]
\begin{lstlisting}[label=nvramoem, 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
@ -3222,8 +3222,8 @@ rm vault.pub
\item \texttt{j214k} --- \texttt{MacBookPro16,2}
\item \texttt{j223} --- \texttt{MacBookPro16,3}
\item \texttt{j215} --- \texttt{MacBookPro16,4}
\item \texttt{j185} --- \texttt{iMac20,1 (?)}
\item \texttt{j185f} --- \texttt{iMac20,2 (?)}
\item \texttt{j185} --- \texttt{iMac20,1}
\item \texttt{j185f} --- \texttt{iMac20,2}
\end{itemize}
\texttt{PlatformInfo} and \texttt{SecureBootModel} are independent,
@ -4518,11 +4518,12 @@ build -a X64 -b RELEASE -t XCODE5 -p FatPkg/FatPkg.dsc
build -a X64 -b RELEASE -t XCODE5 -p MdeModulePkg/MdeModulePkg.dsc
\end{lstlisting}
\subsection{Tools}\label{uefitools}
\subsection{Tools and Applications}\label{uefitools}
Standalone tools may help to debug firmware and hardware. Some of the known tools are listed below.
While some tools can be launched from within OpenCore many should be run separately either directly
or from \texttt{Shell}.
While some tools can be launched from within OpenCore, see more details in
the \hyperref[misctools]{Tools} subsection of the configuration, most should be run
separately either directly or from \texttt{Shell}.
To boot into OpenShell or any other tool directly save \texttt{OpenShell.efi}
under the name of \texttt{EFI\textbackslash BOOT\textbackslash BOOTX64.EFI}

Binary file not shown.

View File

@ -1,12 +1,14 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Mon Aug 10 07:19:59 2020
%DIF ADD ../Configuration.tex Mon Aug 10 07:25:17 2020
%DIF DEL PreviousConfiguration.tex Sat Aug 8 20:55:30 2020
%DIF ADD ../Configuration.tex Mon Aug 10 11:05:50 2020
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
%DIF 6d6
%DIF < \usepackage{fixltx2e} % provides \textsubscript
%DIF -------
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{upquote}
@ -2437,7 +2439,7 @@ entry choice will update till next manual reconfiguration.
\hyperref[miscsecurityprops]{Security Properties} section below.
\item
\texttt{Tools}\\
\texttt{Tools}\DIFaddbegin \label{misctools}\DIFaddend \\
\textbf{Type}: \texttt{plist\ array}\\
\textbf{Description}: Add tool entries to boot picker.
@ -2447,7 +2449,9 @@ entry choice will update till next manual reconfiguration.
\emph{Note}: Select tools, for example, UEFI Shell, are very
dangerous and \textbf{MUST NOT} appear in production configurations, especially
in vaulted ones and protected with secure boot, as they may be used to easily
bypass secure boot chain.
bypass secure boot chain. \DIFaddbegin \DIFadd{For tool examples check the }\hyperref[uefitools]{UEFI}
\DIFadd{section of this document.
}\DIFaddend
\end{enumerate}
@ -3092,7 +3096,9 @@ 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]
\DIFdelbegin %DIFDELCMD < \begin{lstlisting}[label=nvramver, style=ocbash]
%DIFDELCMD < %%%
\DIFdelend \DIFaddbegin \begin{lstlisting}[label=nvramoem, 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
@ -3290,8 +3296,8 @@ rm vault.pub
\item \texttt{\DIFadd{j214k}} \DIFadd{--- }\texttt{\DIFadd{MacBookPro16,2}}
\item \texttt{\DIFadd{j223}} \DIFadd{--- }\texttt{\DIFadd{MacBookPro16,3}}
\item \texttt{\DIFadd{j215}} \DIFadd{--- }\texttt{\DIFadd{MacBookPro16,4}}
\item \texttt{\DIFadd{j185}} \DIFadd{--- }\texttt{\DIFadd{iMac20,1 (?)}}
\item \texttt{\DIFadd{j185f}} \DIFadd{--- }\texttt{\DIFadd{iMac20,2 (?)}}
\item \texttt{\DIFadd{j185}} \DIFadd{--- }\texttt{\DIFadd{iMac20,1}}
\item \texttt{\DIFadd{j185f}} \DIFadd{--- }\texttt{\DIFadd{iMac20,2}}
\end{itemize}
\texttt{\DIFadd{PlatformInfo}} \DIFadd{and }\texttt{\DIFadd{SecureBootModel}} \DIFadd{are independent,
@ -4588,11 +4594,12 @@ build -a X64 -b RELEASE -t XCODE5 -p FatPkg/FatPkg.dsc
build -a X64 -b RELEASE -t XCODE5 -p MdeModulePkg/MdeModulePkg.dsc
\end{lstlisting}
\subsection{Tools}\label{uefitools}
\subsection{Tools \DIFaddbegin \DIFadd{and Applications}\DIFaddend }\label{uefitools}
Standalone tools may help to debug firmware and hardware. Some of the known tools are listed below.
While some tools can be launched from within OpenCore many should be run separately either directly
or from \texttt{Shell}.
While some tools can be launched from within OpenCore\DIFdelbegin \DIFdel{many }\DIFdelend \DIFaddbegin \DIFadd{, see more details in
the }\hyperref[misctools]{Tools} \DIFadd{subsection of the configuration, most }\DIFaddend should be run
separately either directly or from \texttt{Shell}.
To boot into OpenShell or any other tool directly save \texttt{OpenShell.efi}
under the name of \texttt{EFI\textbackslash BOOT\textbackslash BOOTX64.EFI}

Binary file not shown.

View File

@ -130,7 +130,8 @@ can be found at \href{https://github.com/acidanthera/bugtracker}{Acidanthera Bug
Boot picker menu may not show when upgrading macOS with the following error:
\texttt{OCUI: Entry kind 16 unsupported for IconOCB: ShowMenu failed - Unsupported}\\
\texttt{OCUI: Entry kind 16 unsupported for Icon}\\
\texttt{OCB: ShowMenu failed - Unsupported}\\
\texttt{Halting on critical error}
\textbf{Possible workarounds}:

View File

@ -42,23 +42,27 @@ typedef struct OC_SB_MODEL_DESC_ {
STATIC DERImg4Environment mEnvInfo;
STATIC CONST CHAR8 *mModelDefault = "j215";
///
/// List of model mapping to board identifiers.
/// Alphabetically sorted (!), for release order refer to the documentation.
///
STATIC OC_SB_MODEL_DESC mModelInformation[] = {
{ "j137", 0x0A }, ///< iMacPro1,1
{ "j680", 0x0B }, ///< MacBookPro15,1
{ "j132", 0x0C }, ///< MacBookPro15,2
{ "j140k", 0x17 }, ///< MacBookAir8,1
{ "j137", 0x0A }, ///< iMacPro1,1
{ "j140a", 0x37 }, ///< MacBookAir8,2
{ "j174", 0x0E }, ///< Macmini8,1
{ "j160", 0x0F }, ///< MacPro7,1
{ "j780", 0x07 }, ///< MacBookPro15,3
{ "j213", 0x18 }, ///< MacBookPro15,4
{ "j140k", 0x17 }, ///< MacBookAir8,1
{ "j152f", 0x3A }, ///< MacBookPro16,1
{ "j160", 0x0F }, ///< MacPro7,1
{ "j174", 0x0E }, ///< Macmini8,1
{ "j185", 0x22 }, ///< iMac20,1
{ "j185f", 0x23 }, ///< iMac20,2
{ "j213", 0x18 }, ///< MacBookPro15,4
{ "j214k", 0x3E }, ///< MacBookPro16,2
{ "j230k", 0x3F }, ///< MacBookAir9,1
{ "j223", 0x3B }, ///< MacBookPro16,3
{ "j215", 0x38 }, ///< MacBookPro16,4
{ "j185", 0x22 }, ///< iMac20,1 (?)
{ "j185f", 0x23 }, ///< iMac20,2 (?)
{ "j223", 0x3B }, ///< MacBookPro16,3
{ "j230k", 0x3F }, ///< MacBookAir9,1
{ "j680", 0x0B }, ///< MacBookPro15,1
{ "j780", 0x07 }, ///< MacBookPro15,3
};
STATIC BOOLEAN mHasDigestOverride;
@ -71,11 +75,32 @@ InternalGetModelInfo (
IN CONST CHAR8 *Model
)
{
UINTN Index;
UINTN Start;
UINTN End;
UINTN Curr;
INTN Cmp;
for (Index = 0; Index < ARRAY_SIZE (mModelInformation); ++Index) {
if (AsciiStrCmp (Model, mModelInformation[Index].HardwareModel) == 0) {
return &mModelInformation[Index];
//
// Classic binary search in a sorted string list.
//
Start = 0;
End = ARRAY_SIZE (mModelInformation) - 1;
while (Start <= End) {
Curr = (Start + End) / 2;
Cmp = AsciiStrCmp (mModelInformation[Curr].HardwareModel, Model);
if (Cmp == 0) {
return &mModelInformation[Curr];
} else if (Cmp < 0) {
Start = Curr + 1;
} else if (Curr > 0) {
End = Curr - 1;
} else {
//
// Even the first element does not match, required due to unsigned End.
//
return NULL;
}
}