# 配置

Qualcomm TEE 配置可以使用设备配置 (devcfg) 框架进行调整。

Note

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

TrustZone 通过 XML 文件（例如 `trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/<chipset>/oem_config.xml` 文件）提供配置选项。

XML 配置文件内置于 `devcfg.mbn` 中。以下命令用于从 TZ.XF.5.0 中编译 devcfg 镜像：

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

devcfg.mbn 映像在 `trustzone_images/build/ms/bin/<build_flavor>` 位置生成。

Note

`devcfg.mbn` 适用于 QCS6490，`devcfg_iot.mbn` 适用于 QCS9100。

有关生成 (build) 和编译的说明，请参见 [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><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 防回滚保护**

可以在位于 `trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/common/cmnlib_oem_config.xml` 的 XML 配置文件中启用或禁用基于 RPMB 的 SFS 防回滚保护：

> 
> 
> | `cmnlib_gppo_rpmb_enablement` | <ul class="simple"><br><li><p>已启用（默认值。仅在需要时更改。）</p></li><br><li><p>禁用</p></li><br></ul> |
> | --- | --- |

**SELinux 配置**

如果启用了 SELinux，则可能禁止您更新防回滚保护标志。

检查设备当前的 SELinux 配置（Enforcing 或 Permissive 模式）：

getenforce
    Copy to clipboard

如果设置为 Enforcing 模式，请运行 `setenforce` 命令更改模式。

1. 使用 SSH 连接至设备。
2. 使用以下命令更改 SELinux 模式。

    - 要将设备切换到 Enforcing 模式：

setenforce 1
            Copy to clipboard
    - 要将设备切换到 Permissive 模式：

setenforce 0
            Copy to clipboard
    - 要重新检查设备的当前配置（Enforcing 或 Permissive 模式）：

getenforce
            Copy to clipboard

- [启用安全启动](https://docs.qualcomm.com/doc/80-70017-11SC/topic/enable-secure-boot.html)
通过熔断一组属于 QFPROM 的硬件熔丝来启用安全启动。根证书的哈希值被熔断到用作主要 RoT 的硬件熔丝中。
- [启用 SELinux](https://docs.qualcomm.com/doc/80-70017-11SC/topic/enable-selinux.html)
启用 SELinux 后，所有系统对象（包括文件、目录、进程、套接字、驱动程序等）都标有安全上下文。
- [启用 UEFI 安全启动](https://docs.qualcomm.com/doc/80-70017-11SC/topic/enable-uefi-secure-boot.html)
可以设置初始 UEFI 安全启动配置，并将密钥和证书转换为 UEFI 可以理解的格式。
- [示例 OpenSSL 配置](https://docs.qualcomm.com/doc/80-70017-11SC/topic/appendix-openssl-configuration.html)
此示例显示了用于生成密钥和证书请求的配置文件。

Last Published: Apr 27, 2025

[Previous Topic
调通](https://docs.qualcomm.com/bundle/publicresource/80-70017-11SC/topics/bring-up.md) [Next Topic
启用安全启动](https://docs.qualcomm.com/bundle/publicresource/80-70017-11SC/topics/enable-secure-boot.md)