# 修复CFG LOCK

注意只推荐已经成功安装macOS的用户使用此方法，对于还没安装macOS的用户，可以先将`Kernel -> Quirks`中的`AppleCpuPmCfgLock`和`AppleXcpmCfgLock`开启。

## 关闭CFG LOCK

所以你现在已经成功安装了macOS，但是想要关掉这烦人的`CFG LOCK`，不过要做的其实很简单。

首先在你的EFI/OC/Tools文件夹中放入如下两个文件并在config.plist配置：

* [VerifyMsrE2](https://github.com/acidanthera/OpenCorePkg/releases)
* [Modifed GRUB Shell](https://github.com/datasone/grub-mod-setup_var/releases)

然后下面的几个工具会很有帮助：

* [UEFITool](https://github.com/LongSoft/UEFITool/releases) (注意是UEFITool 而不是UEFIExtrac)
* [Universal-IFR-Extractor](https://github.com/LongSoft/Universal-IFR-Extractor/releases)

不要忘记关闭`Kernel -> Quirks`中的：

* `AppleCpuPmCfgLock`
* `AppleXcpmCfgLock`

最后，从你的主板厂商的官网下载对应的BIOS固件（如果找不到，可以使用第三方的工具提取）。

## 检查CFG Lock是否已经关闭

开机的时候选择`VerifyMsrE2`即可，然后屏幕上会打印出相关信息。

## 手动关闭CFG Lock

* 用 UEFITool 打开BIOS固件，然后查找字符串 `CFG Lock`，如果找不到说明你的主板不支持CFG Lock，否则继续下面的操作。

![](/files/-M0Cm-AZGcWbg75vR5Zx)

* 找到这个字符串的所在位置后，右键点击其上一级，选择导出为`Setup.bin`
* 用`ifrextract`将导出的Setup.bin转换为Setup.txt，打开终端，输入如下命令

```
ifrextract的路径 Setup.bin的路径 Setup.txt的路径
```

* 打开Setup.txt，然后搜索`CFG Lock, VarStoreInfo (VarOffset/VarName):`，然后记住后面的偏移量（比如0x5A4）

![](/files/-M0CoH4mTxfC4uNBe5yf)

* 重启，选择`Modified GRUB Shell`，然后输入如下命令：

```
setup_var 0x5A4(这里替换成你搜索到的值) 0x00
```

OK，工作已经完成了。现在你应该拥有正确的CPU电源管理了。

注意：你每次重置BIOS后，之前我们设置的0x00也会被还原，你可以再重新按上面的步骤做一次，或者修改后的值写入BIOS固件对应的版本中。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rmtt.gitbook.io/opencore-vanilla-guide/bu-chong/xiu-fu-cfg-lock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
