Flashing an image

From RidgeRun Developer Wiki





Follow Us On Twitter LinkedIn Email Share this page







Flash software images

Obtain flashable binaries

On build completion, flashable images can be obtained from the following paths:

<Base_Workspace_Path>/build/tmp/deploy/images/<MACHINE>/<IMAGE>-<MACHINE>.rootfs.qcomflash
<Base_Workspace_Path>/build/tmp/deploy/images/<MACHINE>/<IMAGE>-<MACHINE>.rootfs.qcomflash.tar.gz

To unpack the compressed image:

cd <Base_Workspace_Path>/build/tmp/deploy/images/<MACHINE>/
tar -xvf <IMAGE>-<MACHINE>.rootfs.qcomflash.tar.gz

Flash instructions

Follow these steps to flash the software images:

  1. Update the udev rules (one-time prerequisite).
  2. Force the device into emergency download (EDL) mode.
  3. Install QDL.
  4. Provision UFS (one-time prerequisite).
  5. Flash SAIL (one-time prerequisite).
  6. Choose CDT based on reference kit.
  7. Flash the software

1. Update udev rules (one-time prerequisite)

Go to the udev USB rules directory:

cd /etc/udev/rules.d

List the contents of the directory using ls. If the 51-qcom-usb.rules file isn’t present, create it with:

sudo vi 51-qcom-usb.rules

And add the following content (if file exists, check contents to match):

SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0666", GROUP="plugdev"

Restart udev:

sudo systemctl restart udev

If the USB cable is already connected to the host, unplug and reconnect the cable for the updated rules to take effect.


2. Force device into EDL mode

Make sure the USB-C cable is connected in USB0 (ADB) Put the device into Emergency Download (EDL) mode before flashing. To do it manually:

  • Put the device in EDL mode by turning on the dip switch SW2-3.
  • Verify if the device is in EDL mode with lsusb. If the output says QDL mode, the device is in EDL mode:
Bus 002 Device 014: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)

3. Install QDL

Download the Qualcomm Device Loader (QDL). QDL is a software tool that communicates with the Qualcomm USB devices to upload a flash loader and flash software images. You can do it from Qualcomm Software Center or using CLI:

# Linux X64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/Linux/Debian/latest.zip
# Linux ARM64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/Linux/ARM64/Debian/latest.zip
# macOS X64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/macOS/latest.zip
# macOS ARM64
wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Loader/macOS/ARM64/latest.zip

Unzip it:

unzip <qdl_downloaded_file>.zip

And give it executable permission:

chmod -R 777 <qdl_download_path>


4. Provision UFS (one-time prerequisite)

Universal flash storage (UFS) provisioning helps to divide the storage into many LUNs, which stores different types of data separately. This improves access efficiency and system organization. Download the provision file. Download the correct one from the UFS Provision table of the Release Notes.

mkdir <provision_download_path>
cd <provision_download_path>
wget <provision_download_link>
# Example, wget https://artifacts.codelinaro.org/artifactory/codelinaro-le/Qualcomm_Linux/QCS6490/provision.zip
unzip <downloaded_zip_file>
# Example, unzip provision.zip

Then provision ufs

cd <provision_download_path>
<qdl_download_path>/QDL_<version>_<operating_system>_<architecture_type>/qdl --storage ufs prog_firehose_ddr.elf <Provision file>
# Example, <qdl_download_path>/QDL_2.3.9_Linux_x64/qdl --storage ufs prog_firehose_ddr.elf provision_1_3.xml

5. Flash SAIL (one-time prerequisite)

To flash the SAIL:

# SAIL image is under <workspace_path>/build/tmp/deploy/images/<MACHINE>/<IMAGE>-<MACHINE>/sail_nor
# qdl --storage spinor <prog.mbn> [<program> <patch> ...]
cd <workspace_path>/build/tmp/deploy/images/<MACHINE>/<IMAGE>-<MACHINE>/sail_nor
<qdl_download_path>/QDL_<version>_<operating_system>_<architecture_type>/qdl --storage spinor prog_firehose_ddr.elf rawprogram0.xml patch0.xml
# Example, <qdl_download_path>/QDL_2.3.9_Linux_x64/qdl --storage spinor prog_firehose_ddr.elf rawprogram0.xml patch0.xml

Succesfull result:

waiting for programmer...
flashed "SAIL_HYP" successfully
flashed "SAIL_SW1" successfully
flashed "SAIL_HYP_BKUP" successfully
flashed "SAIL_SW1_BKUP" successfully
flashed "PrimaryGPT" successfully
flashed "BackupGPT" successfully
11 patches applied

6. Flash software using QDL

Some Linux distributions include the ModemManager tool, which allows you to configure the mobile broadband. When you connect the device in the USB mode, it’s identified as a Qualcomm modem, and the ModemManager tries to configure the device. Because this interferes with the QDL flashing, you must disable the ModemManager before connecting your device. If you are using a Linux distribution with systemd, stop the ModemManager tool using the following command:

sudo systemctl stop ModemManager

Flash images:

cd <workspace_path>/build/tmp/deploy/images/<MACHINE>/<IMAGE>-<MACHINE>/

# For UFS storage
<qdl_download_path>/qdl --storage ufs prog_firehose_ddr.elf rawprogram*.xml patch*.xml

# For EMMC storage
<qdl_download_path>/qdl --storage emmc prog_firehose_ddr.elf rawprogram0.xml patch0.xml

Successful flashing output:

...
flashed "multiimgoem_b" successfully
flashed "multiimgqti_b" successfully
flashed "imagefv_b" successfully
flashed "toolsfv" successfully
flashed "PrimaryGPT" successfully
flashed "BackupGPT" successfully
flashed "PrimaryGPT" successfully
flashed "BackupGPT" successfully
78 patches applied
partition 1 is now bootable

Verify flashing

lsusb

Example output:

Bus 002 Device 003: ID 05c6:9135 Qualcomm, Inc.

The device reboots automatically after flashing. Remember to take the device out of EDL mode and restart it. It is advised to connect the flashing USB-C cable directly to host computer. Hubs and adapter might lead to issues when flashing.


Summary steps (wip)

scp ridgerun@10.251.101.207:~/build/tmp/deploy/images/iq-9075-evk/qcom-multimedia-proprietary-image-iq-9075-evk.rootfs.qcomflash.tar.gz .
tar -xvf qcom-multimedia-proprietary-image-iq-9075-evk.rootfs.qcomflash.tar.gz

With usb-c connected and edl mode

../QDL_2.5_Linux_x64/qdl --storage ufs prog_firehose_ddr.elf provision_1_2.xml
cd ..
cd qcom-multimedia-proprietary-image-iq-9075-evk/sail_nor/
~/dragonwing/QDL_2.5_Linux_x64/qdl --storage spinor prog_firehose_ddr.elf rawprogram0.xml patch0.xml
cd ..
~/dragonwing/QDL_2.5_Linux_x64/qdl --storage ufs prog_firehose_ddr.elf rawprogram*.xml patch*.xml