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

# BSP image build with firmware

## Introduction

Provides a high-level overview of how to build firmware
components from source and integrate them into the Qualcomm BSP image.
It is intended for registered users with the appropriate licenses, as
access to firmware sources is restricted.

At a high level, you will learn the following:

* Set up the host system and install the required packages – [Host Setup](#host-setup)
* Download the firmware sources from Chipcode – [Sync Firmware Sources](#sync-firmware-sources)
* Compile the firmware sources – [Build Firmware](#build-firmware)
* Include firmware sources in the BSP image build – [Build BSP Image](#build-bsp-image)

## Supported SoCs

The following SoCs are supported by this document. If your chipset is not
listed, the firmware build process described here does not apply to your device.

| SoC      | Description                                    | Supported |
| -------- | ---------------------------------------------- | --------- |
| QCS6490  | Qualcomm Dragonwing™ RB3 Gen 2 Vision Kit      | ✓         |
|          | Qualcomm Dragonwing™ RB3 Gen 2 Core Kit        | ✓         |
|          | Qualcomm Dragonwing™ RB3 Gen 2 Industrial Kit  | ✓         |
| QCS5430  | Qualcomm Dragonwing™ RB3 Gen 2 Lite Vision Kit | ✓         |
|          | Qualcomm Dragonwing™ RB3 Gen 2 Lite Core Kit   | ✓         |
| IQ9      | Qualcomm Dragonwing™ IQ-9075 Evaluation Kit    | ✓         |
| IQ8      | Qualcomm Dragonwing™ IQ-8275 Evaluation Kit    | ✓         |
| IQ6      | Qualcomm Dragonwing™ IQ-615 Evaluation Kit     | ✓         |
| IQ-X7181 | Qualcomm Dragonwing™ IQ-X7181 Evaluation Kit   | ✓         |
| IQ-X5121 | Qualcomm Dragonwing™ IQ-X5121 Evaluation Kit   | ✓         |

## Host system requirements

* Operating System
  * Ubuntu 22.04

- Configuration
  * x86 machine
  * Quad-core CPU, for example, Intel i7-2600 at 3.4 GHz (equivalent or better)
  * 300 GB free disk space (swap partition > 32 GB)
  * 16 GB RAM
- Tools
  * Git 1.8.3.1 or later versions
  * Tar 1.28 or later versions
  * Python 3.10.2 or later versions
  * GCC 10.1 or later versions
  * GNU Make 4.0 or later versions
  * Kas 4.8 or later versions
- Permissions
  * `sudo` permission is required to run a few commands

## Install QSC-CLI

`qsc-cli` is a command-line tool provided by Qualcomm that offers an end-to-end workflow
for accessing, managing, and building Qualcomm software. Follow these steps to install
`qsc-cli` on your system:

* Register your Qualcomm email ID by visiting the [Qualcomm Support Page](https://www.qualcomm.com/support/working-with-qualcomm).

* Download the Debian package for `qsc-cli`:

  <CodeGroup>
    ```bash x86 theme={null}
    wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Software_Center/Linux/Debian/latest.deb -O qsc_installer.deb
    ```

    ```bash ARM64 theme={null}
    wget https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Software_Center/Linux/ARM64/Debian/latest.deb -O qsc_installer.deb
    ```
  </CodeGroup>

* Install the `qsc-cli` Debian package:
  ```bash theme={null}
  sudo apt update
  sudo apt install ./qsc_installer.deb
  ```

* Sign in to `qsc-cli` using your registered email ID:
  ```bash theme={null}
  qsc-cli login -u <username>
  ```

## Host setup

The following instructions are intended for use on a Ubuntu host system. The
Yocto build is also supported on other [distributions](https://docs.yoctoproject.org/ref-manual/system-requirements.html#supported-linux-distributions)
compatible with Yocto, but no validation is performed against them.

* Install the following packages to prepare your host environment for the Yocto build

  ```bash theme={null}
  sudo apt update
  sudo apt install build-essential chrpath cpio debianutils diffstat \
       file gawk gcc git iputils-ping libacl1 locales python3 python3-git \
       python3-jinja2 python3-pexpect python3-pip python3-subunit socat \
       texinfo unzip wget xz-utils zstd
  ```

* Qualcomm uses the `kas` tool to sync and build the Yocto project. Use
  the following commands to install `kas` on your system

  <Note>
    On older Ubuntu versions, the `kas` version provided by the system package
    manager may be outdated. Using `pipx` is the recommended way to install kas.
  </Note>

  ```bash theme={null}
   sudo apt install pipx

   # Restart your shell session after running this command to ensure
   # path changes take effect
   pipx ensurepath

   # The kas version is expected to be 4.8 or higher
   pipx install "kas>=4.8"
  ```

- The following packages are additionally required to compile firmware:
  ```bash theme={null}
  sudo apt-get install lib32stdc++6 libncurses5 checkinstall libreadline-dev \
       libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev \
       libbz2-dev libffi-dev curl
  ```

- Use `qsc-cli` to obtain the PAT token for Chipcode access. This
  token expires in two weeks.

  ```bash theme={null}
  qsc-cli show-access-token
  ```

  ```text Sample output theme={null}
  user@hostname:/local/mnt/workspace$ qsc-cli show-access-token
  [Info]: Starting qsc-cli version 0.0.0.9
  5LThNlklb55mMVLB5C2KqUGU2jCF
  ```

- Add the following entries to your `~/.netrc` file to authenticate access
  to Chipcode repositories:
  ```text theme={null}
  machine chipmaster2.qti.qualcomm.com
  login <login-id>
  password <access-token>

  machine qpm-git.qualcomm.com
  login <login-id>
  password <access-token>
  ```

- Update git configurations:
  ```bash theme={null}
  # Add the following git configurations to fetch large size repositories and to avoid unreliable connections
  git config --global http.postBuffer 1048576000
  git config --global http.maxRequestBuffer 1048576000
  git config --global http.lowSpeedLimit 0
  git config --global http.lowSpeedTime 999999
  # Add the following git configurations to follow remote redirects from http-alternates files or alternates
  git config --global http.https://chipmaster2.qti.qualcomm.com.followRedirects true
  git config --global http.https://qpm-git.qualcomm.com.followRedirects true
  ```

## Configuration parameters

The following table describes the build tags for the current release. These
values will be need to be substituted in the build commands.

| Release Tag                              | Identifier    |
| ---------------------------------------- | ------------- |
| meta-qcom-release-tag                    | qli-2.0       |
| meta-qcom-extras-release-tag             | qli-2.0       |
| firmware-release-tag                     | r2.0\_00007.2 |
| firmware-release-tag (IQ-X7181/IQ-X5121) | r2.0\_00008.0 |

## Map firmware source

The following tables describe the firmware distributions that you can download.
For more information about the Yocto layers, see
[Qualcomm Linux metadata layers](/Key-Documents/Yocto-Guide/qualcomm-linux-metadata-layers).

**Mapping access levels to firmware distributions**

| **Distribution**                                    | **Description**                                   | **Yocto layers**                                            |
| --------------------------------------------------- | ------------------------------------------------- | ----------------------------------------------------------- |
| Qualcomm\_Linux.SPF.2.0\|AP\|Standard\|OEM\|NoModem | High-level OS and firmware source (GPS only)      | `meta-qcom`<br />`meta-qcom-distro`<br />`meta-qcom-extras` |
| Qualcomm\_Linux.SPF.2.0\|AP\|Standard\|OEM          | High-level OS and firmware (GPS only) source      | `meta-qcom`<br />`meta-qcom-distro`<br />`meta-qcom-extras` |
| Qualcomm\_Linux.SPF.2.0\|AMSS\|Standard\|OEM        | High-level OS and firmware (GPS and modem) source | `meta-qcom`<br />`meta-qcom-distro`<br />`meta-qcom-extras` |

**Mapping firmware distributions to git repositories**

| **Distribution**                                      | **Repository URL**                                                                                                                                                                                           | **Clone Directory**                                |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------- |
| Qualcomm\_Linux.SPF.2.0\|AP\|Standard\|OEM\|NoModem\| | [https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-2-0\_ap\_standard\_oem\_nomodem.git](https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-2-0_ap_standard_oem_nomodem.git) | qualcomm-linux-spf-2-0\_ap\_standard\_oem\_nomodem |
| Qualcomm\_Linux.SPF.2.0\|AP\|Standard\|OEM\|          | [https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-2-0\_ap\_standard\_oem.git](https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-2-0_ap_standard_oem.git)                  | qualcomm-linux-spf-2-0\_ap\_standard\_oem          |
| Qualcomm\_Linux.SPF.2.0\|AMSS\|Standard\|OEM\|        | [https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-2-0\_amss\_standard\_oem.git](https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-2-0_amss_standard_oem.git)              | qualcomm-linux-spf-2-0\_amss\_standard\_oem        |

<Note>
  `Qualcomm_Linux.SPF.2.0|AP|Standard|OEM|` and `Qualcomm_Linux.SPF.2.0|AMSS|Standard|OEM|` distributions are only supported on QCS6490 chipset.
</Note>

## Build firmware

* Create a workspace directory for the firmware sources and navigate to it.
  All subsequent instructions assume this as the working directory.
  ```bash theme={null}
  mkdir -p <firmware-root>
  cd <firmware-root>
  ```

* Clone the firmware sources from Chipcode using the release tag and clone
  URL from the [Firmware Source Mapping](#firmware-source-mapping) table.
  ```bash theme={null}
  git clone -b <firmware-release-tag> --depth 1 <clone-url>
  ```

* Substitute the `<firwmare-root>` and `<distro-clone-directory>` in the following
  commands with the correct values based on the chosen access profile.

<Tabs>
  <Tab title="QCM6490/QCS5430">
    **Prerequisites**

    * Ensure that the working shell is `bash`:

      ```bash theme={null}
      echo $0
      ```

      The expected output of the command should be `bash`. If not, enter the bash
      shell.

      ```bash theme={null}
      bash
      ```

    * Install the libffi6 package using the following commands. This is required
      for the QAIC compiler, which generates the header and the source files from
      the IDL files.
      ```bash theme={null}
      curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
      sudo dpkg -i libffi6_3.2.1-8_amd64.deb
      ```

    * Install LLVM for AOP, Qualcomm<sup>®</sup> Trusted Execution Environment
      (TEE), and boot compilation:
      ```bash theme={null}
      cd <firmware-root>
      mkdir llvm
      # Sign in to qsc-cli and activate the license
      qsc-cli login
      qsc-cli tool activate-license --name sdllvm_arm
      # LLVM requirement for boot compilation is 14.0.4
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.4 --path <firmware-root>/llvm/14.0.4
      chmod -R 777 <firmware-root>/llvm/14.0.4
      # LLVM requirement for the Qualcomm TEE compilation is 16.0.7
      qsc-cli tool install --name sdllvm_arm --required-version 16.0.7 --path <firmware-root>/llvm/16.0.7
      chmod -R 777 <firmware-root>/llvm/16.0.7
      ```

    * Export the `SECTOOLS` variable and compile the firmware builds
      (`<firmware-root>/<distro-clone-directory>`
      is the top-level directory):
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/QCM6490.LE.2.0/common/sectoolsv2/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/QCM6490.LE.2.0/common/sectoolsv2/ext/Linux
      ```

    * Install and set up Qualcomm<sup>®</sup> Hexagon<sup>™</sup> Processor. Set
      the environment variable HEXAGON\_ROOT to the path where the Hexagon SDK is
      installed. To change the install path when using `qsc-cli`, see
      [Change the Hexagon tool install path](/Key-Documents/Firmware-Guide/how-to-change-hexagon-install-path).
      ```bash theme={null}
      qsc-cli tool extract --name hexagon8.4 --required-version 8.4.07
      qsc-cli tool extract --name hexagon8.4 --required-version 8.4.10
      export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```

    **Build aDSP**

    **Tools required**

    * Compiler version: Hexagon 8.4.07
    * Python version: Python 3.10.2
    * libffi6 package

    **Build steps**

    * Nanopb integration (one-time setup):
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.5.c8/adsp_proc/qsh_api
      curl https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.5-linux-x86.tar.gz -o nanopb-0.3.9.5-linux-x86.tar.gz
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.5.c8/adsp_proc/
      python qsh_api/build/config_nanopb_dependency.py -f nanopb-0.3.9.5-linux-x86
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.5.c8/adsp_proc/build/ms
      ```

    * Clean the build:
      ```bash theme={null}
      python ./build_variant.py kodiak.adsp.prod --clean
      ```

    * Build the image:
      ```bash theme={null}
      python ./build_variant.py kodiak.adsp.prod
      ```

    **Build Boot**

    **Tools required**

    * Compiler version: LLVM version must be updated to 14.0.4
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/14.0.4/
      ```
    * Python version: Python 3.10
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF.1.0.c1/
      ```

    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```

    * Clean the build:
      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t kodiak,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
      ```

    * Build the image:

      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t kodiak,QcomToolsPkg -v LAA -r RELEASE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build Qualcomm TEE firmware**

    **Tools required**

    * Compiler version: LLVM 16.0.7
    * Python version: Python 3.10

    **Build steps**

    * Install LLVM:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      vi build_config_deploy_kodiak.xml
      # Edit all the occurrences of /pkg/qct/software/llvm/release/arm/16.0.7/ to <firmware-root>/llvm/16.0.7/
      ```

    * Clean the build:
      ```bash theme={null}
      python build_all.py -b TZ.XF.5.0 CHIPSET=kodiak --cfg=build_config_deploy_kodiak.xml --clean
      ```

    * Build the image:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      python build_all.py -b TZ.XF.5.0 CHIPSET=kodiak --cfg=build_config_deploy_kodiak.xml
      ```

    **Build AOP firmware**

    **Tools required**

    * Compiler version: LLVM 14.0.4
    * Python version: Python 3.10

    **Build steps**

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/AOP.HO.3.6/aop_proc/build/
      ```

    * Clean the build:
      ```bash theme={null}
      ./build_kodiak.sh -c -l <firmware-root>/llvm/14.0.4/
      ```

    * Build the image:
      ```bash theme={null}
      ./build_kodiak.sh -l <firmware-root>/llvm/14.0.4/
      ```

    **Build MPSS**

    <Note>
      This step is only applicable for `Qualcomm_Linux.SPF.2.0|AMSS|Standard|OEM|`.
    </Note>

    **Tools required**

    * Compiler version: Hexagon 8.4.10
    * Python version: Python 3.8.2

    **Build steps**

    * Nanopb integration (one-time setup):
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/MPSS.HI.4.3.3.c6.2/modem_proc/ssc_api
      curl https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.5-linux-x86.tar.gz -o nanopb-0.3.9.5-linux-x86.tar.gz
      cd <firmware-root>/<distro-clone-directory>/MPSS.HI.4.3.3.c6.2/modem_proc
      python ssc_api/build/config_nanopb_dependency.py -f  nanopb-0.3.9.5-linux-x86
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/MPSS.HI.4.3.3.c6.2/modem_proc/build/ms
      ```

    * Clean the build:
      ```bash theme={null}
      python build_variant.py kodiak.gen.prod --clean
      ```

    * Build the image:
      ```bash theme={null}
      python build_variant.py kodiak.gen.prod bparams=-k
      ```

    **CPUCP firmware**

    Qualcomm releases the CPUCP firmware as a binary and you don’t need to compile
    the build.

    **CPUSYS.VM firmware**

    Qualcomm releases the CPUSYS.VM firmware as a binary and you don’t need to
    compile the build.

    **BTFM firmware**

    Qualcomm releases the BTFM firmware as a binary and you don’t need to compile
    the build.

    **WLAN firmware**

    Qualcomm releases the WLAN firmware as a binary and you don’t need to compile
    the build.

    **Generate firmware prebuilts (boot-critical and split-firmware binaries)**

    * Create an integrated firmware binary from the individual components that you
      compiled:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/QCM6490.LE.2.0/common/build
      python build.py --imf
      ```

    * Firmware prebuilt is successful if the following zip files are generated in the
      `<firmware-root>/<distro-clone-directory>/QCM6490.LE.2.0/common/build/ufs/bin`
      directory:
      * `QCM6490_bootbinaries.zip`
      * `QCM6490_dspso.zip`
      * `QCM6490_fw.zip`
  </Tab>

  <Tab title="IQ-9075">
    **Prerequisites**

    * Ensure that the working shell is `bash`:

      ```bash theme={null}
      echo $0
      ```

      The expected output of the command should be `bash`. If not, enter the
      bash shell.

      ```bash theme={null}
      bash
      ```

    * Install the libffi6 package using the following commands. This is required for
      the QAIC compiler, which generates the header and the source files from the
      IDL files:
      ```bash theme={null}
      curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
      sudo dpkg -i libffi6_3.2.1-8_amd64.deb
      ```

    * Install LLVM for AOP, Qualcomm<sup>®</sup> Trusted Execution Environment
      (TEE), and boot compilation:
      ```bash theme={null}
      cd <firmware-root>
      mkdir llvm
      # Sign in to qsc-cli and activate the license
      qsc-cli login
      qsc-cli tool activate-license --name sdllvm_arm
      # LLVM requirement for boot compilation is 14.0.4
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.4 --path <firmware-root>/llvm/14.0.4
      chmod -R 777 <firmware-root>/llvm/14.0.4
      # LLVM requirement for the Qualcomm TEE compilation is 16.0.7
      qsc-cli tool install --name sdllvm_arm --required-version 16.0.7 --path <firmware-root>/llvm/16.0.7
      chmod -R 777 <firmware-root>/llvm/16.0.7
      ```

    * Export the `SECTOOLS` variable and compile the firmware builds
      (`<firmware-root>/<distro-clone-directory>` is the
      top-level directory):
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/QCS9100.LE.2.0/common/sectoolsv2/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/QCS9100.LE.2.0/common/sectoolsv2/ext/Linux
      ```

    * Install and set up Qualcomm<sup>®</sup> Hexagon<sup>™</sup>. Set the environment variable HEXAGON\_ROOT to the
      path where the Hexagon SDK is installed. To change the install path when using
      `qsc-cli`, see [Change the Hexagon tool install path](/Key-Documents/Firmware-Guide/how-to-change-hexagon-install-path).
      ```bash theme={null}
      qsc-cli tool extract --name hexagon8.6 --required-version 8.6.05.2
      export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```

    **Build DSP**

    **Tools required**

    * Compiler version: Hexagon 8.6.05.2
    * Python version: Python 3.8.2

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC_PATH=/usr/bin
      ```

    * Install the dependencies:
      ```bash theme={null}
      pip install ruamel.yaml==0.17.17
      pip install dtschema==2021.10
      pip install jsonschema==4.0.0
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/DSP.AT.1.0.1/dsp_proc/build/ms
      ```

    * Clean the build:
      ```bash theme={null}
      python ./build_variant.py lemans.adsp.prod --clean
      python ./build_variant.py lemans.cdsp0.prod --clean
      python ./build_variant.py lemans.cdsp1.prod --clean
      python ./build_variant.py lemans.gpdsp0.prod --clean
      python ./build_variant.py lemans.gpdsp1.prod --clean
      ```

    * Build the image:
      ```bash theme={null}
      python ./build_variant.py lemans.adsp.prod && python ./build_variant.py lemans.cdsp0.prod && python ./build_variant.py lemans.cdsp1.prod && python ./build_variant.py lemans.gpdsp0.prod && python ./build_variant.py lemans.gpdsp1.prod
      ```

    **Build Boot**

    **Tools required**

    * Compiler version: LLVM version must be updated to 14.0.4
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/14.0.4/
      ```
    * Python version: Python 3.10
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF.1.0.c1/
      ```

    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```

    * Clean the build:
      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t lemans,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
      ```

    * Build the image:

      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t lemans,QcomToolsPkg -v LAA -r RELEASE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build Qualcomm TEE firmware**

    **Tools required**

    * Compiler version: LLVM 16.0.7
    * Python version: Python 3.10

    **Build steps**

    * Install LLVM:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      vi build_config_deploy_lemans.xml
      # Edit all the occurrences of /pkg/qct/software/llvm/release/arm/16.0.7/ to <firmware-root>/llvm/16.0.7/
      ```

    * Clean the build:
      ```bash theme={null}
      python build_all.py -b TZ.XF.5.0 CHIPSET=lemans --cfg=build_config_deploy_lemans.xml --clean
      ```

    * Build the image:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      python build_all.py -b TZ.XF.5.0 CHIPSET=lemans --cfg=build_config_deploy_lemans.xml
      ```

    **Build AOP firmware**

    **Tools required**

    * Compiler version: LLVM 14.0.4
    * Python version: Python 3.10

    **Build steps**

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/AOP.HO.3.6.1/aop_proc/build/
      ```

    * Clean the build:
      ```bash theme={null}
      ./build_lemansau.sh -c -l <firmware-root>/llvm/14.0.4/
      ```

    * Build the image:
      ```bash theme={null}
      ./build_lemansau.sh -l <firmware-root>/llvm/14.0.4/
      ```

    **CPUCP firmware**

    Qualcomm releases the CPUCP firmware as a binary and you don’t need to compile
    the build.

    **CPUSYS.VM firmware**

    Qualcomm releases the CPUSYS.VM firmware as a binary and you don’t need to
    compile the build.

    **BTFM firmware**

    Qualcomm releases the BTFM firmware as a binary and you don’t need to compile
    the build.

    **WLAN firmware**

    Qualcomm releases the WLAN firmware as a binary and you don’t need to compile
    the build.

    **Generate firmware prebuilts (boot-critical and split-firmware binaries)**

    * Create an integrated firmware binary from the individual components that you
      compiled:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/QCS9100.LE.2.0/common/build
      python build.py --imf
      ```

    * Firmware prebuilt is successful if the following zip files are generated in
      the `<firmware-root>/<distro-clone-directory>/QCS9100.LE.2.0/common/build/ufs/bin`
      directory:
      * `QCS9100_bootbinaries.zip`
      * `QCS9100_dspso.zip`
      * `QCS9100_fw.zip`
  </Tab>

  <Tab title="IQ-8275">
    **Prerequisites**

    * Ensure that the working shell is `bash`:

      ```bash theme={null}
      echo $0
      ```

      The expected output of the command should be `bash`. If not, enter the
      bash shell.

      ```bash theme={null}
      bash
      ```

    * Install the libffi6 package using the following commands. This is required
      for the QAIC compiler, which generates the header and the source files from
      the IDL files.
      ```bash theme={null}
      curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
      sudo dpkg -i libffi6_3.2.1-8_amd64.deb
      ```

    * Install LLVM for AOP, Qualcomm<sup>®</sup> Trusted Execution Environment
      (TEE), and boot compilation:
      ```bash theme={null}
      cd <firmware-root>
      mkdir llvm
      # Sign in to qsc-cli and activate the license
      qsc-cli login
      qsc-cli tool activate-license --name sdllvm_arm
      # LLVM requirement for boot compilation is 14.0.4
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.4 --path <firmware-root>/llvm/14.0.4
      chmod -R 777 <firmware-root>/llvm/14.0.4
      # LLVM requirement for the Qualcomm TEE compilation is 16.0.7
      qsc-cli tool install --name sdllvm_arm --required-version 16.0.7 --path <firmware-root>/llvm/16.0.7
      chmod -R 777 <firmware-root>/llvm/16.0.7
      ```

    * Export the `SECTOOLS` variable and compile the firmware builds
      (`<firmware-root>/<distro-clone-directory>` is the
      top-level directory):
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/QCS8300.LE.2.0/common/sectoolsv2/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/QCS8300.LE.2.0/common/sectoolsv2/ext/Linux
      ```

    * Install and set up Qualcomm<sup>®</sup> Hexagon<sup>™</sup>. Set the environment variable HEXAGON\_ROOT to the
      path where the Hexagon SDK is installed. To change the install path when using
      `qsc-cli`, see [Change the Hexagon tool install path](/Key-Documents/Firmware-Guide/how-to-change-hexagon-install-path).
      ```bash theme={null}
      qsc-cli tool extract --name hexagon8.6 --required-version 8.6.05.2
      qsc-cli tool extract --name hexagon8.7 --required-version 8.7.02.1
      export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```

    **Build DSP**

    **Tools required**

    * Compiler version: Hexagon 8.6.05.2 and 8.7.02.1
    * Python version: Python 3.8.2

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC_PATH=/usr/bin
      ```

    * Install the dependencies:
      ```bash theme={null}
      pip install ruamel.yaml==0.17.17
      pip install dtschema==2021.10
      pip install jsonschema==4.0.0
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/DSP.AT.1.0.1/dsp_proc/build/ms
      ```

    * Clean the build:
      ```bash theme={null}
      python ./build_variant.py lemans.adsp.prod --clean
      python ./build_variant.py monaco.cdsp0.prod --clean
      python ./build_variant.py lemans.gpdsp0.prod --clean
      ```

    * Build the image:
      ```bash theme={null}
      python ./build_variant.py lemans.adsp.prod && python ./build_variant.py monaco.cdsp0.prod && python ./build_variant.py lemans.gpdsp0.prod
      ```

    **Build Boot**

    **Tools required**

    * Compiler version: LLVM version must be updated to 14.0.4
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/14.0.4/
      ```
    * Python version: Python 3.10
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF.1.0.c1/
      ```

    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```

    * Clean the build:
      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t monaco,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
      ```

    * Build the image:

      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t monaco,QcomToolsPkg -v LAA -r RELEASE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build Qualcomm TEE firmware**

    **Tools required**

    * Compiler version: LLVM 16.0.7
    * Python version: Python 3.10

    **Build steps**

    * Install LLVM:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      vi build_config_deploy_monaco.xml
      # Edit all the occurrences of /pkg/qct/software/llvm/release/arm/16.0.7/ to <firmware-root>/llvm/16.0.7/
      ```

    * Clean the build:
      ```bash theme={null}
      python build_all.py -b TZ.XF.5.0 CHIPSET=monaco --cfg=build_config_deploy_monaco.xml --clean
      ```

    * Build the image:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      python build_all.py -b TZ.XF.5.0 CHIPSET=monaco --cfg=build_config_deploy_monaco.xml
      ```

    **Build AOP firmware**

    **Tools required**

    * Compiler version: LLVM 14.0.4
    * Python version: Python 3.10

    **Build steps**

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/AOP.HO.3.6.1/aop_proc/build/
      ```

    * Clean the build:
      ```bash theme={null}
      ./build_monaco.sh -c -l <firmware-root>/llvm/14.0.4/
      ```

    * Build the image:
      ```bash theme={null}
      ./build_monaco.sh -l <firmware-root>/llvm/14.0.4/
      ```

    **CPUCP firmware**

    Qualcomm releases the CPUCP firmware as a binary and you don’t need to compile
    the build.

    **CPUSYS.VM firmware**

    Qualcomm releases the CPUSYS.VM firmware as a binary and you don’t need to
    compile the build.

    **BTFM firmware**

    Qualcomm releases the BTFM firmware as a binary and you don’t need to compile
    the build.

    **WLAN firmware**

    Qualcomm releases the WLAN firmware as a binary and you don’t need to compile
    the build.

    **Generate firmware prebuilts (boot-critical and split-firmware binaries)**

    * Create an integrated firmware binary from the individual components that
      you compiled:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/QCS8300.LE.2.0/common/build
      python build.py --imf
      ```

    * Firmware prebuilt is successful if the following zip files are generated in
      the `<firmware-root>/<distro-clone-directory>/QCS8300.LE.2.0/common/build/ufs/bin`
      directory:
      * `QCS8300_bootbinaries.zip`
      * `QCS8300_dspso.zip`
      * `QCS8300_fw.zip`
  </Tab>

  <Tab title="IQ-615">
    **Prerequisites**

    * Ensure that the working shell is `bash`:

      ```bash theme={null}
      echo $0
      ```

      The expected output of the command should be `bash`. If not, enter the
      bash shell.

      ```bash theme={null}
      bash
      ```

    * Install the libffi6 package using the following commands. This is required
      for the QAIC compiler, which generates the header and the source files from
      the IDL files.
      ```bash theme={null}
      curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
      sudo dpkg -i libffi6_3.2.1-8_amd64.deb
      ```

    * Install Python 2.7.18:
      ```bash theme={null}
      wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
      tar -xvf Python-2.7.18.tgz
      cd Python-2.7.18
      ./configure
      make
      sudo make install
      ```

    * Install LLVM for AOP, Qualcomm<sup>®</sup> Trusted Execution Environment (TEE), and boot compilation:
      ```bash theme={null}
      cd <firmware-root>
      mkdir llvm
      # Sign in to qsc-cli and activate the license
      qsc-cli login
      qsc-cli tool activate-license --name sdllvm_arm
      # LLVM requirement for AOP is 3.9.3
      mkdir -p /pkg/qct/software/llvm
      qsc-cli tool install --name sdllvm_arm --required-version 3.9.3 --path /pkg/qct/software/llvm/release/arm/3.9.3
      chmod -R 777 /pkg/qct/software/llvm/release/arm/3.9.3
      # LLVM requirement for boot compilation is 14.0.4
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.4 --path <firmware-root>/llvm/14.0.4
      chmod -R 777 <firmware-root>/llvm/14.0.4
      # LLVM requirement for Qualcomm TrustZone compilation is 16.0.7
      qsc-cli tool install --name sdllvm_arm --required-version 16.0.7 --path <firmware-root>/llvm/16.0.7
      chmod -R 777 <firmware-root>/llvm/16.0.7
      ```

    * Export the `SECTOOLS` variable and compile the firmware builds
      (`<firmware-root>/<distro-clone-directory>` is the top-level directory):
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/QCS615.LE.2.0/common/sectoolsv2/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/QCS615.LE.2.0/common/sectoolsv2/ext/Linux
      ```

    * Install and set up Qualcomm<sup>®</sup> Hexagon<sup>™</sup>. Set the environment variable `HEXAGON_ROOT`` to the
      path where the Hexagon SDK is installed. To change the install path when using
      `qsc-cli\`, see [Change the Hexagon tool install path](/Key-Documents/Firmware-Guide/how-to-change-hexagon-install-path).
      ```bash theme={null}
      qsc-cli tool extract --name hexagon8.2 --required-version 8.2.05.1
      export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```

    **Build cDSP**

    **Tools required**

    * Compiler version: Hexagon 8.2.05
    * Python version: Python 2.7.18
    * libffi6 package

    **Build steps**

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/CDSP.VT.2.2.c4
      ```

    * Clean the build:
      ```bash theme={null}
      python cdsp_proc/build/build.py -c sm6150 -o clean -f CDSP
      ```

    * Build the image:
      ```bash theme={null}
      python cdsp_proc/build/build.py -c sm6150 -o all -f CDSP
      ```

    **Build aDSP**

    **Tools required**

    * Compiler version: Hexagon 8.2.05
    * Python version: Python 2.7.18
    * libffi6 package

    **Build steps**

    * Nanopb integration (one-time setup):
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.VT.5.2.c6/adsp_proc/ssc_api
      curl https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.5-linux-x86.tar.gz -o nanopb-0.3.9.5-linux-x86.tar.gz
      cd <firmware-root>/<distro-clone-directory>/ADSP.VT.5.2.c6/adsp_proc/
      python ssc_api/build/config_nanopb_dependency.py -f nanopb-0.3.9.5-linux-x86
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.VT.5.2.c6
      ```

    * Clean the build:
      ```bash theme={null}
      python adsp_proc/build/build.py -c sm6150 -o clean -f ADSP
      ```

    * Build the image:
      ```bash theme={null}
      python adsp_proc/build/build.py -c sm6150 -o all -f ADSP
      ```

    **Build AOP**

    **Tools required**

    * Compiler version: LLVM 3.9.3
    * Python version: Python 2.7.18

    **Build steps**

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/AOP.HO.3.6.2/aop_proc/build/
      ```

    * Clean the build:
      ```bash theme={null}
      ./build_TalosAU.sh -c
      ```

    * Build the image:
      ```bash theme={null}
      ./build_TalosAU.sh
      ```

    **Build Boot**

    **Tools required**

    * Compiler version: LLVM version must be updated to 14.0.4
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/14.0.4/
      ```
          <Note>
            To avoid build errors, ensure that there is a / at the end of the command
          </Note>

    * Python version: Python 3.10

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```

    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF.1.0.c1/
      ```

    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```

    * Clean the build:
      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t talos,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
      ```

    * Build the image:

      ```bash theme={null}
      python -u boot_images/boot_tools/buildex.py -t talos,QcomToolsPkg -v LAA -r RELEASE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build TrustZone**

    **Tools required**

    * Compiler version: LLVM 16.0.7
    * Python version: Python 3.10

    **Build steps**

    * Install LLVM:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      vi build_config_deploy_talos.xml
      # Edit all the occurrences of /pkg/qct/software/llvm/release/arm/16.0.7/ to <firmware-root>/llvm/16.0.7/
      ```
    * Clean the build:
      ```bash theme={null}
      python build_all.py -b TZ.XF.5.0 CHIPSET=talos --cfg=build_config_deploy_talos.xml --clean
      ```
    * Build the image:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.29.1/trustzone_images/build/ms/
      python build_all.py -b TZ.XF.5.0 CHIPSET=talos --cfg=build_config_deploy_talos.xml
      ```

    **BTFM firmware**

    Qualcomm releases the BTFM firmware as a binary and you don’t need to compile
    the build.

    **WLAN firmware**

    Qualcomm releases the WLAN firmware as a binary and you don’t need to compile
    the build.

    **Generate firmware prebuilts (boot-critical and split-firmware binaries)**

    * Create an integrated firmware binary from the individual components that
      you compiled:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/QCS615.LE.2.0/common/build
      python build.py --imf
      ```

    * Firmware prebuilt is successful if the following zip files are generated in
      the `<firmware-root>/<distro-clone-directory>/QCS615.LE.2.0/common/build/common/bin`
      directory:
      * `QCS615_bootbinaries.zip`
      * `QCS615_dspso.zip`
      * `QCS615_fw.zip`
  </Tab>

  <Tab title="IQ-X7181">
    **Prerequisites**

    * Ensure that the working shell is `bash`:

      ```bash theme={null}
      echo $0
      ```

      The expected output of the command should be `bash`. If not, enter the
      bash shell.

      ```bash theme={null}
      bash
      ```

    * Install the libffi6 package using the following commands. This is required for
      the QAIC compiler, which generates the header and the source files from the
      IDL files.
      ```bash theme={null}
      curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
      sudo dpkg -i libffi6_3.2.1-8_amd64.deb
      ```

    * Install LLVM for AOP, Qualcomm<sup>®</sup> Trusted Execution Environment
      (TEE), and boot compilation:
      ```bash theme={null}
      cd <firmware-root>
      mkdir llvm

      # Sign in to qsc-cli and activate the license
      qsc-cli login
      qsc-cli tool activate-license --name sdllvm_arm

      # LLVM requirement for aDSP is 14.0.1
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.1 --path <firmware-root>/llvm/14.0.1
      chmod -R 777 <firmware-root>/llvm/14.0.1

      # LLVM requirement for the AOP is 14.0.0
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.0 --path <firmware-root>/llvm/14.0.0
      chmod -R 777 <firmware-root>/llvm/14.0.0

      # LLVM requirement for BOOT compilation is 16.0.2
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.0 --path <firmware-root>/llvm/16.0.2
      chmod -R 777 <firmware-root>/llvm/16.0.2

      # LLVM requirement for BOOT_UEFI and Qualcomm TEE (TZ_XF) compilation is 18.0.1
      qsc-cli tool install --name sdllvm_arm --required-version 18.0.1 --path <firmware-root>/llvm/18.0.1
      chmod -R 777 <firmware-root>/llvm/18.0.1
      ```

    * Export the `SECTOOLS` variable and compile the firmware builds
      (`<firmware-root>/<distro-clone-directory>` is the top-level directory):
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/common/sectoolsv2/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/common/sectoolsv2/ext/Linux
      ```

    * Install and set up Qualcomm<sup>®</sup> Hexagon<sup>™</sup> Processor. Set
      the environment variable HEXAGON\_ROOT to the path where the Hexagon SDK is
      installed. To change the install path when using
      `qsc-cli`, see [Change the Hexagon tool install path](/Key-Documents/Firmware-Guide/how-to-change-hexagon-install-path).
      ```bash theme={null}
      qsc-cli tool extract --name hexagon8.4 --required-version 8.6.06
      export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```

    **Build aDSP**

    **Tools required**

    * Compiler version: Hexagon 8.6.06
    * Python version: Python 3.8.2
    * libffi6 package

    **Build steps**

    * Check Hexagon directory:
      ```bash theme={null}
      export HEXAGON_ROOT=$HOME/QUalcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```
    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Nanopb integration (one-time setup):
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.9/adsp_proc/qsh_api
      curl https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.5-linux-x86.tar.gz -o nanopb-0.3.9.5-linux-x86.tar.gz
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.9/adsp_proc/
      python qsh_api/build/config_nanopb_dependency.py -f nanopb-0.3.9.5-linux-x86
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.9/adsp_proc/build/ms
      ```
    * Clean the build:
      ```bash theme={null}
      python3 ./build_variant.py hamoa.adsp.prod --clean
      ```
    * Build the image:
      ```bash theme={null}
      python3 ./build_variant.py hamoa.adsp.prod
      ```

    **Build cDSP**

    **Tools required**

    * Compiler version: Hexagon 8.6.06
    * Python version: Python 3.8.2
    * libffi6 package

    **Build steps**

    * Check Hexagon directory:
      ```bash theme={null}
      export HEXAGON_ROOT=$HOME/QUalcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```
    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/CDSP.HT.2.9.c1/cdsp_proc/build/ms
      ```
    * Clean the build:
      ```bash theme={null}
      python3 ./build_variant.py hamoa.cdsp.prod --clean
      ```
    * Build the image:
      ```bash theme={null}
      python3 ./build_variant.py hamoa.cdsp.prod
      ```

    **Build Boot**

    **Tools required**

    * Compiler version: LLVM version must be updated to 16.0.2
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/16.0.2/
      ```
    * Python version: Python 3.10.6
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF.2.4.2/
      ```
    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```
    * Clean the build:
      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t Hamoa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE --build_flags=cleanall
      ```
    * Build the image:

      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t Hamoa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build BOOT\_UEFI**

    **Tools required**

    * Compiler version: LLVM version must be updated to 18.0.1
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/18.0.1/
      ```
    * Python version: Python 3.10.6
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF_UEFI.2.5/
      ```
    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```
    * Clean the build:
      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t Hamoa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE --build_flags=cleanall
      ```
    * Build the image:

      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t Hamoa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build Qualcomm TEE firmware**

    **Tools required**

    * Compiler version: LLVM version must be updated to 18.0.1
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/18.0.1/
      ```
    * Python version: Python 3.10

    **Build steps**

    * Export the `SECTOOLS` variable:
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/ext/Linux
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.0/trustzone_images/build/ms
      ```
    * Clean the build:
      ```bash theme={null}
      python3 build_all.py -b TZ.XF.5.0 CHIPSET=hamoa --clean
      ```
    * Build the image:
      ```bash theme={null}
      python3 build_all.py -b TZ.XF.5.0 CHIPSET=hamoa
      ```

    **Build AOP firmware**

    **Tools required**

    * Compiler version: LLVM version must be updated to 14.0.0
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/14.0.0/
      ```
    * Python version: Python 3.10

    **Build steps**

    * Export the `SECTOOLS` variable:
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/ext/Linux
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/AOP.HO.5.2/
      ```
    * Build the image:
      ```bash theme={null}
      ./aop_proc/build/build_hamoa.sh
      ```

    **CPUCP firmware**

    Qualcomm releases the CPUCP firmware as a binary and you don’t need to compile
    the build.

    **BTFM firmware**

    Qualcomm releases the BTFM firmware as a binary and you don’t need to compile
    the build.

    **WLAN firmware**

    Qualcomm releases the WLAN firmware as a binary and you don’t need to compile
    the build.

    **Generate firmware prebuilts (boot-critical and split-firmware binaries)**

    * Create an integrated firmware binary from the individual components that you
      compiled:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/common/build
      python build.py --imf
      ```

    * Firmware prebuilt is successful if the following zip files are generated in
      the `<firmware-root>/<distro-clone-directory>/Hamoa_IOT.LE.2.0/common/build/ufs/bin`
      directory:
      * `HAMOA_bootbinaries.zip`
      * `HAMOA_fw.zip`
  </Tab>

  <Tab title="IQ-X5121">
    **Prerequisites**

    * Ensure that the working shell is `bash`:

      ```bash theme={null}
      echo $0
      ```

      The expected output of the command should be `bash`. If not, enter the
      bash shell.

      ```bash theme={null}
      bash
      ```

    * Install the libffi6 package using the following commands. This is required for
      the QAIC compiler, which generates the header and the source files from the
      IDL files.
      ```bash theme={null}
      curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
      sudo dpkg -i libffi6_3.2.1-8_amd64.deb
      ```

    * Install LLVM for AOP, Qualcomm<sup>®</sup> Trusted Execution Environment
      (TEE), and boot compilation:
      ```bash theme={null}
      cd <firmware-root>
      mkdir llvm

      # Sign in to qsc-cli and activate the license
      qsc-cli login
      qsc-cli tool activate-license --name sdllvm_arm

      # LLVM requirement for aDSP is 14.0.1
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.1 --path <firmware-root>/llvm/14.0.1
      chmod -R 777 <firmware-root>/llvm/14.0.1

      # LLVM requirement for the AOP is 14.0.0
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.0 --path <firmware-root>/llvm/14.0.0
      chmod -R 777 <firmware-root>/llvm/14.0.0

      # LLVM requirement for BOOT compilation is 16.0.2
      qsc-cli tool install --name sdllvm_arm --required-version 14.0.0 --path <firmware-root>/llvm/16.0.2
      chmod -R 777 <firmware-root>/llvm/16.0.2

      # LLVM requirement for BOOT_UEFI and Qualcomm TEE (TZ_XF) compilation is 18.0.1
      qsc-cli tool install --name sdllvm_arm --required-version 18.0.1 --path <firmware-root>/llvm/18.0.1
      chmod -R 777 <firmware-root>/llvm/18.0.1
      ```

    * Export the `SECTOOLS` variable and compile the firmware builds
      (`<firmware-root>/<distro-clone-directory>` is the top-level directory):
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/Purwa_IOT.LE.2.0/common/sectoolsv2/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/Purwa_IOT.LE.2.0/common/sectoolsv2/ext/Linux
      ```

    * Install and set up Qualcomm<sup>®</sup> Hexagon<sup>™</sup> Processor. Set
      the environment variable HEXAGON\_ROOT to the path where the Hexagon SDK is
      installed. To change the install path when using
      `qsc-cli`, see [Change the Hexagon tool install path](/Key-Documents/Firmware-Guide/how-to-change-hexagon-install-path).
      ```bash theme={null}
      qsc-cli tool extract --name hexagon8.4 --required-version 8.6.06
      export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```

    **Build aDSP**

    **Tools required**

    * Compiler version: Hexagon 8.6.06
    * Python version: Python 3.8.2
    * libffi6 package

    **Build steps**

    * Check Hexagon directory:
      ```bash theme={null}
      export HEXAGON_ROOT=$HOME/QUalcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```
    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Nanopb integration (one-time setup):
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.9/adsp_proc/qsh_api
      curl https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.5-linux-x86.tar.gz -o nanopb-0.3.9.5-linux-x86.tar.gz
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.9/adsp_proc/
      python qsh_api/build/config_nanopb_dependency.py -f nanopb-0.3.9.5-linux-x86
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/ADSP.HT.5.9/adsp_proc/build/ms
      ```
    * Clean the build:
      ```bash theme={null}
      python3 ./build_variant.py purwa.adsp.prod --clean
      ```
    * Build the image:
      ```bash theme={null}
      python3 ./build_variant.py purwa.adsp.prod
      ```

    **Build cDSP**

    **Tools required**

    * Compiler version: Hexagon 8.6.06
    * Python version: Python 3.8.2
    * libffi6 package

    **Build steps**

    * Check Hexagon directory:
      ```bash theme={null}
      export HEXAGON_ROOT=$HOME/QUalcomm/HEXAGON_Tools
      echo $HEXAGON_ROOT
      ```
    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/CDSP.HT.2.9.c1/cdsp_proc/build/ms
      ```
    * Clean the build:
      ```bash theme={null}
      python3 ./build_variant.py purwa.cdsp.prod --clean
      ```
    * Build the image:
      ```bash theme={null}
      python3 ./build_variant.py purwa.cdsp.prod
      ```

    **Build Boot**

    **Tools required**

    * Compiler version: LLVM version must be updated to 16.0.2
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/16.0.2/
      ```
    * Python version: Python 3.10.6
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF.2.4.2/
      ```
    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```
    * Clean the build:
      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t purwa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE --build_flags=cleanall
      ```
    * Build the image:

      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t purwa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build BOOT\_UEFI**

    **Tools required**

    * Compiler version: LLVM version must be updated to 18.0.1
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/18.0.1/
      ```
    * Python version: Python 3.10.6
    * libffi6 package

    **Build steps**

    * Install the device tree compiler:
      ```bash theme={null}
      sudo apt-get install device-tree-compiler
      export DTC=/usr/bin
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/BOOT.MXF_UEFI.2.5/
      ```
    * Install the dependencies:
      ```bash theme={null}
      python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
      pip install json-schema-for-humans
      ```
    * Clean the build:
      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t Purwa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE --build_flags=cleanall
      ```
    * Build the image:

      ```bash theme={null}
      python3 boot_images/boot_tools/buildex.py -t Purwa,QcomToolsPkg,QcomTestPkg -r RELEASE -v LE
      ```

          <Note>
            For debug variant builds, replace `RELEASE` with `DEBUG`.
          </Note>

    **Build Qualcomm TEE firmware**

    **Tools required**

    * Compiler version: LLVM version must be updated to 18.0.1
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/18.0.1/
      ```
    * Python version: Python 3.10

    **Build steps**

    * Export the `SECTOOLS` variable:
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/Purwa.LE.2.0/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/Purwa.LE.2.0/ext/Linux
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/TZ.XF.5.0/trustzone_images/build/ms
      ```
    * Clean the build:
      ```bash theme={null}
      python3 build_all.py -b TZ.XF.5.0 CHIPSET=purwa --clean
      ```
    * Build the image:
      ```bash theme={null}
      python3 build_all.py -b TZ.XF.5.0 CHIPSET=purwa
      ```

    **Build AOP firmware**

    **Tools required**

    * Compiler version: LLVM version must be updated to 14.0.0
      ```bash theme={null}
      export LLVM=<firmware-root>/llvm/14.0.0/
      ```
    * Python version: Python 3.10

    **Build steps**

    * Export the `SECTOOLS` variable:
      ```bash theme={null}
      export SECTOOLS=<firmware-root>/<distro-clone-directory>/Purwa.LE.2.0/ext/Linux/sectools
      export SECTOOLS_DIR=<firmware-root>/<distro-clone-directory>/Purwa.LE.2.0/ext/Linux
      ```
    * Go to the following directory:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/AOP.HO.5.2/
      ```
    * Build the image:
      ```bash theme={null}
      ./aop_proc/build/build_purwa.sh
      ```

    **CPUCP firmware**

    Qualcomm releases the CPUCP firmware as a binary and you don’t need to compile
    the build.

    **BTFM firmware**

    Qualcomm releases the BTFM firmware as a binary and you don’t need to compile
    the build.

    **WLAN firmware**

    Qualcomm releases the WLAN firmware as a binary and you don’t need to compile
    the build.

    **Generate firmware prebuilts (boot-critical and split-firmware binaries)**

    * Create an integrated firmware binary from the individual components that you
      compiled:
      ```bash theme={null}
      cd <firmware-root>/<distro-clone-directory>/Purwa.LE.2.0/common/build
      python build.py --imf
      ```

    * Firmware prebuilt is successful if the following zip files are generated in
      the `<firmware-root>/<distro-clone-directory>/Purwa.LE.2.0/common/build/ufs/bin`
      directory:
      * `HAMOA_bootbinaries.zip`
      * `HAMOA_fw.zip`
  </Tab>
</Tabs>

## Build BSP image

This section describes how to integrate firmware binaries and other source
components into a full BSP image build. The BSP image build combines the
compiled firmware outputs from the previous step with the Yocto layer stack,
producing a flashable image that includes all required binaries.

<Note>
  IQ-X7181 and IQ-X5121 aren't supported by the meta-qcom-extras layer yet; to
  load custom firmware binaries on these boards, use `devtool` to modify the
  upstream recipes instead.
</Note>

<Tabs>
  <Tab title="IQ-X7181">
    * Download Qualcomm's Yocto layer `meta-qcom-extras`. For the latest
      `<meta-qcom-extras-release-tag>`, see [Configuration Parameters](#configuration-parameters).

      ```bash theme={null}
      git clone https://qpm-git.qualcomm.com/home2/git/component-revision-history/qualcomm-linux/meta-qcom-extras.git -b <meta-qcom-extras-release-tag> --depth 1
      ```

    **Layer Setup**

    * Set your Qualcomm Customer ID. To find it, sign in at qualcomm.com,
      click the Profile icon, select **Account Settings**, and scroll to the
      **Company Information** section.
      ```bash theme={null}
      export CUST_ID="<CUST_ID>"
      ```

    * Set the outbound license for the layer and its checksum. `CUST_LICENSE`
      and `CUST_LIC_CHKSUM` are required for every recipe in the layer.
      ```bash theme={null}
      export CUST_LICENSE="<CUST_LICENSE>"
      export CUST_LIC_CHKSUM="<CUST_LIC_CHKSUM>"
      ```

    * Export `NETRC_FILE` parameter to ensure `~/.netrc` credentials are visible
      in the `kas` environment:
      ```bash theme={null}
      export NETRC_FILE=~/.netrc
      ```

    * Update the license file in the source repositories. By default, all sources
      used by `meta-qcom-extras` contain a placeholder LICENSE file. Replace it
      with your outbound license in each source before building. The recipes verify
      `CUST_LICENSE` against this file at build time.

    **Firmware Setup**

    * Set `FWZIP_PATH` to the directory containing the firmware ZIP files to
      include locally compiled firmware zip paths in the build.
      ```bash theme={null}
      export FWZIP_PATH="<FWZIP_PATH>"
      ```

    * **Override Linux-firmware Binaries**

      If you want to modify the Linux firmware binaries, use this section to
      substitute them into the build.

      * Create a kas configuration file at `meta-qcom-extras/ci/firmware.yml` with the
        following content:

        ```bash theme={null}
        cat << EOF > meta-qcom-extras/ci/firmware.yml
        header:
         version: 14

        local_conf_header:
         firmware-build: |
           SRCREV:pn-linux-firmware = "dc85ccedc9c973682fbcf4d628ca61174bcc3120"
        EOF
        ```

      * Then modify the linux-firmware recipe using `devtool`:

        ```bash theme={null}
        kas shell -c "devtool modify linux-firmware" meta-qcom-extras/ci/iq-x7181-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml:meta-qcom-extras/ci/firmware.yml
        ```

      * Unzip the firmware archive:

        ```bash theme={null}
        unzip $FWZIP_PATH/HAMOA_fw.zip -d $FWZIP_PATH
        ```

      * Copy the contents of the firmware zip file into the devtool workspace

        ```bash theme={null}
        cp $FWZIP_PATH/HAMOA_fw/lib/firmware/qcom/x1e80100/*.{mbn,jsn} build/workspace/sources/linux-firmware/qcom/x1e80100/
        ```

            <Note>
              When you override the firmwares in `linux-firmware`, you must also override
              the Hexagon DSP binaries.
            </Note>

    * **Override DSPSO Binaries**

      If you want to modify the Hexagon DSP shared-object binaries, use this section
      to substitute the ADSP and CDSP binaries into the build.

      * Initialize a devtool workspace for `hexagon-dsp-binaries`:

        ```bash theme={null}
        kas shell -c "devtool modify hexagon-dsp-binaries" meta-qcom-extras/ci/iq-x7181-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
        ```

      * Unzip the firmware archive:

        ```bash theme={null}
        unzip $FWZIP_PATH/HAMOA_fw.zip -d $FWZIP_PATH
        ```

      * Copy the ADSP binaries into the devtool workspace:

        ```bash theme={null}
        cp -r $FWZIP_PATH/HAMOA_fw/usr/share/qcom/x1e80100/Qualcomm/X1E80100/dsp/adsp/* build/workspace/sources/hexagon-dsp-binaries/x1e80100/Qualcomm/Hamoa-IoT-EVK/ADSP.HT.5.9-00839-HAMOA-1/
        ```

      * Copy the CDSP binaries into the devtool workspace:

        ```bash theme={null}
        cp -r $FWZIP_PATH/HAMOA_fw/usr/share/qcom/x1e80100/Qualcomm/X1E80100/dsp/cdsp/* build/workspace/sources/hexagon-dsp-binaries/x1e80100/Qualcomm/Hamoa-IoT-EVK/CDSP.HT.2.9.c1-00069-HAMOA-1/
        ```

    * **Override Boot Firmware Binaries**

      If you want to modify the boot-critical firmware binaries, use this section
      to substitute them into the build.

      * Initialize a devtool workspace for the boot firmware recipe:

        ```bash theme={null}
        kas shell -c "devtool modify firmware-qcom-boot-iq-x7181" meta-qcom-extras/ci/iq-x7181-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
        ```

      * Unzip the boot binaries archive:

        ```bash theme={null}
        unzip $FWZIP_PATH/HAMOA_bootbinaries.zip -d $FWZIP_PATH
        ```

      * Copy boot binaries into the devtool workspace:

        ```bash theme={null}
        cp -r $FWZIP_PATH/HAMOA_bootbinaries/* build/workspace/sources/firmware-qcom-boot-iq-x7181
        ```

        Then append the required configuration to the `.bbappend` file:

        ```bash theme={null}
        echo 'ALLOW_EMPTY:${PN} = "1"' >> build/workspace/appends/firmware-qcom-boot-iq-x7181_00012.bbappend
        ```

    Once all override steps are complete, the subsequent Yocto image build will
    automatically use the locally provided firmware binaries rather than upstream sources.

    **Build Image**

    * Run the setup script to apply these parameters to the build environment.

      ```bash theme={null}
      meta-qcom-extras/setup_extras_config.sh
      ```

    * Build the software image using `kas`. You define build targets based
      on machine and distro combinations.

      ```bash theme={null}
      kas shell -c "devtool build-image qcom-multimedia-proprietary-image" meta-qcom-extras/ci/iq-x7181-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
      ```
  </Tab>

  <Tab title="IQ-X5121">
    * Download Qualcomm's Yocto layer `meta-qcom-extras`. For the latest
      `<meta-qcom-extras-release-tag>`, see [Configuration Parameters](#configuration-parameters).

      ```bash theme={null}
      git clone https://qpm-git.qualcomm.com/home2/git/component-revision-history/qualcomm-linux/meta-qcom-extras.git -b <meta-qcom-extras-release-tag> --depth 1
      ```

    **Layer Setup**

    * Set your Qualcomm Customer ID. To find it, sign in at qualcomm.com,
      click the Profile icon, select **Account Settings**, and scroll to the
      **Company Information** section.
      ```bash theme={null}
      export CUST_ID="<CUST_ID>"
      ```

    * Set the outbound license for the layer and its checksum. `CUST_LICENSE`
      and `CUST_LIC_CHKSUM` are required for every recipe in the layer.
      ```bash theme={null}
      export CUST_LICENSE="<CUST_LICENSE>"
      export CUST_LIC_CHKSUM="<CUST_LIC_CHKSUM>"
      ```

    * Export `NETRC_FILE` parameter to ensure `~/.netrc` credentials are visible
      in the `kas` environment:
      ```bash theme={null}
      export NETRC_FILE=~/.netrc
      ```

    * Update the license file in the source repositories. By default, all sources
      used by `meta-qcom-extras` contain a placeholder LICENSE file. Replace it
      with your outbound license in each source before building. The recipes verify
      `CUST_LICENSE` against this file at build time.

    **Firmware Setup**

    * Set `FWZIP_PATH` to the directory containing the firmware ZIP files to
      include locally compiled firmware zip paths in the build.
      ```bash theme={null}
      export FWZIP_PATH="<FWZIP_PATH>"
      ```

    * **Override Linux-firmware Binaries**

      If you want to modify the Linux firmware binaries, use this section to
      substitute them into the build.

      * Create a kas configuration file at `meta-qcom-extras/ci/firmware.yml` with the
        following content:

        ```bash theme={null}
        cat << EOF > meta-qcom-extras/ci/firmware.yml
        header:
         version: 14

        local_conf_header:
         firmware-build: |
           SRCREV:pn-linux-firmware = "dc85ccedc9c973682fbcf4d628ca61174bcc3120"
        EOF
        ```

      * Then modify the linux-firmware recipe using `devtool`:

        ```bash theme={null}
        kas shell -c "devtool modify linux-firmware" meta-qcom-extras/ci/iq-x5121-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml:meta-qcom-extras/ci/firmware.yml
        ```

      * Unzip the firmware archive:

        ```bash theme={null}
        unzip $FWZIP_PATH/HAMOA_fw.zip -d $FWZIP_PATH
        ```

      * Copy the contents of the firmware zip file into the devtool workspace

        ```bash theme={null}
        cp $FWZIP_PATH/HAMOA_fw/lib/firmware/qcom/x1e80100/*.{mbn,jsn} build/workspace/sources/linux-firmware/qcom/x1e80100/
        ```

            <Note>
              When you override the firmwares in `linux-firmware`, you must also override
              the Hexagon DSP binaries.
            </Note>

    * **Override DSPSO Binaries**

      If you want to modify the Hexagon DSP shared-object binaries, use this section
      to substitute the ADSP and CDSP binaries into the build.

      * Initialize a devtool workspace for `hexagon-dsp-binaries`:

        ```bash theme={null}
        kas shell -c "devtool modify hexagon-dsp-binaries" meta-qcom-extras/ci/iq-x5121-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
        ```

      * Unzip the firmware archive:

        ```bash theme={null}
        unzip $FWZIP_PATH/HAMOA_fw.zip -d $FWZIP_PATH
        ```

      * Copy the ADSP binaries into the devtool workspace:

        ```bash theme={null}
        cp -r $FWZIP_PATH/HAMOA_fw/usr/share/qcom/x1e80100/Qualcomm/X1E80100/dsp/adsp/* build/workspace/sources/hexagon-dsp-binaries/x1e80100/Qualcomm/Hamoa-IoT-EVK/ADSP.HT.5.9-00839-HAMOA-1/
        ```

      * Copy the CDSP binaries into the devtool workspace:

        ```bash theme={null}
        cp -r $FWZIP_PATH/HAMOA_fw/usr/share/qcom/x1e80100/Qualcomm/X1E80100/dsp/cdsp/* build/workspace/sources/hexagon-dsp-binaries/x1e80100/Qualcomm/Hamoa-IoT-EVK/CDSP.HT.2.9.c1-00069-HAMOA-1/
        ```

    * **Override Boot Firmware Binaries**

      If you want to modify the boot-critical firmware binaries, use this section
      to substitute them into the build.

      * Initialize a devtool workspace for the boot firmware recipe:

        ```bash theme={null}
        kas shell -c "devtool modify firmware-qcom-boot-iq-x7181" meta-qcom-extras/ci/iq-x5121-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
        ```

      * Unzip the boot binaries archive:

        ```bash theme={null}
        unzip $FWZIP_PATH/HAMOA_bootbinaries.zip -d $FWZIP_PATH
        ```

      * Copy boot binaries into the devtool workspace:

        ```bash theme={null}
        cp -r $FWZIP_PATH/HAMOA_bootbinaries/* build/workspace/sources/firmware-qcom-boot-iq-x7181
        ```

        Then append the required configuration to the `.bbappend` file:

        ```bash theme={null}
        echo 'ALLOW_EMPTY:${PN} = "1"' >> build/workspace/appends/firmware-qcom-boot-iq-x7181_00012.bbappend
        ```

    Once all override steps are complete, the subsequent Yocto image build will
    automatically use the locally provided firmware binaries rather than upstream sources.

    **Build Image**

    * Run the setup script to apply these parameters to the build environment.

      ```bash theme={null}
      meta-qcom-extras/setup_extras_config.sh
      ```

    * Build the software image using `kas`. You define build targets based
      on machine and distro combinations.

      ```bash theme={null}
      kas shell -c "devtool build-image qcom-multimedia-proprietary-image" meta-qcom-extras/ci/iq-x5121-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
      ```
  </Tab>

  <Tab title="Other Kits">
    * Download Qualcomm's Yocto layer `meta-qcom-extras`. For the latest
      `<meta-qcom-extras-release-tag>`, see [Configuration Parameters](#configuration-parameters).

      ```bash theme={null}
      git clone https://qpm-git.qualcomm.com/home2/git/component-revision-history/qualcomm-linux/meta-qcom-extras.git -b <meta-qcom-extras-release-tag> --depth 1
      ```

    **Layer Setup**

    * Set your Qualcomm Customer ID. To find it, sign in at qualcomm.com,
      click the Profile icon, select **Account Settings**, and scroll to the
      **Company Information** section.
      ```bash theme={null}
      export CUST_ID="<CUST_ID>"
      ```

    * Set the outbound license for the layer and its checksum. `CUST_LICENSE`
      and `CUST_LIC_CHKSUM` are required for every recipe in the layer.
      ```bash theme={null}
      export CUST_LICENSE="<CUST_LICENSE>"
      export CUST_LIC_CHKSUM="<CUST_LIC_CHKSUM>"
      ```

    * Export `NETRC_FILE` parameter to ensure `~/.netrc` credentials are visible
      in the `kas` environment:
      ```bash theme={null}
      export NETRC_FILE=~/.netrc
      ```

    * Update the license file in the source repositories. By default, all sources
      used by `meta-qcom-extras` contain a placeholder LICENSE file. Replace it
      with your outbound license in each source before building. The recipes verify
      `CUST_LICENSE` against this file at build time.

    **Firmware Setup**

    * Set `FWZIP_PATH` to the directory containing the firmware ZIP files to
      include locally compiled firmware zip paths in the build.
      ```bash theme={null}
      export FWZIP_PATH="<FWZIP_PATH>"
      ```

    * Set the modem-specific license and its checksum. `CUST_MDM_LICENSE` and
      `CUST_MDM_LIC_CHKSUM` are required only when building modem firmware.
      ```bash theme={null}
      export CUST_MDM_LICENSE="<CUST_MDM_LICENSE>"
      export CUST_MDM_LIC_CHKSUM="<CUST_MDM_LIC_CHKSUM>"
      ```

    * `firmware-qcom-selective.inc` applies these rules at parse time:

      * If `FWZIP_PATH` or `FWZIP_NAME` are unset, the recipe is silently skipped.
      * If both are set but the ZIP file is missing, the build fails with a fatal error.
      * If no `PREFERRED_RPROVIDER` points to the recipe, the recipe is silently skipped.

    * Edit `meta-qcom-extras/ci/providers.yml` to add the needed `FWZIP_NAME`
      assignments to enable the recipe during image compilation.

          <CodeGroup>
            ```yaml IQ-9075 theme={null}
            firmware-qcs9100: |
              FWZIP_NAME:pn-firmware-qcs9100 = "QCS9100_dsp"
            firmware-qcs9100-bootbins: |
              FWZIP_NAME:pn-firmware-qcs9100-bootbins = "QCS9100_bootbinaries"
            ```

            ```yaml IQ-8275 theme={null}
            firmware-qcs8300: |
              FWZIP_NAME:pn-firmware-qcs8300 = "QCS8300_dsp"
            firmware-qcs8300-bootbins: |
              FWZIP_NAME:pn-firmware-qcs8300-bootbins = "QCS8300_bootbinaries"
            ```

            ```yaml QCS6490 theme={null}
            firmware-qcs6490-adsp: |
              FWZIP_NAME:pn-firmware-qcs6490-adsp = "QCM6490_adsp"
            firmware-qcs6490-cdsp: |
              FWZIP_NAME:pn-firmware-qcs6490-cdsp = "QCM6490_cdsp"
            firmware-qcs6490-modem: |
              FWZIP_NAME:pn-firmware-qcs6490-modem = "QCM6490_modem"
            firmware-qcs6490-bootbins: |
              FWZIP_NAME:pn-firmware-qcs6490-bootbins = "QCM6490_bootbinaries"
            ```

            ```yaml IQ-615-EVK theme={null}
            firmware-qcs615-adsp: |
              FWZIP_NAME:pn-firmware-qcs615-adsp = "QCS615_adsp"
            firmware-qcs615-cdsp: |
              FWZIP_NAME:pn-firmware-qcs615-cdsp = "QCS615_cdsp"
            firmware-qcs615-bootbins: |
              FWZIP_NAME:pn-firmware-qcs615-bootbins = "QCS615_bootbinaries"
            ```
          </CodeGroup>

    * Update the license file in the firmware ZIPs. By default, all ZIPs
      used by `meta-qcom-extras` contain a placeholder LICENSE file. Replace it
      with your outbound license in each ZIP before building. The recipes verify
      `CUST_LICENSE` against this file at build time.

    **Build Image**

    * Run the setup script to apply these parameters to the build environment.

      ```bash theme={null}
      meta-qcom-extras/setup_extras_config.sh
      ```

    * Build the software image using `kas`. You define build targets based
      on machine and distro combinations.

          <CodeGroup>
            ```bash IQ-9075-EVK theme={null}
            kas build meta-qcom-extras/ci/iq-9075-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
            ```

            ```bash IQ-8275-EVK theme={null}
            kas build meta-qcom-extras/ci/iq-8275-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
            ```

            ```bash IQ-615-EVK theme={null}
            kas build meta-qcom-extras/ci/iq-615-evk.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
            ```

            ```bash QCS6490 theme={null}
            kas build meta-qcom-extras/ci/rb3gen2-core-kit.yml:meta-qcom-extras/ci/qcom-distro.yml:meta-qcom-extras/ci/performance.yml
            ```
          </CodeGroup>
  </Tab>
</Tabs>

## Related topics

* [How to change default installation path for Hexagon?](./how-to-change-hexagon-install-path)
