# 从 Qualcomm TEE 启用设备配置 (Devcfg)

配置 Qualcomm TEE 对于维护管理敏感数据和运行受信任应用程序的设备的安全性、合规性、性能和灵活性至关重要。可以使用设备配置 (devcfg) 框架调整 Qualcomm TEE 配置，该框架提供了一种集中的方式来管理和调整特定于设备的设置。

Note

- 请记住在 SELinux Permissive 模式下运行所有 SSH 命令。将来会支持 Enforcing 模式。
- 关于如何连接至设备的说明，请参阅 [Qualcomm Linux 编译指南 ➝ 操作方法 ➝ 使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。

## 从 TrustZone 编译 devcfg 镜像

1. 通过内置的 `devcfg.mbn` XML 文件选择 TrustZone 提供的配置选项。例如，`trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/<chipset>/oem_config.xml`。
2. 使用命令从 TZ.XF.5.29.1 编译 devcfg 镜像。

cd trustzone_images/build/ms
        
        python3 build_all.py -b TZ.XF.5.0 CHIPSET=<chipset> <devcfg> --cfg=build_config_deploy_<chipset>.xml
        Copy to clipboard

    此步骤在以下位置生成 devcfg.mbn 镜像：`trustzone_images/build/ms/bin/<build_flavor>`。

Note

相应地使用以下 devcfg 文件：

&lt;devcfg&gt; 为

> 
> 
> - `devcfg` QCS6490
> - `devcfg_iot` QCS9100

Important

> 
> 
> 默认情况下不会生成 devcfg\_iot.mbn 文件。请应用以下更改以编译 devcfg\_iot.mbn。
> 
> 
> 
> > 
> > 
> > trustzone_images/build/ms/build_config_deploy_lemans.xml
> >     @@ -60,9 +60,12 @@
> >     <alias build-once="false" disable="false" internal-test="false" recompile="true" strip="false" name="devcfg_auto_sgvm">
> >     <artifact name="devcfg_auto_sgvm"/>
> >     </alias>
> >     +  <alias build-once="false" disable="false" internal-test="false" recompile="true" strip="false" name="devcfg_iot">
> >     +  <artifact name="devcfg_iot"/>
> >     +  </alias>
> >     Copy to clipboard

该问题预计在下一版本中得到解决。

有关构建和编译的说明，请参见 [Qualcomm Linux 编译指南 ➝ GitHub 工作流（固件和附加功能）](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/build_addn_info.html)。

## 使用配置参数定制设备

使用下表列出的配置参数根据需要定制设备。

| 配置参数 | 说明 |
| --- | --- |
| `OEM_pil_secure_app_load_region_size` | 定制 TA 大小。 |
| `OEM_pil_subsys_load_region_start` | 配置用于在默认内存映射发生任何更改时定制 PIL 负载起始地址。 |
| `OEM_pil_subsys_load_region_size` | 配置用于在默认内存映射发生任何更改时定制 PIL 大小。 |
| `OEM_enable_app_fatal_err` | 当特定 TA 崩溃时，强制 TrustZone 系统发生致命错误。与 `OEM_crash_ta_name` 一起使用。 |
| `OEM_crash_ta_name` | 将条目替换为预期崩溃的 TA 名称和安全内核预期崩溃的 TA。 |
| `OEM_sec_wdog_bark_time` | 更改设备安全看门狗 bark 时间的默认配置。 |
| `OEM_sec_wdog_bite_time` | 更改设备安全看门狗 bite 时间的默认配置。 |
| `OEM_tz_log_level` | 设置 TrustZone 日志级别：<br><ul class="simple"><br><li><p>致命：0</p></li><br><li><p>错误：1</p></li><br><li><p>调试：2</p></li><br></ul> |

## 启用基于 RPMB 的 SFS 防回滚保护

要启用或禁用基于 RPMB 的 SFS 防回滚保护，请使用以下配置参数和 XML 文件。

**配置参数**

`cmnlib_gppo_rpmb_enablement`，可以设置为 Enabled 或 Disabled，其中默认值为 Enabled，并且只能在需要时更改。

**XML 文件位置**

`trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/common/cmnlib_oem_config.xml`

## 后续步骤

- 要启用安全启动并确保只有受信任的应用程序在设备上运行，请参阅[启用安全启动](https://docs.qualcomm.com/doc/80-70018-11SC/topic/enable-secure-boot.html#enable-secure-boot)。
- 要启用安全启动，必须​熔断 QFPROM 熔丝。这是一个一次性、不可逆的过程，可永久设置这些值。有关更多信息，请参阅 [QFPROM 熔丝](https://docs.qualcomm.com/doc/80-70018-11SC/topic/appendix-fuse-configurations.html#appendix-fuse-configurations)。

Last Published: Apr 29, 2025

[Previous Topic
配置安全服务](https://docs.qualcomm.com/bundle/publicresource/80-70018-11SC/topics/configure.md) [Next Topic
启用安全启动](https://docs.qualcomm.com/bundle/publicresource/80-70018-11SC/topics/enable-secure-boot.md)