# 使用固件和附加组件的 GitHub 编译

使用此信息编译各种 Qualcomm Linux Yocto 层，包括使用您选择的专有源代码和二进制文件/库来编译 `meta-qcom-hwe`，`meta-qcom-extras`、`meta-qcom-qim-product-sdk` 和 `meta-qcom-robotics-sdk`。

Note

此信息仅适用于授权用户。要升级您的访问权限，请访问 [Qualcomm 支持页面](https://www.qualcomm.com/support/working-with-qualcomm)。

## 主机要求

- 配置

    - x86 计算机
    - 至少四核 CPU，例如 Intel i7-2600 @ 3.4 GHz（同等或更高配置）
    - 300 GB 可用磁盘空间（swap 分区 &gt; 32 GB）
    - 16 GB RAM
    - Ubuntu 22.04
- 工具

    - Git 1.8.3.1 或更高版本
    - Tar 1.28 或更高版本
    - Python 3.10.2 或更高版本
    - GCC 8.0 或更高版本
    - GNU Make 4.0 或更高版本
- 权限

    - 运行一些命令需要 `sudo` 权限

Note

在虚拟机上编译代码是一个缓慢的过程，可能需要几个小时。Qualcomm 建议使用 Ubuntu 主机进行编译。要在 Microsoft^®^ Windows^®^ 或 Apple^®^ macOS^®^ 上搭建运行 Ubuntu 22.04 的虚拟机 (VM)，请参阅 [Qualcomm Linux 虚拟机搭建指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-41/)。

## 安装 QSC CLI

要注册您的 Qualcomm 电子邮件 ID，请访问 [Qualcomm 支持页面](https://www.qualcomm.com/support/working-with-qualcomm)。

1. 安装 curl（如果尚未安装）：

sudo apt install curl
        Copy to clipboard
2. 下载 `qsc-cli` 的 Debian 软件包：

cd <workspace_path>
        # For x86
        curl -L https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Software_Center/Linux/Debian/latest.deb -o qsc_installer.deb
        # For ARM64
        curl -L https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Software_Center/Linux/ARM64/Debian/latest.deb -o qsc_installer.deb
        Copy to clipboard
3. 安装 `qsc-cli` 的 Debian 软件包：

sudo apt update
        sudo apt install ./qsc_installer.deb
        Copy to clipboard
4. 使用您注册的电子邮件 ID 登录 `qsc-cli`：

qsc-cli login -u <username>
        Copy to clipboard

有关 `qsc-cli` 的更多信息，请参阅[如何同步](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#howto-sync)。

## 设置 Ubuntu 主机

在 Ubuntu 主机上安装并配置软件工具。

1. 安装以下软件包：

sudo apt update
        sudo apt install repo gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool locales tar python-is-python3 file libxml-opml-simplegen-perl vim whiptail g++ libacl1
        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
        Copy to clipboard
2. 将带有 PAT 的 Qualcomm 登录 ID 添加到主目录中的 `~/.netrc` 文件：

# Log in to qsc-cli to generate PAT
        qsc-cli login -u <username>
        # Run the following command to generate PAT
        qsc-cli show-access-token
        # This command gives output as shown in the following note
        # The last line in this output is the token, which can be used to access
        # Qualcomm Proprietary repositories. This token expires in two weeks.
        Copy to clipboard

Note

user@hostname:/local/mnt/workspace$ qsc-cli show-access-token

[Info]: Starting qsc-cli version 0.0.0.9

**5LThNlklb55mMVLB5C2KqUGU2jCF**
3. 使用您喜欢的文本编辑器编辑 `~/.netrc` 文件并添加以下条目。如果 `~/.netrc` 文件不存在，请创建该文件。

machine chipmaster2.qti.qualcomm.com
        login <your Qualcomm login id>
        password <your PAT token>
        
        machine qpm-git.qualcomm.com
        login <your Qualcomm login id>
        password <your PAT token>
        Copy to clipboard
4. 设置语言区域（如果尚未设置）：

sudo locale-gen en_US.UTF-8
        sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
        export LC_ALL=en_US.UTF-8
        export LANG=en_US.UTF-8
        Copy to clipboard
5. 更新 git 配置：

# Check if your identity is configured in .gitconfig
        git config --get user.email
        git config --get user.name
        
        # Run the following commands if you don't have your account identity set in .gitconfig
        git config --global user.email <Your email ID>
        git config --global user.name <"Your Name">
        
        # Add the following UI color option for output of console (optional)
        git config --global color.ui auto
        
        # 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
        Copy to clipboard
6. 安装 Python 3.10.2：

Note

如果您已有 Python 3.10.2 或更高版本，请跳过以下说明。

python --version
        # Download it in a directory of your choice
        wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz
        tar -xvf Python-3.10.2.tgz
        cd Python-3.10.2
        # Use sudo if you need to access /opt
        ./configure --prefix=/opt/python3 --enable-optimizations
        make
        make install
        ln -s /opt/python3/bin/python3  /opt/python3/bin/python
        export PATH=/opt/python3/bin:$PATH
        export PYTHONPATH=/opt/python3/lib:$PYTHONPATH
        Copy to clipboard

## 使用固件源代码编译

### 同步固件

以下部分中的命令基于不带 modem 和 GPS 的固件镜像的二进制文件和源文件（请参阅[固件发行版对应的 git 代码仓库](https://docs.qualcomm.com/doc/80-70022-254Y/topic/build_addn_info.html#mapping-firmware-table)中的命令）。因此，`qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk` 被使用。如果使用的是任何其他发行版本，可相应地更新该目录。

下表介绍了 Qualcomm Yocto 层和发布标签：

| 访问级别 | Yocto 层 | 发布标记 | 示例 |
| --- | --- | --- | --- |
| 公共版本开发者（未注册） | `meta-qcom-hwe` | manifest 发布标记 | qcom-6.6.97-QLI.1.6-Ver.1.2.xml |
| 公共版本开发者（未注册） | `meta-qcom-qim-product-sdk` | manifest 发布标记 | qcom-6.6.97-QLI.1.6-Ver.1.2\_qim-product-sdk-2.1.1.xml |
| 公共版本开发者（未注册） | `meta-qcom-robotics-sdk` | manifest 发布标记 | qcom-6.6.97-QLI.1.6-Ver.1.2\_robotics-sdk-1.2.xml |
| 具有授权访问权限的许可开发者 | `meta-qcom-extras` | meta-qcom-extras 发布标记 | r1.0\_00107.0 |
| 请参阅[固件分发包对应的访问级别](https://docs.qualcomm.com/doc/80-70022-254Y/topic/build_addn_info.html#build-mapping-access-levels) | 不适用 | 固件发布标记 | r1.0\_00106.0 |
|  |  |  |  |
|  |  |  |  |

下表介绍了您可以下载的固件分发包。有关 Yocto 层的更多信息，请参阅 [Qualcomm Linux 元数据层](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-27/qualcomm_linux_metadata_layers.html)。

| **访问级别** | **发行版** | Yocto 层 |
| --- | --- | --- |
| 具有授权访问权限的许可开发者 | BSP build：高层操作系统和固件源（仅限 GPS）<br><br><br>`Qualcomm_Linux.SPF.1.0|AP|Standard|OEM|NoModem` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras` |
| 具有授权访问权限的许可开发者 | BSP build + Qualcomm IM SDK<br><br><br><br>> <br>> <br>> `Qualcomm_Linux.SPF.1.0|AP|Standard|OEM|NM_QIMPSDK` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras`<br><br><br>`meta-qcom-qim-product-sdk` |
| 具有授权访问权限的许可开发者 | BSP build + Qualcomm IM SDK + QIR SDK<br><br><br><br>> <br>> <br>> `Qualcomm_Linux.SPF.1.0|AP|Standard|OEM|NM_QIRPSDK` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras`<br><br><br>`meta-qcom-robotics-extras`<br><br><br>`meta-ros`<br><br><br>`meta-qcom-robotics`<br><br><br>`meta-qcom-robotics-distro`<br><br><br>`meta-qcom-robotics-sdk`<br><br><br>`meta-qcom-qim-product-sdk` |
| 授权开发者（联系 Qualcomm 获取访问权限） | BSP build：高层操作系统和固件（仅限 GPS）源<br><br><br>`Qualcomm_Linux.SPF.1.0|AP|Standard|OEM|` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras` |
| 授权开发者（联系 Qualcomm 获取访问权限） | BSP build + Qualcomm IM SDK（仅 GPS）<br><br><br><br>> <br>> <br>> `Qualcomm_Linux.SPF.1.0|AP|Standard|OEM|QIMPSDK` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras`<br><br><br>`meta-qcom-robotics-extras`<br><br><br>`meta-qcom-qim-product-sdk` |
| 授权开发者（联系 Qualcomm 获取访问权限） | BSP build：高层操作系统和固件（GPS 和调制解调器）源<br><br><br><br>> <br>> <br>> `Qualcomm_Linux.SPF.1.0|AMSS|Standard|OEM|` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras` |
| 授权开发者（联系 Qualcomm 获取访问权限） | BSP build + Qualcomm IM SDK（GPS 和 modem）<br><br><br><br>> <br>> <br>> `Qualcomm_Linux.SPF.1.0|AMSS|Standard|OEM|QIMPSDK` | `meta-qcom`<br><br><br>`meta-qcom-hwe`<br><br><br>`meta-qcom-distro`<br><br><br>`meta-qcom-extras`<br><br><br>`meta-qcom-qim-product-sdk` |
|  |  |  |
|  |  |  |
|  |  |  |

下表将固件分发包映射到 git 代码仓库：

将固件分发包映射到 git 代码仓库

| 固件发行版本 | Git 命令 | 在 git clone 上同步固件的目录 |
| --- | --- | --- |
| Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM|NoModem | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem.git` | `qualcomm-linux-spf-1-0_ap_standard_oem_nomodem` |
| Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM|NM\_QIMPSDK | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk.git` | `qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk` |
| Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM|NM\_QIRPSDK | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk.git` | `qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk` |
| Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM| | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem.git` | `qualcomm-linux-spf-1-0_ap_standard_oem` |
| Qualcomm\_Linux.SPF.1.0|AP|Standard|OEM|QIMPSDK | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_qimpsdk.git` | `qualcomm-linux-spf-1-0_ap_standard_oem_qimpsdk` |
| Qualcomm\_Linux.SPF.1.0|AMSS|Standard|OEM| | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_amss_standard_oem.git` | `qualcomm-linux-spf-1-0_amss_standard_oem` |
| Qualcomm\_Linux.SPF.1.0|AMSS|Standard|OEM|QIMPSDK | `git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk.git` | `qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk` |

**Git 命令**列（[将固件分发包映射到 git 代码仓库](https://docs.qualcomm.com/doc/80-70022-254Y/topic/build_addn_info.html#mapping-firmware-table)表）提供了有关包含固件源的 git 代码仓库的信息。Qualcomm 服务器托管这些代码仓库。根据您的访问 profile 和用例克隆正确的代码仓库。

以下 `git clone` 命令将选定的固件组件下载到源文件中，modem 除外：

mkdir -p <FIRMWARE_ROOT>
    cd <FIRMWARE_ROOT>
    git clone -b <firmware release tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk.git
    # Example, <firmware release tag> is r1.0_00106.0
    Copy to clipboard

该 `git clone` 命令将内容克隆到目录中 `<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk`。有关最新 `<firmware release tag>` 的信息，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)中的 *Build-critical release tags* 章节。

### 编译固件

Tab QCS6490/QCS5430
Tab IQ-9075
Tab IQ-8275

前提条件

- 确保工作 shell 为 `bash`。

echo $0
        Copy to clipboard

    该命令的预期输出应为 `bash`。如果不是，则输入 bash shell：

bash
        Copy to clipboard
- 使用以下命令安装 libffi6 软件包。这是 QAIC 编译器所必需的，它从 IDL 文件生成标头文件和源文件：

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
        Copy to clipboard
- 为 AOP、 Qualcomm^®^ 可信执行环境（TEE）和启动编译安装 LLVM：

cd <FIRMWARE_ROOT>
        mkdir llvm
        
        # Log 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
        Copy to clipboard
- 导出 `SECTOOLS` 变量并编译固件（`<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk` 是顶层目录）：

export SECTOOLS=<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCM6490.LE.1.0/common/sectoolsv2/ext/Linux/sectools
        export SECTOOLS_DIR=<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCM6490.LE.1.0/common/sectoolsv2/ext/Linux
        Copy to clipboard
- 安装并设置 Qualcomm^®^ Hexagon^™^ 处理器。将环境变量 HEXAGON\_ROOT 设置为 Hexagon SDK 的安装路径。要在使用 `qsc-cli` 时更改安装路径，请参阅[更改 Hexagon 工具安装路径](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#change-hex-tool-install-path)。

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
        Copy to clipboard

编译 cDSP

**所需工具**

- 编译器版本：Hexagon 8.4.07
- Python 版本：Python 3.10.2
- libffi6 软件包

**编译步骤**

1. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/CDSP.HT.2.5.c3/cdsp_proc/build/ms
        Copy to clipboard
2. 清理编译：

python ./build_variant.py kodiak.cdsp.prod --clean
        Copy to clipboard
3. 编译镜像：

python ./build_variant.py kodiak.cdsp.prod
        Copy to clipboard

编译 aDSP

**所需工具**

- 编译器版本：Hexagon 8.4.07
- Python 版本：Python 3.10.2
- libffi6 软件包

**编译步骤**

1. Nanopb 集成（一次性设置）：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/ADSP.HT.5.5.c8/adsp_proc/
        python qsh_api/build/config_nanopb_dependency.py -f nanopb-0.3.9.5-linux-x86
        Copy to clipboard
2. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/ADSP.HT.5.5.c8/adsp_proc/build/ms
        Copy to clipboard
3. 清理编译：

python ./build_variant.py kodiak.adsp.prod --clean
        Copy to clipboard
4. 编译镜像：

python ./build_variant.py kodiak.adsp.prod
        Copy to clipboard

编译 Boot

**所需工具**

- 编译器版本：LLVM 版本必须更新至 14.0.4

export LLVM=<FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard
- Python 版本：Python 3.10
- libffi6 软件包

**编译步骤**

1. 安装设备树编译器：

sudo apt-get install device-tree-compiler
        export DTC=/usr/bin
        Copy to clipboard
2. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/BOOT.MXF.1.0.c1/
        Copy to clipboard
3. 安装依赖项：

python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
        pip install json-schema-for-humans
        Copy to clipboard
4. 清理编译：

python -u boot_images/boot_tools/buildex.py -t kodiak,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
        Copy to clipboard
5. 编译镜像：

python -u boot_images/boot_tools/buildex.py -t kodiak,QcomToolsPkg -v LAA -r RELEASE
        Copy to clipboard

Note

对于调试变体 build，请将 `RELEASE` 替换为 `DEBUG`。

编译 Qualcomm TEE 固件

**所需工具**

- 编译器版本：LLVM 16.0.7
- Python 版本：Python 3.10

**编译步骤**

1. 安装 LLVM：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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/
        Copy to clipboard
2. 清理编译：

python build_all.py -b TZ.XF.5.0 CHIPSET=kodiak --cfg=build_config_deploy_kodiak.xml --clean
        Copy to clipboard
3. 编译镜像：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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
        Copy to clipboard

编译 AOP 固件

**所需工具**

- 编译器版本：LLVM 14.0.4
- Python 版本：Python 3.10

**编译步骤**

1. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/AOP.HO.3.6/aop_proc/build/
        Copy to clipboard
2. 清理编译：

./build_kodiak.sh -c -l <FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard
3. 编译镜像：

./build_kodiak.sh -l <FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard

编译 MPSS

Note

此编译版本仅适用于 `Qualcomm_Linux.SPF.1.0|AMSS|Standard|OEM|` 和 `Qualcomm_Linux.SPF.1.0|AMSS|Standard|OEM|QIMPSDK`。

**所需工具**

- 编译器版本：Hexagon 8.4.10
- Python 版本：Python 3.8.2

**编译步骤**

1. Nanopb 集成（一次性设置）：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk/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>/qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk/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
        Copy to clipboard
2. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk/MPSS.HI.4.3.3.c6.2/modem_proc/build/ms
        Copy to clipboard
3. 清理编译：

python build_variant.py kodiak.gen.prod --clean
        Copy to clipboard
4. 编译镜像：

python build_variant.py kodiak.gen.prod bparams=-k
        Copy to clipboard

CPUCP 固件

CPUCP 固件以二进制文件形式发布，无需编译。

CPUSYS.VM 固件

CPUSYS.VM 固件以二进制文件形式发布，无需编译。

BTFM 固件

BTFM 固件以二进制形式发布，无需编译。

WLAN 固件

WLAN 固件以二进制形式发布，无需编译。

生成固件预编译（启动关键和拆分固件二进制文件）

- 从编译的各个组件创建集成固件二进制文件：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCM6490.LE.1.0/common/build
        python build.py --imf
        Copy to clipboard
- 如果在目录中 `<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCM6490.LE.1.0/common/build/ufs/bin` 生成了以下 zip 文件，则固件预编译成功：

> 
> 
> - `QCM6490_bootbinaries.zip`
>     - `QCM6490_dspso.zip`
>     - `QCM6490_fw.zip`

前提条件

- 确保工作 shell 为 `bash`。

echo $0
        Copy to clipboard

    该命令的预期输出应为 `bash`。如果不是，则输入 bash shell：

bash
        Copy to clipboard
- 使用以下命令安装 libffi6 软件包。这是 QAIC 编译器所必需的，它从 IDL 文件生成标头文件和源文件：

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
        Copy to clipboard
- 为 AOP、Qualcomm TEE 和 boot 镜像的编译安装 LLVM：

cd <FIRMWARE_ROOT>
        mkdir llvm
        
        # Log 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
        Copy to clipboard
- 导出 `SECTOOLS` 变量并编译固件（`<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk` 是顶层目录）：

export SECTOOLS=<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/sectoolsv2/ext/Linux/sectools
        export SECTOOLS_DIR=<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/sectoolsv2/ext/Linux
        Copy to clipboard
- 安装并设置 Qualcomm^®^ Hexagon^™^ 处理器。将环境变量 HEXAGON\_ROOT 设置为 Hexagon SDK 的安装路径。要在使用 `qsc-cli` 时更改安装路径，请参阅[更改 Hexagon 工具安装路径](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#change-hex-tool-install-path)。

qsc-cli tool extract --name hexagon8.6 --required-version 8.6.05.2
        export HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
        echo $HEXAGON_ROOT
        Copy to clipboard

编译 DSP

**所需工具**

- 编译器版本：Hexagon 8.6.05.2
- Python 版本：Python 3.8.2

**编译步骤**

1. 安装设备树编译器：

sudo apt-get install device-tree-compiler
        export DTC_PATH=/usr/bin
        Copy to clipboard
2. 安装依赖项：

pip install ruamel.yaml==0.17.17
        pip install dtschema==2021.10
        pip install jsonschema==4.0.0
        Copy to clipboard
3. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/DSP.AT.1.0.1/dsp_proc/build/ms
        Copy to clipboard
4. 清理编译：

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
        Copy to clipboard
5. 编译镜像：

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
        Copy to clipboard

编译 Boot

**所需工具**

- 编译器版本：LLVM 版本必须更新至 14.0.4

export LLVM=<FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard
- Python 版本：Python 3.10
- libffi6 软件包

**编译步骤**

1. 安装设备树编译器：

sudo apt-get install device-tree-compiler
        export DTC=/usr/bin
        Copy to clipboard
2. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/BOOT.MXF.1.0.c1/
        Copy to clipboard
3. 安装依赖项：

python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
        pip install json-schema-for-humans
        Copy to clipboard
4. 清理编译：

python -u boot_images/boot_tools/buildex.py -t lemans,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
        Copy to clipboard
5. 编译镜像：

python -u boot_images/boot_tools/buildex.py -t lemans,QcomToolsPkg -v LAA -r RELEASE
        Copy to clipboard

Note

对于调试变体 build，请将 `RELEASE` 替换为 `DEBUG`。

编译 Qualcomm TEE 固件

**所需工具**

- 编译器版本：LLVM 16.0.7
- Python 版本：Python 3.10

**编译步骤**

1. 安装 LLVM：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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/
        Copy to clipboard
2. 清理编译：

python build_all.py -b TZ.XF.5.0 CHIPSET=lemans --cfg=build_config_deploy_lemans.xml --clean
        Copy to clipboard
3. 编译镜像：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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
        Copy to clipboard

编译 AOP 固件

**所需工具**

- 编译器版本：LLVM 14.0.4
- Python 版本：Python 3.10

**编译步骤**

1. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/AOP.HO.3.6.1/aop_proc/build/
        Copy to clipboard
2. 清理编译：

./build_lemansau.sh -c -l <FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard
3. 编译镜像：

./build_lemansau.sh -l <FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard

CPUCP 固件

CPUCP 固件以二进制文件形式发布，无需编译。

CPUSYS.VM 固件

CPUSYS.VM 固件以二进制文件形式发布，无需编译。

BTFM 固件

BTFM 固件以二进制形式发布，无需编译。

WLAN 固件

WLAN 固件以二进制形式发布，无需编译。

生成固件预编译（启动关键和拆分固件二进制文件）

- 从编译的各个组件创建集成固件二进制文件：

Note

应用[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/ReleaseNote.html#additional-information)中 *Additional information* 章节的所有更改。

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/build
        python build.py --imf
        Copy to clipboard
- 如果在目录中 `<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCM6490.LE.1.0/common/build/ufs/bin` 生成了以下 zip 文件，则固件预编译成功：

> 
> 
> - `QCS9100_bootbinaries.zip`
>     - `QCS9100_dspso.zip`
>     - `QCS9100_fw.zip`

前提条件

- 确保工作 shell 为 `bash`。

echo $0
        Copy to clipboard

    该命令的预期输出应为 `bash`。如果不是，则输入 bash shell：

bash
        Copy to clipboard
- 使用以下命令安装 libffi6 软件包。这是 QAIC 编译器所必需的，它从 IDL 文件生成标头文件和源文件：

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
        Copy to clipboard
- 为 AOP、Qualcomm TEE 和 boot 镜像的编译安装 LLVM：

cd <FIRMWARE_ROOT>
        mkdir llvm
        
        # Log 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
        Copy to clipboard
- 导出 `SECTOOLS` 变量并编译固件（`<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk` 是顶层目录）：

export SECTOOLS=<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS8300.LE.1.0/common/sectoolsv2/ext/Linux/sectools
        export SECTOOLS_DIR=<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS8300.LE.1.0/common/sectoolsv2/ext/Linux
        Copy to clipboard
- 安装并设置 Qualcomm^®^ Hexagon^™^ 处理器。将环境变量 HEXAGON\_ROOT 设置为 Hexagon SDK 的安装路径。要在使用 `qsc-cli` 时更改安装路径，请参阅[更改 Hexagon 工具安装路径](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#change-hex-tool-install-path)。
.. container:: nohighlight

> 
> 
> 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
>         Copy to clipboard

编译 DSP

**所需工具**

- 编译器版本：Hexagon 8.6.05.2 和 8.7.02.1
- Python 版本：Python 3.8.2

**编译步骤**

1. 安装设备树编译器：

sudo apt-get install device-tree-compiler
        export DTC_PATH=/usr/bin
        Copy to clipboard
2. 安装依赖项：

pip install ruamel.yaml==0.17.17
        pip install dtschema==2021.10
        pip install jsonschema==4.0.0
        Copy to clipboard
3. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/DSP.AT.1.0.1/dsp_proc/build/ms
        Copy to clipboard
4. 清理编译：

python ./build_variant.py lemans.adsp.prod --clean
        python ./build_variant.py monaco.cdsp0.prod --clean
        python ./build_variant.py lemans.gpdsp0.prod --clean
        Copy to clipboard
5. 编译镜像：

python ./build_variant.py lemans.adsp.prod && python ./build_variant.py monaco.cdsp0.prod && python ./build_variant.py lemans.gpdsp0.prod
        Copy to clipboard

编译 Boot

**所需工具**

- 编译器版本：LLVM 版本必须更新至 14.0.4

export LLVM=<FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard
- Python 版本：Python 3.10
- libffi6 软件包

**编译步骤**

1. 安装设备树编译器：

sudo apt-get install device-tree-compiler
        export DTC=/usr/bin
        Copy to clipboard
2. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/BOOT.MXF.1.0.c1/
        Copy to clipboard
3. 安装依赖项：

python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt
        pip install json-schema-for-humans
        Copy to clipboard
4. 清理编译：

python -u boot_images/boot_tools/buildex.py -t monaco,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
        Copy to clipboard
5. 编译镜像：

python -u boot_images/boot_tools/buildex.py -t monaco,QcomToolsPkg -v LAA -r RELEASE
        Copy to clipboard

Note

对于调试变体 build，请将 `RELEASE` 替换为 `DEBUG`。

编译 Qualcomm TEE 固件

**所需工具**

- 编译器版本：LLVM 16.0.7
- Python 版本：Python 3.10

**编译步骤**

1. 安装 LLVM：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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/
        Copy to clipboard
2. 清理编译：

python build_all.py -b TZ.XF.5.0 CHIPSET=monaco --cfg=build_config_deploy_monaco.xml --clean
        Copy to clipboard
3. 编译镜像：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/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
        Copy to clipboard

编译 AOP 固件

**所需工具**

- 编译器版本：LLVM 14.0.4
- Python 版本：Python 3.10

**编译步骤**

1. 转到以下目录：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/AOP.HO.3.6.1/aop_proc/build/
        Copy to clipboard
2. 清理编译：

./build_monaco.sh -c -l <FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard
3. 编译镜像：

./build_monaco.sh -l <FIRMWARE_ROOT>/llvm/14.0.4/
        Copy to clipboard

CPUCP 固件

CPUCP 固件以二进制文件形式发布，无需编译。

CPUSYS.VM 固件

CPUSYS.VM 固件以二进制文件形式发布，无需编译。

BTFM 固件

BTFM 固件以二进制形式发布，无需编译。

WLAN 固件

WLAN 固件以二进制形式发布，无需编译。

生成固件预编译（启动关键和拆分固件二进制文件）

- 从编译的各个组件创建集成固件二进制文件：

cd <FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS8300.LE.1.0/common/build
        python build.py --imf
        Copy to clipboard
- 如果在目录中 `<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS8300.LE.1.0/common/build/ufs/bin` 生成了以下 zip 文件，则固件预编译成功：

    - `QCS8300_bootbinaries.zip`
    - `QCS8300_dspso.zip`
    - `QCS8300_fw.zip`

### 利用附加功能编译 BSP 镜像

BSP 镜像 build 包含用于 Qualcomm 设备支持的软件组件和适用于 Qualcomm SoC 的软件特性。此 build 包括 Qualcomm 开发套件的参考分发包配置。`meta-qcom-extras` 层支持对所选组件进行源代码编译，这些组件以二进制形式存在。有关详细信息，请参阅 [Qualcomm Linux 元数据层](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-27/qualcomm_linux_metadata_layers.html)。

1. 利用附加功能下载 Qualcomm Yocto 和支持层。有关 `<manifest release tag>`、和 `<meta-qcom-extras release tag>` 信息，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)中的 *Build-critical release tags* 章节。

# cd to directory where you have 300 GB of free storage space to create your workspaces
        mkdir <WORKSPACE_DIR>
        cd <WORKSPACE_DIR>
        repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-scarthgap -m <manifest release tag>
        # Example, <manifest release tag> is qcom-6.6.97-QLI.1.6-Ver.1.2.xml
        repo sync
        git clone https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_hlos_oem_metadata.git -b <meta-qcom-extras release tag> --depth 1
        # Example, <meta-qcom-extras release tag> is r1.0_00107.0
        mkdir -p layers/meta-qcom-extras
        cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/<product>/common/config/meta-qcom-extras/* layers/meta-qcom-extras/
        # An example <product> is QCM6490.LE.1.0. For more information about <product>, see the latest Release Notes (https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/).
        Copy to clipboard
2. 设置 Yocto 版本：

# Export additional meta layers to EXTRALAYERS. Location is assumed under <WORKSPACE DIR>/layers.
        export EXTRALAYERS="meta-qcom-extras"
        
        # CUST_ID is used to clone the proprietary source repositories downloaded by meta-qcom-extras.
        # It allows source compilation for the corresponding binaries present in meta-qcom-hwe.
        # CUST_ID must be set to "213195" for no-modem based distributions ("qualcomm-linux-spf-1-0_ap_standard_oem_nomodem",
        # "qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk", "qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk").
        # For other modem based distributions, CUST_ID must be set based on the "Customer ID".
        # To find "Customer ID", sign in to your account at qualcomm.com.
        # Click the Profile icon, select Account Settings, and then scroll down to the Company Information section.
        # export CUST_ID using the following command.
        export CUST_ID=<Customer ID>
        
        # The firmware recipe is compiled when the Yocto build is initiated. Firmware recipe expects the
        # path of firmware. You have generated firmware prebuilts (boot-critical and split-firmware binaries)
        # using the steps described in the previous section.
        # Example, for QCM6490, the directory path must contain QCM6490_bootbinaries.zip, QCM6490_dspso.zip, and QCM6490_fw.zip.
        # Set the environment variable to pick up the prebuilts:
        export FWZIP_PATH="<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/<product>/common/build/ufs/bin"
        # An example <product> is QCM6490.LE.1.0. For more information about <product>, see the latest Release Notes (https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/).
        Copy to clipboard
3. 搭建编译环境：

MACHINE=<machine> DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
        # Example, MACHINE=qcs6490-rb3gen2-vision-kit DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
        # source setup-environment: Sets the environment, creates the build directory build-qcom-wayland,
        # and enters into build-qcom-wayland directory.
        Copy to clipboard

    要了解 `MACHINE` 的取值，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)。
4. 编译 Yocto 版本：

bitbake qcom-multimedia-image
        Copy to clipboard

Note

清理 Yocto 版本：

bitbake -fc cleansstate qcom-multimedia-image
        bitbake -fc cleanall qcom-multimedia-image
        Copy to clipboard
5. 成功生成后，检查 `system.img` 文件是否位于 `<workspace_path>/build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-vision-kit/qcom-multimedia-image` 目录中：

cd <workspace_path>/build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-vision-kit/qcom-multimedia-image
        ls -al system.img
        Copy to clipboard
6. 根据[刷写软件镜像](https://docs.qualcomm.com/doc/80-70022-254Y/topic/flash_images.html)来刷写生成的 build。

### 利用附加功能编译 Qualcomm IM SDK 镜像

Qualcomm IM SDK 是四个独立功能 SDK 的集合：Qualcomm IM SDK、Qualcomm Neural Processing SDK、Qualcomm AI Engine Direct SDK 和 LiteRT。该 SDK 还包括可用于开发用例的示例应用程序。`meta-qcom-extras` 层支持对所选组件进行源代码编译，这些组件以二进制形式存在。有关更多详情，请参阅 [Qualcomm IM SDK 快速入门](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-51)。

1. 利用附加功能下载 Qualcomm IM SDK 层、Qualcomm Yocto 层和支持层。有关 `<manifest release tag>`、和 `<meta-qcom-extras release tag>` 信息，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)中的 *Build-critical release tags* 章节。

# cd to directory where you have 300 GB of free storage space to create your workspaces
        mkdir <WORKSPACE_DIR>
        cd <WORKSPACE_DIR>
        repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-scarthgap -m <manifest release tag>
        # Example, <manifest release tag> is qcom-6.6.97-QLI.1.6-Ver.1.2.xml
        repo sync
        git clone https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_hlos_oem_metadata.git -b <meta-qcom-extras release tag> --depth 1
        # Example, <meta-qcom-extras release tag> is r1.0_00107.0
        mkdir -p layers/meta-qcom-extras
        cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/<product>/common/config/meta-qcom-extras/* layers/meta-qcom-extras/
        # An example <product> is QCM6490.LE.1.0. For more information about <product>, see the latest Release Notes (https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/).
        git clone https://github.com/quic-yocto/meta-qcom-qim-product-sdk -b qcom-6.6.97-QLI.1.6-Ver.1.2_qim-product-sdk-2.1.1 layers/meta-qcom-qim-product-sdk
        Copy to clipboard
2. 设置 Yocto 版本：

# Export additional meta layers to EXTRALAYERS. Location is assumed under <WORKSPACE DIR>/layers.
        export EXTRALAYERS="meta-qcom-extras meta-qcom-qim-product-sdk"
        
        # CUST_ID is used to clone the proprietary source repositories downloaded by meta-qcom-extras.
        # It allows source compilation for the corresponding binaries present in meta-qcom-hwe.
        # CUST_ID must be set to "213195" for no-modem based distributions ("qualcomm-linux-spf-1-0_ap_standard_oem_nomodem",
        # "qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk", "qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk").
        # For other modem based distributions, CUST_ID must be set based on the "Customer ID".
        # To find "Customer ID", sign in to your account at qualcomm.com.
        # Click the Profile icon, select Account Settings, and then scroll down to the Company Information section.
        # export CUST_ID using the following command.
        export CUST_ID=<Customer ID>
        
        # The firmware recipe is compiled when the Yocto build is initiated. Firmware recipe expects the
        # path of firmware. You have generated firmware prebuilts (boot-critical and split-firmware binaries)
        # using the steps described in the previous section.
        # Example, for QCM6490, the directory path must contain QCM6490_bootbinaries.zip, QCM6490_dspso.zip, and QCM6490_fw.zip.
        # Set the environment variable to pick up the prebuilts:
        export FWZIP_PATH="<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/<product>/common/build/ufs/bin"
        # An example <product> is QCM6490.LE.1.0. For more information about <product>, see the latest Release Notes (https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/).
        Copy to clipboard
3. 搭建编译环境：

MACHINE=<machine> DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
        # Example, MACHINE=qcs6490-rb3gen2-vision-kit DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
        # source setup-environment: Sets the environment, creates the build directory build-qcom-wayland,
        # and enters into build-qcom-wayland directory.
        Copy to clipboard

    要了解 `MACHINE` 的取值，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)。
4. 编译 Qualcomm IM SDK build：

bitbake qcom-multimedia-image
        # Build SDK image
        bitbake qcom-qim-product-sdk
        Copy to clipboard
5. 清理 Qualcomm IM SDK build：

bitbake -fc cleansstate qcom-multimedia-image
        bitbake -fc cleanall qcom-multimedia-image
        bitbake -fc cleansstate qcom-qim-product-sdk
        bitbake -fc cleanall qcom-qim-product-sdk
        Copy to clipboard
6. 成功生成后，检查 `system.img` 文件是否位于 `<workspace_path>/build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-vision-kit/qcom-multimedia-image` 目录中：

cd <workspace_path>/build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-vision-kit/qcom-multimedia-image
        ls -al system.img
        Copy to clipboard
7. 根据[刷写软件镜像](https://docs.qualcomm.com/doc/80-70022-254Y/topic/flash_images.html)来刷写生成的 build。

### 使用附加组件编译 QIR SDK 镜像

QIR SDK 2.0 是一个组件集，可使您在 Qualcomm Linux 版本上进行机器人特性的开发。`meta-qcom-extras` 层支持对所选定组件进行源编译，这些组件同时也有二进制文件供使用。有关详细信息，请参阅 [QIR SDK 2.0 用户指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-265)。

Note

在开始之前，请克隆 QIR SDK 的相应固件，例如 `qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk`。

1. 利用附加功能下载 QIR SDK、Qualcomm Yocto 和支持层。有关 `<manifest release tag>`、`<meta-qcom-extras release tag>` 和 `<meta-qcom-qim-product-sdk release tag>` 信息，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)中的 *Build-critical release tags* 部分。

# cd to directory where you have 300 GB of free storage space to create your workspaces
        mkdir <WORKSPACE_DIR>
        cd <WORKSPACE_DIR>
        repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-scarthgap -m <manifest release tag>
        # Example, <manifest release tag> is qcom-6.6.97-QLI.1.6-Ver.1.2.xml
        repo sync
        git clone https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_hlos_oem_metadata.git -b <meta-qcom-extras release tag> --depth 1
        # Example, <meta-qcom-extras release tag> is r1.0_00107.0
        mkdir -p layers/meta-qcom-extras
        mkdir -p layers/meta-qcom-robotics-extras
        cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/<product>/common/config/meta-qcom-extras/* layers/meta-qcom-extras/
        cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/<product>/common/config/meta-qcom-robotics-extras/* layers/meta-qcom-robotics-extras/
        # An example <product> is QCM6490.LE.1.0. For more information about <product>, see the latest Release Notes (https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/).
        
        git clone https://github.com/ros/meta-ros -b scarthgap layers/meta-ros && cd layers/meta-ros && git checkout c560699e810e60a9526f4226c2c23f8d877280c8 && cd ../../
        git clone https://github.com/quic-yocto/meta-qcom-robotics.git -b qcom-6.6.97-QLI.1.6-Ver.1.2_robotics-sdk-1.2 layers/meta-qcom-robotics
        git clone https://github.com/quic-yocto/meta-qcom-robotics-distro.git -b qcom-6.6.97-QLI.1.6-Ver.1.2_robotics-sdk-1.2 layers/meta-qcom-robotics-distro
        git clone https://github.com/quic-yocto/meta-qcom-robotics-sdk.git -b qcom-6.6.97-QLI.1.6-Ver.1.2_robotics-sdk-1.2 layers/meta-qcom-robotics-sdk
        git clone https://github.com/quic-yocto/meta-qcom-qim-product-sdk -b qcom-6.6.97-QLI.1.6-Ver.1.2_qim-product-sdk-2.1.1 layers/meta-qcom-qim-product-sdk
        # Example, <meta-qcom-qim-product-sdk release tag> is qcom-6.6.97-QLI.1.6-Ver.1.2_qim-product-sdk-2.1.1
        Copy to clipboard
2. 设置 Yocto 版本：

# Export additional meta layers to EXTRALAYERS. Location is assumed under <WORKSPACE DIR>/layers.
        export EXTRALAYERS="meta-qcom-extras meta-qcom-robotics-extras"
        
        # CUST_ID is used to clone the proprietary source repositories downloaded by meta-qcom-extras.
        # It allows source compilation for the corresponding binaries present in meta-qcom-hwe.
        # CUST_ID must be set to "213195" for no-modem based distributions ("qualcomm-linux-spf-1-0_ap_standard_oem_nomodem",
        # "qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk", "qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk").
        # For other modem based distributions, CUST_ID must be set based on the "Customer ID".
        # To find "Customer ID", sign in to your account at qualcomm.com.
        # Click the Profile icon, select Account Settings, and then scroll down to the Company Information section.
        # export CUST_ID using the following command.
        export CUST_ID=<Customer ID>
        
        # The firmware recipe is compiled when the Yocto build is initiated. Firmware recipe expects the
        # path of firmware. You have generated firmware prebuilts (boot-critical and split-firmware binaries)
        # using the steps described in the previous section.
        # Example, for QCM6490, the directory path must contain QCM6490_bootbinaries.zip, QCM6490_dspso.zip, and QCM6490_fw.zip.
        # Set the environment variable to pick up the prebuilts:
        export FWZIP_PATH="<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk/<product>/common/build/ufs/bin"
        # An example <product> is QCM6490.LE.1.0. For more information about <product>, see the latest Release Notes (https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/).
        Copy to clipboard
3. 编译 QIR SDK build：

ln -s layers/meta-qcom-robotics-distro/set_bb_env.sh ./setup-robotics-environment
        ln -s layers/meta-qcom-robotics-sdk/scripts/qirp-build ./qirp-build
        MACHINE=<machine> DISTRO=qcom-robotics-ros2-humble QCOM_SELECTED_BSP=custom source setup-robotics-environment
        # Example, MACHINE=qcs6490-rb3gen2-vision-kit DISTRO=qcom-robotics-ros2-humble QCOM_SELECTED_BSP=custom source setup-robotics-environment
        # source setup-robotics-environment: Sets the environment, creates the build directory build-qcom-robotics-ros2-humble,
        # and enters into build-qcom-robotics-ros2-humble directory.
        ../qirp-build qcom-robotics-full-image
        Copy to clipboard

    要了解 `MACHINE` 的取值，请参阅[发布说明](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-251013063244/)。
4. 编译成功后，请检查 QIR SDK build artifact 是否位于以下路径：

QIR SDK artifacts: <workspace_path>/build-qcom-robotics-ros2-humble/tmp-glibc/deploy/qirpsdk_artifacts/qirp-sdk_<version>.tar.gz
        # system.img is present in the following path
        Robotics image: <workspace_path>/build-qcom-robotics-ros2-humble/tmp-glibc/deploy/images/qcs6490-rb3gen2-vision-kit/qcom-robotics-full-image
        Copy to clipboard
5. 根据[刷写软件镜像](https://docs.qualcomm.com/doc/80-70022-254Y/topic/flash_images.html)来刷写生成的 build。

## 后续步骤

- [连接到 UART shell](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#connect-uart)
- [连接到网络](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#connect-to-network)
- [使用 SSH 登录](https://docs.qualcomm.com/doc/80-70022-254Y/topic/how_to.html#use-ssh)
- [同步、编译和刷写问题排查](https://docs.qualcomm.com/doc/80-70022-254Y/topic/troubleshoot_sync_build_and_flash.html#troubleshoot-sync-build-and-flash)

Last Published: Nov 04, 2025

[Previous Topic
使用 GitHub 编译（注册用户）](https://docs.qualcomm.com/bundle/publicresource/80-70022-254Y/topics/build_from_source_github_intro.md) [Next Topic
刷写软件镜像](https://docs.qualcomm.com/bundle/publicresource/80-70022-254Y/topics/flash_images.md)

Source: [https://docs.qualcomm.com/doc/80-70022-254Y/topic/build_addn_info.html](https://docs.qualcomm.com/doc/80-70022-254Y/topic/build_addn_info.html)