# 使用 Github 编译（固件和附加功能）

Source: [https://docs.qualcomm.com/doc/80-65220-2Y/topic/using-detailed-instructions_3_2.html](https://docs.qualcomm.com/doc/80-65220-2Y/topic/using-detailed-instructions_3_2.html)

使用详细的说明来同步和编译 QIRP SDK 附加层以及 Qualcomm Linux 选定的固件源代码。

**前提条件**

- 已根据[GitHub 工作流程（固件和附加组件）](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-254/build_addn_info.html)搭建主机环境。

Note:
- 对于 QIRP SDK，您可以按照以下步骤中的描述**以独立命令进行编译**。
- 当前发行版本不支持**使用 Dockerfile 进行编译**。

## 下载基础层

下载 QIRP SDK 的所有基础层。

### 方法 1：使用 manifest 下载

- 通过运行以下命令下载 QIRP SDK 的层。

Note: 要获取最新 `<robotics-release-manifest>`，参见 [Qualcomm® Linux Intelligent Robotics Product SDK (QIRP SDK) 2.0 发行说明](https://docs.qualcomm.com/bundle/publicresource/topics/80-75695-1)。

        cd <workspace>
        repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-kirkstone -m <robotics-release-manifest>
        repo sync -c -j8Copy to clipboard

    **示例：**

    要下载“`qcom-6.6.28-QLI.1.1-Ver.1.1_robotics-product-sdk-1.1`”发行版本，运行此命令：

        repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-kirkstone -m qcom-6.6.28-QLI.1.1-Ver.1.1_robotics-product-sdk-1.1.xml
        repo sync -c -j8Copy to clipboard

    **结果：**以下层已下载。

        meta-qcom
        meta-qcom-hwe
        meta-qcom-distro
        meta-ros
        meta-qcom-robotics
        meta-qcom-robotics-distro
        meta-qcom-robotics-sdk
        meta-qcom-qim-product-sdkCopy to clipboard

### 方法 2：使用“git clone”命令下载

1. 按照 [Qualcomm Repo Manifest README 文件](https://github.com/quic-yocto/qcom-manifest/blob/qcom-linux-kirkstone/README.md)的说明，搭建主机环境并同步最新 Yocto 项目 BSP。
2. 基于下载的 Yocto 项目 BSP 的 `<workspace>` 目录，下载 QIRP SDK 的各层。

        cd <workspace>
        git clone https://git.codelinaro.org/clo/le/meta-ros.git -b ros.qclinux.1.0.r1-rel layers/meta-ros
        git clone https://github.com/quic-yocto/meta-qcom-robotics.git layers/meta-qcom-robotics
        git clone https://github.com/quic-yocto/meta-qcom-robotics-distro.git layers/meta-qcom-robotics-distro
        git clone https://github.com/quic-yocto/meta-qcom-robotics-sdk.git layers/meta-qcom-robotics-sdk
        git clone https://github.com/quic-yocto/meta-qcom-qim-product-sdk layers/meta-qcom-qim-product-sdkCopy to clipboard

**结果：**
    [方法 1：使用 manifest 下载](https://docs.qualcomm.com/doc/80-65220-2Y/topic/using-detailed-instructions_3_2.html#ID-concept-download-src__section_bhb_qzk_4bc) 中所述的层已下载。

**Related Resources**  

- [架构](https://docs.qualcomm.com/doc/80-65220-2Y/topic/architecture.html)

## 同步 meta-qcom-robotics-extras 层并编译 QIRP SDK

Source: [https://docs.qualcomm.com/doc/80-65220-2Y/topic/using-detailed-instructions_3_2.html](https://docs.qualcomm.com/doc/80-65220-2Y/topic/using-detailed-instructions_3_2.html)

同步 `meta-qcom-robotics-extras` 层并编译 QIRP SDK 的机器人镜像。

### About this task

**步骤：**

### Procedure

1. 按照[GitHub 工作流程（固件和附加组件）](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-254/build_addn_info.html)同步并编译 Qualcomm^®^ Linux 固件。
                
对于上述编译，如果 &lt;FIRMWARE\_ROOT&gt;/qualcomm-linux-spf-1-0\_ap\_standard\_oem\_nomodem/QCM6490.LE.1.0/common/build/ufs/bin 目录中生成了以下 zip 文件，则表明固件预编译已成功生成：

    - QCM6490\_bootbinaries.zip
    - QCM6490\_dspso.zip
    - QCM6490\_fw.zip
2. 获取 `meta-qcom-robotics-extras` 和 `meta-qcom-extras` 层。
                
Note: 从[Qualcomm® Linux Intelligent Robotics Product SDK (QIRP SDK) 2.0 发行说明](https://docs.qualcomm.com/bundle/publicresource/topics/80-75695-1)获取 `<meta-qcom-robotics-extras-release-tag>`.例如，`r1.0_00041.0`。

        cd <workspace>
        git clone -b <meta-qcom-robotics-extras-release-tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_hlos_oem_metadata.git
        mkdir -p layers/meta-qcom-robotics-extras
        mkdir -p layers/meta-qcom-extras
        cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/QCM6490.LE.1.0/common/config/meta-qcom-extras/* layers/meta-qcom-extras/
        cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/QCM6490.LE.1.0/common/config/meta-qcom-robotics-extras/* layers/meta-qcom-robotics-extras/Copy to clipboard
3. 搭建编译环境。
                
cd <workspace>
        export EXTRALAYERS="meta-qcom-extras meta-qcom-robotics-extras"
        export CUST_ID="213195"
        export FWZIP_PATH="<FIRMWARE_ROOT>/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/QCM6490.LE.1.0/common/build/ufs/bin"Copy to clipboard

        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=qcm6490 DISTRO=qcom-robotics-ros2-humble source setup-robotics-environmentCopy to clipboard
4. 编译机器人镜像和 QIRP SDK 组件。
                
../qirp-build qcom-robotics-full-imageCopy to clipboard

**编译结果：**

    - QIRP SDK artifacts： `<workspace>/build-qcom-robotics-ros2-humble/tmp-glibc/deploy/qirpsdk_artifacts/qirp-sdk_<version>.tar.gz`.
    - 机器人镜像： `<workspace>/build-qcom-robotics-ros2-humble/tmp-glibc/deploy/images/qcm6490/qcom-robotics-full-image`

Last Published: Aug 09, 2024

[Previous Topic
使用 Github 编译（基础层）](https://docs.qualcomm.com/bundle/publicresource/80-65220-2Y/topics/build-with-github-binaries.md) [Next Topic
使用预编译的机器人 eSDK 编译机器人镜像](https://docs.qualcomm.com/bundle/publicresource/80-65220-2Y/topics/build-with-prebuilt-esdk.md)