> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 从 Qualcomm TEE 启用设备配置

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

## **前提条件**

> * [在设备上构建和编译软件](https://dragonwingdocs.qualcomm.com/Key-Documents/Firmware-Guide/build-firmware)。
> * [以 permissive 模式启用安全外壳（SSH），以安全访问你的主机设备](https://docs.qualcomm.com/bundle/publicresource/topics/80-80021-254/how_to.html#use-ssh)。

## **从 TrustZone 编译 devcfg 镜像**

1. 通过内置的 `devcfg.mbn`/ `devcfg_iot.mbn` XML 文件选择 TrustZone 提供的配置选项。例如：`trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/<chipset>/oem_config.xml`。
2. 使用以下命令从 TZ.XF.5.29.1 编译 devcfg 镜像。
   ```text theme={null}
   cd trustzone_images/build/ms
   export SECTOOLS=<Metabuild>/<chipset>.LE.X.x/common/sectoolsv2/ext/Linux/sectools
   python3 build_all.py -b TZ.XF.5.0 CHIPSET=<chipset> <devcfg> --cfg=build_config_deploy_<chipset>.xml
   ```
   此步骤会在 `trustzone_images/build/ms/bin/<build_flavor>` 生成 `devcfg.mbn`/ `devcfg_iot.mbn` 镜像。请使用以下构建风格和命令。

构建风格

<Tabs>
  <Tab title="QCS5430/QCS6490">
    ```text theme={null}
    EACAANAA
    ```
  </Tab>

  <Tab title="IQ-9075/IQ-9100">
    ```text theme={null}
    MAKAANAA
    ```
  </Tab>

  <Tab title="IQ-8275/IQ-8300">
    ```text theme={null}
    FAQAANAA
    ```
  </Tab>

  <Tab title="IQ-615">
    ```text theme={null}
    GABAANAA
    ```
  </Tab>
</Tabs>

构建命令：

<Tabs>
  <Tab title="QCS5430/QCS6490">
    ```text theme={null}
    python3 trustzone_images/build/ms/build_all.py CHIPSET=kodiak devcfg
    ```
  </Tab>

  <Tab title="IQ-9075/IQ-9100">
    ```text theme={null}
    python3 trustzone_images/build/ms/build_all.py CHIPSET=lemans devcfg_iot
    ```
  </Tab>

  <Tab title="IQ-8275/IQ-8300">
    ```text theme={null}
    python3 trustzone_images/build/ms/build_all.py CHIPSET=monaco devcfg_iot
    ```
  </Tab>

  <Tab title="IQ-615">
    ```text theme={null}
    python3 trustzone_images/build/ms/build_all.py CHIPSET=talos devcfg_iot
    ```
  </Tab>
</Tabs>

<Note>
  请使用以下 devcfg 文件：

  \<devcfg> 为

  > * QCS6490 使用 `devcfg`
  > * IQ-9100、IQ-8300、IQ-615 使用 `devcfg_iot`
</Note>

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

使用下表中列出的配置参数按需定制设备。

|                **配置参数**               |                                    **说明**                                   |
| :-----------------------------------: | :-------------------------------------------------------------------------: |
| `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 日志级别：<ul><li>Fatal：0</li><li>Error：1</li><li>Debug：2</li></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`

## **后续步骤**

* 要启用安全启动并确保设备上仅运行受信任的应用程序，请参阅[启用安全启动](./enable-secure-boot)。
* 要启用安全启动，必须熔断 QFPROM 熔丝。这是一次性且不可逆的过程，会永久设置这些值。有关更多信息，请参阅[设置 QFPROM 熔丝](./set-the-qfprom-fuses)。
