> ## 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.

# 从 APSS 更新 RTSS 软件镜像

本主题介绍通过邮箱（Mailbox）接口从 APSS 更新 RTSS 软件镜像的可用方法。

## **使用 Fastboot 方法更新软件镜像**

使用 [Fastboot](https://developer.android.com/tools/releases/platform-tools) 方法将 RTSS 软件镜像烧写到设备上。

### **前提条件**

1. 设备必须处于已启动状态。
2. [设置调试 UART](https://dragonwingdocs.qualcomm.com/Linux/devices/iq9075-evk/set-up-the-device#set-up-the-debug-uart).

### **步骤**

1. 在 APSS UART 控制台中运行以下命令，使设备进入 Fastboot 模式：
   > ```text theme={null}
   > reboot bootloader
   > ```
2. 运行以下 fastboot 命令，将 `sailhyp.elf` 和 `sailsw1.elf` 镜像烧写到 RTSS 分区：
   > ```text theme={null}
   > fastboot flash <partition_name> <software image path>
   > ```
   >
   > 例如：
   >
   > ```text theme={null}
   > linuxhost@machine:~$ fastboot flash sail_hyp_a  <path name>/qcs9075-iq-9075-evk/qcom-multimedia-image/sail_nor/sailhyp.elf
   > Sending 'sail_hyp_a' (632 KB)                      OKAY [  0.123s]
   > Writing 'sail_hyp_a'                               OKAY [  8.500s]
   > Finished. Total time: 8.756s
   > ```
   >
   > ```text theme={null}
   > linuxhost@machine:~$ fastboot flash sail_sw1_a  <path name>/qcs9075-iq-9075-evk/qcom-multimedia-image/sail_nor/sailsw1.elf
   > Sending 'sail_sw1_a' (1710 KB)                     OKAY [  0.123s]
   > Writing 'sail_sw1_a'                               OKAY [ 20.185s]
   > Finished. Total time: 20.448s
   > ```
   >
   > <Note>
   >   **注意**
   >
   >   `sailhyp.elf` 和 `sailsw1.elf` 镜像位于 `<Path name>\qualcomm-linux-spf-1-0_ap_standard_oem_sail\SAIL.SI.1.2\sail_proc\build\ms\bin\SAIL_RTOS\DEBUG\lemans\signed\`。
   > </Note>

<Note>
  **注意**<br />`sail_hyp_a` 映射到 `nor_partition_frtos.xml` 中定义的 `SAIL_HYP` 分区，`sail_sw1_a` 映射到其中定义的 `SAIL_SW1` 分区。同样，`sail_hyp_b` 映射到 `SAIL_HYP_BKUP`，`sail_sw1_b` 映射到 `SAIL_SW1_BKIP`。
</Note>

RTSS 软件镜像成功更新后，将显示以下日志：

* APSS 日志：
  > ```text theme={null}
  > - > Flashing partition sail_hyp_a (647720 bytes)<br />slMailBox_Init: Handshake 1 Done<br />slMailBox_Init: Handshake 2 Done<br />MailboxClientReg: Callback registered successfully for client 4<br />Flashing partition sail_hyp_a done — 647720 bytes in 8379 ms (75 KB/s)
  >     >
  >     > Flashing partition sail_sw1_a (1751936 bytes)<br />Flashing partition sail_sw1_a done — 1751936 bytes in 20120 ms (85 KB/s)
  > ```
* RTSS 日志：
  > ```text theme={null}
  > c0[   239.571062s] vSailUpdaterTask: Queue Item received
  > c0[   239.571197s] vSAILUpdaterMsgProcessReqMsg: Processing MSG ID Flash Image
  > c0[   239.571242s] xSAILUpdaterCoreProcessFlashImg: FLASH_IMAGE Request —
  > :::::::
  > c0[   247.791305s] xSAILUpdaterCoreProcessFlashImg: FLASH_IMAGE Response —
  > c0[   247.791703s] vSAILUpdaterMsgSendResponse: Sent Response success [Flash Image: SAIL_HYP]
  > :::::::
  > c0[   281.640997s] vSailUpdaterTask: Queue Item received
  > c0[   281.641132s] vSAILUpdaterMsgProcessReqMsg: Processing MSG ID Flash Image
  > c0[   281.641177s] xSAILUpdaterCoreProcessFlashImg: FLASH_IMAGE Request —
  > :::::::
  > c0[   301.331897s] xSAILUpdaterCoreProcessFlashImg: FLASH_IMAGE Response —
  > :::::::
  > ```

## **使用 sail\_updater 工具更新软件镜像**

### **前提条件**

1. 设备必须处于已启动状态。
2. [设置调试 UART](https://dragonwingdocs.qualcomm.com/Linux/devices/iq9075-evk/set-up-the-device#set-up-the-debug-uart).

### **步骤**

1. 在 APSS UART 控制台中运行以下命令，创建用于复制 `sailhyp.elf` 和 `sailsw1.elf` 镜像的测试文件夹：
   > ```text theme={null}
   > mount -o rw,remount /
   > ```
   ```text theme={null}
   cd tmp/
   ```
   ```text theme={null}
   mkdir test
   ```
2. 将 `sailhyp.elf` 和 `sailsw1.elf` 镜像文件推送到 `/tmp/test` 目录。

   例如：

   > ```text theme={null}
   > adb push sailhyp.elf /tmp/test
   > 268 KB/s (645792 bytes in 2.346s)
   > ```
   >
   > ```text theme={null}
   > adb push sailsw1.elf /tmp/test
   > 295 KB/s (950144 bytes in 3.138s)
   > ```
3. 启用对 `sailhyp.elf` 和 `sailsw1.elf` 镜像的访问权限。
   > ```text theme={null}
   > chmod 777 /tmp/test/*.elf
   > ```
4. 烧写 `sailhyp.elf` 和 `sailsw1.elf` 镜像。
   > ```text theme={null}
   > sail_updater -r 0 -p /tmp/test
   > ```
   >
   > APSS 日志：
   >
   > ```text theme={null}
   > :::::
   > sau_flashimg: /tmp/test/sailhyp.elf | fileLen: 647720 | alignment: bytesToAlign 24, byteAlign 40
   > sau_flashimg: SAIL_HYP | FlashPartition: 1 | FlashGptId: 0 | bufLen: 0x0009E240
   > :::::
   > sau_flashimg: /tmp/test/sailsw1.elf | fileLen: 1751936 | alignment: already aligned
   > sau_flashimg: SAIL_SW1 | FlashPartition: 1 | FlashGptId: 0 | bufLen: 0x001ABB80
   > sau:sau_flashimg:ok
   > :::::
   > sau_updategpt: SAIL_HYP, SAIL_SW1
   > sau:sau_updategpt:ok
   > sau:sau_memDeInit:ok
   > Initiate reboot
   > ```
   >
   > ```text theme={null}
   > sail_updater -r 1
   > ```
   >
   > APSS 日志：
   >
   > ```text theme={null}
   > root@qcs9075-iq-9075-evk:~# sail_updater -r 1
   > sau:sau_getopt_parser:ok
   > :::::
   > sau_getblinfo: crc ok
   > primaryGpt   (header/entry): ok | size: 0x00002080
   > secondaryGpt (header/entry): ok | size: 0x00002080
   > num_images: 2
   > SAIL_HYP — boot partition: 0 | GPT Id: 0 | size A/B: 0x000E1000 | entries matching: 0
   > SAIL_SW1 — boot partition: 0 | GPT Id: 0 | size A/B: 0x00200000 | entries matching: 0
   > :::::
   > sau_readimg:  SAIL_HYP | partition: 0 | GPT Id: 0 | bufLen: 0x000E1000
   > sau:sau_readimg:ok
   > sau_flashimg: SAIL_HYP | FlashPartition: 1 | FlashGptId: 0 | bufLen: 0x000E1000
   > sau:sau_flashimg:ok
   > :::::
   > sau_readimg:  SAIL_SW1 | partition: 0 | GPT Id: 0 | bufLen: 0x00200000
   > sau:sau_readimg:ok
   > sau_flashimg: SAIL_SW1 | FlashPartition: 1 | FlashGptId: 0 | bufLen: 0x00200000
   > sau:sau_flashimg:ok
   > :::::
   > sail_updater Flashing and On-reboot loading of Images Success
   > ```
   >
   > RTSS 日志：
   >
   > ```text theme={null}
   > c0[    98.878469s] vSailUpdaterTask: Queue Item received
   > :::::
   > c0[   109.249244s] vSAILUpdaterMsgSendResponse: Sent Response success [Read Image: SAIL_SW1]
   > :::::
   > c0[   109.266607s] vSailUpdaterTask: Queue Item received
   > :::::
   > c0[   130.313926s] vSAILUpdaterMsgSendResponse: Sent Response success [Flash Image: SAIL_SW1]
   > :::::
   > c0[   130.315479s] vSailUpdaterTask: Queue Item received
   > c0[   130.316120s] vSAILUpdaterMsgProcessReqMsg: Processing MSG ID Set OTA Metadata
   > :::::
   > c0[   130.432138s] vSAILUpdaterMsgSendResponse: Sent Response success [Set OTA Metadata]
   > ```
