# 刷写映像

Source: [https://docs.qualcomm.com/doc/80-70015-11SC/topic/flash-the-images.html](https://docs.qualcomm.com/doc/80-70015-11SC/topic/flash-the-images.html)

刷写镜像涉及将整个镜像（包括分区、文件系统和数据）写入存储设备。

刷写镜像：

1. 有关要配置的熔丝列表，参见 [QFPROM 熔丝](https://docs.qualcomm.com/doc/80-70015-11SC/topic/appendix-fuse-configurations.html)。
2. 将所有二进制文件替换为已签名的二进制文件，包括 `prog_firehose_ddr.elf`。
3. 要将所有已签名二进制文件刷写到设备，参见 [Qualcomm Linux 编译指南 ➝ 使用 QSC CLI 编译](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/build_from_source_QSC_CLI.html)。
4. 生成签名镜像和 `sec.elf`后，启用安全启动：
    1. 首先刷写已签名镜像（不包括 `sec.elf`），并确保设备成功启动。
    2. 按照 [Qualcomm Linux 编译指南 ➝ 刷写镜像](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/flash_images.html)中的刷写过程刷写签名的镜像和 `sec.elf`。
    3. 使用[调通 → 已验证安全启动](https://docs.qualcomm.com/doc/80-70015-11SC/topic/bring-up.html#bring-up__section_fbw_jfg_s1c)验证是否启用了安全启动。
5. 启用安全启动后，设备希望使用称为验证镜像编程 (VIP) 的安全编程方法刷写镜像。在此版本中，可以使用以下解决方法编程器 (`prog_firehose_ddr.elf`) 镜像禁用 VIP，继续在安全设备上刷写镜像： &lt;&gt;/BOOT.MXF.1.0.c1/boot\_images/boot/QcomPkg/Library/DevPrgLib/devprg\_transfer.c
6. 无论安全启动启用检查如何，都在以下函数中将 `vip->state` 设置为 `VIP_DISABLED`：
int devprg_transfer_init(void)
        {
          int secboot, result;
          struct vip_data *vip = &vip_data;
          devprg_init_vip_state();
          secboot = devprg_is_secure_boot_enabled();
        //  if (secboot == 0) /*comment this to set vip state to VIP_DISABLED
            vip->state = VIP_DISABLED;
          result = devprg_transport_init();
          return result;
        }
        Copy to clipboard
7. 要重新编译 `prog_firehose_ddr.elf`，参见 [Qualcomm Linux 编译指南 ➝ GitHub 工作流程（固件和附加组件）。](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/build_addn_info.html)
8. 如果未使用 PCAT 刷写任何 PIL 签名镜像，按照以下步骤使用 SCP 手动推送 PIL 镜像：

        push adsp, cdsp, modem, wlan, ipa pil split binariesCopy to clipboard

    有关说明，参见 [Qualcomm Linux 编译指南 ➝ 操作方式 ➝ 使用 SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-254/how_to.html#use-ssh)。

1. 复制在签名输出中生成的 PIL 拆分 bin 和 `.mdt` 文件并替换到 &lt;&lt;QCM6490.LE.x.x&gt;/common/build/ufs/bin/QCM6490\_fw/lib/firmware/qcom/qcm6490/ 目录中。
    2. 通过 SSH 以根用户的身份连接到设备。有关说明，参见 [Qualcomm Linux 编译指南 ➝ 操作方式 ➝ 使用 SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-254/how_to.html#use-ssh)。
        运行以下命令：

            mount -o rw,remount  /
            scp <QCM6490.LE.x.x>/common/build/ufs/bin/QCM6490_fw/lib/firmware/qcom/qcm6490/. root@<IP_address>:/lib/firmware/qcom/qcm6490/
            Push gfx (a660_zap) pil split binaries, a660_zap.mdt and a660_zap.mbn from signed outout 
            scp <a660_zap signed output folder>/. root@<IP_address>:/lib/firmware/
            Push signed Venus binary:
            scp vpu20_1v.mbn root@<IP_address>:/lib/firmware/qcom/vpu-2.0/
            reboot
            Copy to clipboard
9. 要确认 PIL 加载是否成功，检查 dmesg 中的以下日志：

        [    7.597009] remoteproc remoteproc0: Booting fw image qcom/qcs6490/modem.mdt, size 6052
        [    8.095883] remoteproc remoteproc0: remote processor 4080000.remoteproc is now up
        [    5.938938] remoteproc remoteproc1: Booting fw image qcom/qcs6490/wpss.mdt, size 4612
        [    6.088524] remoteproc remoteproc1: remote processor 8a00000.remoteproc is now up
        [    5.951047] remoteproc remoteproc2: Booting fw image qcom/qcs6490/adsp.mdt, size 6852
        [    6.107310] remoteproc remoteproc2: remote processor 3000000.remoteproc is now up
        [    5.977966] remoteproc remoteproc3: Booting fw image qcom/qcs6490/cdsp.mdt, size 5252
        [    6.135802] remoteproc remoteproc3: remote processor a300000.remoteproc is now upCopy to clipboard

**Parent Topic:** [启用安全启动](https://docs.qualcomm.com/doc/80-70015-11SC/topic/enable-secure-boot.html)

Last Published: Dec 03, 2024

[Previous Topic
生成已签名的 sec.elf 镜像](https://docs.qualcomm.com/bundle/publicresource/80-70015-11SC/topics/generate-signed-sec-elf-image.md) [Next Topic
启用 SELinux](https://docs.qualcomm.com/bundle/publicresource/80-70015-11SC/topics/enable-selinux.md)