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

# 构建 Mainline 变体

[Yocto 构建指南](./build-qualcomm-linux)介绍了如何构建稳定且经过验证的 `meta-qcom` 版本。Mainline 构建跟踪 meta-qcom 的最新开发版本，面向需要提前获取新功能、修复或上游变更的开发者。

## 构建说明

* 下载 meta-qcom 的开发分支。

  ```bash theme={null}
  git clone https://github.com/qualcomm-linux/meta-qcom -b master
  ```

- 使用 `kas` 构建软件镜像。您可以基于机器和发行版组合定义构建目标。

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

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

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

    ```bash QCS6490 theme={null}
    kas build meta-qcom/ci/rb3gen2-core-kit.yml:meta-qcom/ci/qcom-distro.yml:meta-qcom/ci/performance.yml
    ```

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

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

  <Note>
    在某些主机上，`https://git.yoctoproject.org/git/meta-virtualization` 可能会克隆失败。如果遇到这种情况，请配置 Git 将该 URL 自动重定向到可用的 URL：

    ```bash theme={null}
    git config --global url."https://git.yoctoproject.org/meta-virtualization".insteadOf \
        "https://git.yoctoproject.org/git/meta-virtualization"
    ```

    验证重定向已生效：

    ```bash theme={null}
    git config --global --get-regexp url
    ```

    导出 `GITCONFIG_FILE` 参数，以确保 `~/.gitconfig` 配置对 kas 环境可见

    ```bash theme={null}
    export GITCONFIG_FILE="~/.gitconfig"
    ```
  </Note>

* 构建会生成一个 tarball，其中包含执行一次完整全新刷写所需的所有相关文件，包括分区元数据、启动固件、ESP 分区和 rootfs。构建成功后，请检查构建产物中是否存在 qcomflash tarball。以下示例使用 `qcom-multimedia-proprietary-image` 作为镜像名称。

  <CodeGroup>
    ```bash IQ-9075-EVK theme={null}
    ls build/tmp/deploy/images/iq-9075-evk/qcom-multimedia-proprietary-image-iq-9075-evk.rootfs.qcomflash.tar.gz
    ```

    ```bash IQ-8275-EVK theme={null}
    ls build/tmp/deploy/images/iq-8275-evk/qcom-multimedia-proprietary-image-iq-8275-evk.rootfs.qcomflash.tar.gz
    ```

    ```bash IQ-615-EVK theme={null}
    ls build/tmp/deploy/images/iq-615-evk/qcom-multimedia-proprietary-image-iq-615-evk.rootfs.qcomflash.tar.gz
    ```

    ```bash QCS6490 theme={null}
    ls build/tmp/deploy/images/rb3gen2-core-kit/qcom-multimedia-proprietary-image-rb3gen2-core-kit.rootfs.qcomflash.tar.gz
    ```

    ```bash IQ-X7181-EVK theme={null}
    ls build/tmp/deploy/images/iq-x7181-evk/qcom-multimedia-proprietary-image-iq-x7181-evk.rootfs.qcomflash.tar.gz
    ```

    ```bash IQ-X5121-EVK theme={null}
    ls build/tmp/deploy/images/iq-x5121-evk/qcom-multimedia-proprietary-image-iq-x5121-evk.rootfs.qcomflash.tar.gz
    ```
  </CodeGroup>
