> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.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)。
> * [以宽松模式启用安全外壳 (SSH) 以安全地访问您的主机设备](https://docs.qualcomm.com/bundle/publicresource/topics/80-80021-254/how_to.html#use-ssh)。

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

1. 选择 TrustZone 通过内置的 `devcfg.mbn`/ `devcfg_iot.mbn` XML 文件提供的配置选项。例如:`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 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> 是

  > * `devcfg`(用于 QCS6490)
  > * `devcfg_iot`(用于 IQ-9100、IQ-8300、IQ-615)
</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`

## **后续步骤**

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