Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
6f91e974
O
OpenCorePKG_MOD
项目概览
btwise
/
OpenCorePKG_MOD
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OpenCorePKG_MOD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f91e974
编写于
4月 10, 2019
作者:
V
vit9696
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OpenCore: Connect HaltLevel, DisplayLevel, ExposeBootPath Misc preferences
上级
661ad65c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
164 addition
and
34 deletion
+164
-34
Application/Bootstrap/Bootstrap.c
Application/Bootstrap/Bootstrap.c
+15
-4
Docs/Configuration.pdf
Docs/Configuration.pdf
+0
-0
Docs/Configuration.tex
Docs/Configuration.tex
+67
-13
Docs/Sample.plist
Docs/Sample.plist
+10
-1
Include/OpenCore.h
Include/OpenCore.h
+2
-0
Include/Protocol/OcBootstrap.h
Include/Protocol/OcBootstrap.h
+4
-2
Platform/OpenCore/OpenCore.c
Platform/OpenCore/OpenCore.c
+62
-9
Platform/OpenCore/OpenCore.inf
Platform/OpenCore/OpenCore.inf
+3
-0
Platform/OpenCore/OpenCoreNvram.c
Platform/OpenCore/OpenCoreNvram.c
+1
-5
未找到文件。
Application/Bootstrap/Bootstrap.c
浏览文件 @
6f91e974
...
...
@@ -94,7 +94,8 @@ LoadOpenCore (
STATIC
VOID
StartOpenCore
(
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
FileSystem
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
FileSystem
,
IN
EFI_HANDLE
LoadHandle
)
{
EFI_STATUS
Status
;
...
...
@@ -112,7 +113,17 @@ StartOpenCore (
return
;
}
Bootstrap
->
ReRun
(
Bootstrap
,
FileSystem
);
if
(
Bootstrap
->
Revision
!=
OC_BOOTSTRAP_PROTOCOL_REVISION
)
{
DEBUG
((
DEBUG_ERROR
,
"BS: Unsupported bootstrap protocol %u vs %u
\n
"
,
Bootstrap
->
Revision
,
OC_BOOTSTRAP_PROTOCOL_REVISION
));
return
;
}
Bootstrap
->
ReRun
(
Bootstrap
,
FileSystem
,
LoadHandle
);
}
EFI_STATUS
...
...
@@ -168,7 +179,7 @@ UefiMain (
//
DEBUG
((
DEBUG_INFO
,
"BS: Trying to start loaded OpenCore image...
\n
"
));
StartOpenCore
(
FileSystem
);
StartOpenCore
(
FileSystem
,
LoadedImage
->
FilePath
);
DEBUG
((
DEBUG_INFO
,
"BS: Trying to load OpenCore image...
\n
"
));
Status
=
LoadOpenCore
(
FileSystem
,
ImageHandle
,
&
OcImageHandle
);
...
...
@@ -177,7 +188,7 @@ UefiMain (
return
EFI_NOT_FOUND
;
}
StartOpenCore
(
FileSystem
);
StartOpenCore
(
FileSystem
,
LoadedImage
->
FilePath
);
DEBUG
((
DEBUG_ERROR
,
"BS: Failed to start OpenCore image...
\n
"
));
return
EFI_NOT_FOUND
;
...
...
Docs/Configuration.pdf
浏览文件 @
6f91e974
无法预览此类型文件
Docs/Configuration.tex
浏览文件 @
6f91e974
...
...
@@ -485,7 +485,7 @@ Add \texttt{.clang\_complete} file with similar content to your UDK root:
-Wno-missing-field-initializers
-Wno-tautological-compare
-Wno-sign-compare
-Wno-varargs
-Wno-varargs
-Wno-unused-const-variable
\end{lstlisting}
...
...
@@ -1165,6 +1165,13 @@ behaviour that does not go to any other sections
\textbf
{
Description
}
: Apply debug configuration described in
\hyperref
[miscdebugprops]
{
Debug Properties
}
section below.
\item
\texttt
{
Security
}
\\
\textbf
{
Type
}
:
\texttt
{
plist
\
dict
}
\\
\textbf
{
Description
}
: Apply security configuration described in
\hyperref
[miscsecurityprops]
{
Security Properties
}
section below.
\end{enumerate}
\subsection
{
Debug Properties
}
\label
{
miscdebugprops
}
...
...
@@ -1179,37 +1186,72 @@ behaviour that does not go to any other sections
every printed line of visible logging output like console,
Data Hub, or serial port.
\item
\texttt
{
DisplayLevel
}
\\
\textbf
{
Type
}
:
\texttt
{
plist
\
integer
}
, 64 bit
\\
\textbf
{
Default value
}
:
\texttt
{
0
}
\\
\textbf
{
Description
}
: EDK II debug level bitmask (sum) showed onscreen.
Unless
\texttt
{
Target
}
enables console (onscreen) printing,
onscreen debug output will not be visible. The following levels
are supported (discover more in
\href
{
https://github.com/tianocore/edk2/blob/UDK2018/MdePkg/Include/Library/DebugLib.h
}{
DebugLib.h
}
):
\begin{itemize}
\tightlist
\item
\texttt
{
0x00000002
}
---
\texttt
{
DEBUG
\_
WARN
}
in
\texttt
{
DEBUG
}
,
\texttt
{
NOOPT
}
,
\texttt
{
RELEASE
}
.
\item
\texttt
{
0x00000040
}
---
\texttt
{
DEBUG
\_
INFO
}
in
\texttt
{
DEBUG
}
,
\texttt
{
NOOPT
}
.
\item
\texttt
{
0x00400000
}
---
\texttt
{
DEBUG
\_
VERBOSE
}
in custom builds.
\item
\texttt
{
0x80000000
}
---
\texttt
{
DEBUG
\_
ERROR
}
in
\texttt
{
DEBUG
}
,
\texttt
{
NOOPT
}
,
\texttt
{
RELEASE
}
.
\end{itemize}
\item
\texttt
{
ExposeBootPath
}
\\
\textbf
{
Type
}
:
\texttt
{
plist
\
boolean
}
\\
\textbf
{
Default value
}
:
\texttt
{
false
}
\\
\textbf
{
Description
}
: Expose printable booter path to OpenCore.efi or its booter
(depending on the load order) as an UEFI variable.
To obtain booter path use the following command in macOS:
\begin{lstlisting}
[label=nvrampath, style=ocbash]
nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-path
\end{lstlisting}
\item
\texttt
{
Target
}
\\
\textbf
{
Type
}
:
\texttt
{
plist
\
integer
}
\\
\textbf
{
Default value
}
:
\texttt
{
0
}
\\
\textbf
{
Description
}
: A bitmask (sum) of enabled logging targets.
By default all the logging output is hidden, so this option is
required to be set when debugging is necessary. The following
logging targets are supported:
required to be set when debugging is necessary.
The following logging targets are supported:
\begin{itemize}
\tightlist
\item
\texttt
{
1
}
--- Enable logging, otherwise all log is discarded.
\item
\texttt
{
2
}
--- Enable basic console (onscreen) logging.
\item
\texttt
{
4
}
--- Enable logging to Data Hub.
\item
\texttt
{
8
}
--- Enable serial port logging.
\item
\texttt
{
16
}
--- Enable UEFI variable logging.
\item
\texttt
{
32
}
--- Enable non-volatile UEFI variable logging.
\item
\texttt
{
64
}
--- Enable logging to file.
\item
\texttt
{
0x0
1
}
--- Enable logging, otherwise all log is discarded.
\item
\texttt
{
0x0
2
}
--- Enable basic console (onscreen) logging.
\item
\texttt
{
0x0
4
}
--- Enable logging to Data Hub.
\item
\texttt
{
0x0
8
}
--- Enable serial port logging.
\item
\texttt
{
0x10
}
--- Enable UEFI variable logging.
\item
\texttt
{
0x20
}
--- Enable non-volatile UEFI variable logging.
\item
\texttt
{
0x40
}
--- Enable logging to file.
\end{itemize}
\emph
{
Note
}
:
Console logging prints less than all the other variants.
Console logging prints less than all the other variants.
Depending on the build type (
\texttt
{
RELEASE
}
,
\texttt
{
DEBUG
}
, or
\texttt
{
NOOPT
}
) different amount of logging may be read (from least to most).
\emph
{
Note
}
:
To obtain Data Hub log use the following command
To obtain Data Hub log use the following command
in macOS:
\begin{lstlisting}
[label=dhublog, style=ocbash]
ioreg -lw0 -p IODeviceTree | grep boot-log | sort | sed 's/.*<
\(
.
*
\)
>.*/
\1
/' | xxd -r -p
\end{lstlisting}
\emph
{
Note
}
:
UEFI variable log may get truncated on some firmwares.
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
in macOS:
...
...
@@ -1222,6 +1264,18 @@ nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-log | \
\end{enumerate}
\subsection
{
Security Properties
}
\label
{
miscsecurityprops
}
\begin{enumerate}
\item
\texttt
{
HaltLevel
}
\\
\textbf
{
Type
}
:
\texttt
{
plist
\
integer
}
, 64 bit
\\
\textbf
{
Default value
}
:
\texttt
{
0x80000000
}
(
\texttt
{
DEBUG
\_
ERROR
}
)
\\
\textbf
{
Description
}
: EDK II debug level bitmask (sum) causing CPU to
halt (stop execution) after obtaining a message of
\texttt
{
HaltLevel
}
.
Possible values match
\texttt
{
DisplayLevel
}
values.
\end{enumerate}
\section
{
NVRAM
}
\label
{
nvram
}
\subsection
{
Introduction
}
\label
{
nvramintro
}
...
...
Docs/Sample.plist
浏览文件 @
6f91e974
...
...
@@ -435,9 +435,18 @@
<dict>
<key>
Delay
</key>
<integer>
0
</integer>
<key>
DisplayLevel
</key>
<integer>
2147483650
</integer>
<key>
ExposeBootPath
</key>
<false/>
<key>
Target
</key>
<integer>
7
</integer>
</dict>
<key>
Security
</key>
<dict>
<key>
HaltLevel
</key>
<integer>
2147483648
</integer>
</dict>
</dict>
<key>
NVRAM
</key>
<dict>
...
...
@@ -534,7 +543,7 @@
<key>
BIOSVersion
</key>
<string>
142.0.0.0.0
</string>
<key>
BIOSReleaseDate
</key>
<string>
02/14/19
</string>
<string>
02/14/
20
19
</string>
<key>
SystemManufacturer
</key>
<string></string>
<key>
SystemProductName
</key>
...
...
Include/OpenCore.h
浏览文件 @
6f91e974
...
...
@@ -31,6 +31,8 @@
#define OPEN_CORE_KEXT_PATH L"Kexts\\"
#define OPEN_CORE_NVRAM_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)
/**
Load ACPI compatibility support like custom tables.
...
...
Include/Protocol/OcBootstrap.h
浏览文件 @
6f91e974
...
...
@@ -28,7 +28,7 @@
///
/// OC_BOOTSTRAP_PROTOCOL revision
///
#define OC_BOOTSTRAP_PROTOCOL_REVISION
1
#define OC_BOOTSTRAP_PROTOCOL_REVISION
2
///
/// Forward declaration of OC_BOOTSTRAP_PROTOCOL structure.
...
...
@@ -40,12 +40,14 @@ typedef struct OC_BOOTSTRAP_PROTOCOL_ OC_BOOTSTRAP_PROTOCOL;
@param[in] This This protocol.
@param[in] FileSystem File system to bootstrap in.
@param[in] LoadPath EFI device path to loaded image.
**/
typedef
VOID
(
EFIAPI
*
OC_BOOTSTRAP_RERUN
)
(
IN
OC_BOOTSTRAP_PROTOCOL
*
This
,
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
FileSystem
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
FileSystem
,
IN
EFI_DEVICE_PATH_PROTOCOL
*
LoadPath
OPTIONAL
);
///
...
...
Platform/OpenCore/OpenCore.c
浏览文件 @
6f91e974
...
...
@@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <OpenCore.h>
#include <Uefi.h>
#include <Guid/OcLogVariable.h>
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/OcBootstrap.h>
...
...
@@ -28,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/OcCpuLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcStorageLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
...
...
@@ -140,16 +143,59 @@ OcStartImage (
return
Status
;
}
STATIC
VOID
OcStoreLoadPath
(
IN
EFI_DEVICE_PATH_PROTOCOL
*
LoadPath
OPTIONAL
)
{
EFI_STATUS
Status
;
CHAR16
*
DevicePath
;
CHAR8
OutPath
[
256
];
if
(
LoadPath
!=
NULL
)
{
DevicePath
=
ConvertDevicePathToText
(
LoadPath
,
FALSE
,
FALSE
);
if
(
DevicePath
!=
NULL
)
{
AsciiSPrint
(
OutPath
,
sizeof
(
OutPath
),
"%s"
,
DevicePath
);
FreePool
(
DevicePath
);
}
else
{
LoadPath
=
NULL
;
}
}
if
(
LoadPath
==
NULL
)
{
AsciiSPrint
(
OutPath
,
sizeof
(
OutPath
),
"Unknown"
);
}
Status
=
gRT
->
SetVariable
(
OC_LOG_VARIABLE_PATH
,
&
gOcLogVariableGuid
,
OPEN_CORE_NVRAM_ATTR
,
AsciiStrSize
(
OutPath
),
OutPath
);
DEBUG
((
EFI_ERROR
(
Status
)
?
DEBUG_WARN
:
DEBUG_INFO
,
"OC: Setting NVRAM %g:%a = %a - %r
\n
"
,
&
gOcLogVariableGuid
,
OC_LOG_VARIABLE_PATH
,
OutPath
,
Status
));
}
STATIC
VOID
OcMain
(
IN
OC_STORAGE_CONTEXT
*
Storage
IN
OC_STORAGE_CONTEXT
*
Storage
,
IN
EFI_DEVICE_PATH_PROTOCOL
*
LoadPath
OPTIONAL
)
{
EFI_STATUS
Status
;
CHAR8
*
Config
;
UINT32
ConfigSize
;
OC_CPU_INFO
CpuInfo
;
EFI_STATUS
Status
;
CHAR8
*
Config
;
UINT32
ConfigSize
;
OC_CPU_INFO
CpuInfo
;
Config
=
OcStorageReadFileUnicode
(
Storage
,
...
...
@@ -172,9 +218,15 @@ OcMain (
OcConfigureLogProtocol
(
mOpenCoreConfiguration
.
Misc
.
Debug
.
Target
,
mOpenCoreConfiguration
.
Misc
.
Debug
.
Delay
mOpenCoreConfiguration
.
Misc
.
Debug
.
Delay
,
(
UINTN
)
mOpenCoreConfiguration
.
Misc
.
Debug
.
DisplayLevel
,
(
UINTN
)
mOpenCoreConfiguration
.
Misc
.
Security
.
HaltLevel
);
if
(
mOpenCoreConfiguration
.
Misc
.
Debug
.
ExposeBootPath
)
{
OcStoreLoadPath
(
LoadPath
);
}
OcCpuScanProcessor
(
&
CpuInfo
);
OcLoadUefiSupport
(
Storage
,
&
mOpenCoreConfiguration
,
&
CpuInfo
);
OcLoadPlatformSupport
(
&
mOpenCoreConfiguration
,
&
CpuInfo
);
...
...
@@ -206,7 +258,8 @@ VOID
EFIAPI
OcBootstrapRerun
(
IN
OC_BOOTSTRAP_PROTOCOL
*
This
,
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
FileSystem
IN
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*
FileSystem
,
IN
EFI_DEVICE_PATH_PROTOCOL
*
LoadPath
OPTIONAL
)
{
EFI_STATUS
Status
;
...
...
@@ -229,7 +282,7 @@ OcBootstrapRerun (
return
;
}
OcMain
(
&
mOpenCoreStorage
);
OcMain
(
&
mOpenCoreStorage
,
LoadPath
);
OcStorageFree
(
&
mOpenCoreStorage
);
}
...
...
@@ -317,7 +370,7 @@ UefiMain (
// Return success in either case to let rerun work afterwards.
//
if
(
FileSystem
!=
NULL
)
{
mOpenCoreBootStrap
.
ReRun
(
&
mOpenCoreBootStrap
,
FileSystem
);
mOpenCoreBootStrap
.
ReRun
(
&
mOpenCoreBootStrap
,
FileSystem
,
LoadedImage
->
FilePath
);
DEBUG
((
DEBUG_ERROR
,
"OC: Failed to boot
\n
"
));
}
else
{
DEBUG
((
DEBUG_ERROR
,
"OC: Failed to locate file system
\n
"
));
...
...
Platform/OpenCore/OpenCore.inf
浏览文件 @
6f91e974
...
...
@@ -51,6 +51,9 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[Guids]
gOcLogVariableGuid
[Protocols]
gEfiDevicePathProtocolGuid ## CONSUMES
gEfiDevicePathProtocolGuid ## CONSUMES
...
...
Platform/OpenCore/OpenCoreNvram.c
浏览文件 @
6f91e974
...
...
@@ -23,10 +23,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
STATIC
CONST
UINT32
mDefaultAttributes
=
EFI_VARIABLE_BOOTSERVICE_ACCESS
|
EFI_VARIABLE_RUNTIME_ACCESS
;
VOID
OcLoadNvramSupport
(
IN
OC_GLOBAL_CONFIG
*
Config
...
...
@@ -131,7 +127,7 @@ OcLoadNvramSupport (
Status
=
gRT
->
SetVariable
(
UnicodeVariableName
,
&
VariableGuid
,
mDefaultAttributes
,
OPEN_CORE_NVRAM_ATTR
,
VariableSize
,
VariableData
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录