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

# 创建用于调试的构建

本节说明如何使用 Yocto 设置启用并构建调试镜像。适用于需要更深入了解系统行为、进行故障排除和内核级调试的开发者。

要生成调试构建，只需在构建命令中包含 `debug.yml` kas 配置片段，这会启用 `DEBUG_BUILD=1` 配置。要了解当 `DEBUG_BUILD` 设置为 1 时使用哪些内核 defconfig 和配置片段，请参阅[内核 recipe](./meta-qcom#kernel-recipes)。

## **构建说明**

* 下载 Qualcomm 的 Yocto 层 `meta-qcom`。有关最新的 `<meta-qcom-release-tag>`，请参阅[配置参数](#configuration-parameters)。

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

- 使用 `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/debug.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/debug.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/debug.yml
    ```

    ```bash QCS6490 theme={null}
    kas build meta-qcom/ci/rb3gen2-core-kit.yml:meta-qcom/ci/qcom-distro.yml:meta-qcom/ci/debug.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/debug.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/debug.yml
    ```
  </CodeGroup>

* 构建会生成一个 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>

以下来自 `recipes-kernel/linux/linux-qcom_6.18.bb` 的代码片段为正在构建的内核启用调试配置片段：

```text theme={null}
KBUILD_CONFIG_EXTRA:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/kernel/configs/debug.config', '', d)}"
KBUILD_CONFIG_EXTRA:append:aarch64 = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/arch/arm64/configs/qcom_debug.config', '', d)}"
```

## **后续步骤**

* 有关镜像中可用的调试工具，请参阅[调试工具](./debug-tools)。
* 有关 Yocto 构建的常规调试，请参阅[调试 Yocto 构建](./debug)。
