> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 为 SD 卡构建 Shikra 固件和操作系统镜像

使用此工作流以 SD 卡分区布局构建 Shikra（`shikra-evk`）镜像。生成的烧录产物包括 SD 卡介质所需的固件、boot、ESP 和 rootfs 镜像。

<Note>
  此工作流不同于仅将 SD 卡作为备用介质来启动 Linux 操作系统。有关使用 `efi.bin` 和 `rootfs.img` 进行备用 HLOS 启动的信息，请参见[从 SD 卡启动 Linux 操作系统](./boot-linux-operating-system-from-the-sd-card)。
</Note>

## **前提条件**

* 设置 Yocto 构建主机并安装 `kas`。有关更多信息，请参见[使用 Yocto 构建 Qualcomm Linux](./build-qualcomm-linux)。
* 选择要构建的 `meta-qcom` 发布标签。

## **步骤**

1. 克隆所选的 `meta-qcom` 版本：

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

2. 如果所选的 `meta-qcom` 发布标签尚未包含来自 `qcom-ptool` 的 Shikra SD 卡分区配置，请更新 `meta-qcom/recipes-bsp/partition/qcom-ptool.inc`，使其使用包含该配置的 `qcom-ptool` 修订版本：

   ```bitbake theme={null}
   HOMEPAGE = "https://github.com/qualcomm-linux/qcom-ptool"
   LICENSE = "BSD-3-Clause"
   LIC_FILES_CHKSUM = "file://LICENSE;md5=b0a8acd90d872086b279ead88af03369"

   SRC_URI = "git://github.com/ArunSahu418/qcom-ptool.git;branch=add-shikra-sdcard-partitions;protocol=https"
   SRCREV = "46b8264a74d4ad307f00ef7a62117c461f918f8b"
   ```

3. 在 `meta-qcom/conf/machine/shikra-evk.conf` 中，将分区文件子目录从 eMMC 布局更改为 SD 卡布局。

   将：

   ```bitbake theme={null}
   QCOM_PARTITION_FILES_SUBDIR ?= "partitions/shikra-evk/emmc"
   ```

   替换为：

   ```bitbake theme={null}
   QCOM_PARTITION_FILES_SUBDIR ?= "partitions/shikra-evk/sdcard"
   ```

4. 构建 Shikra 镜像：

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

## **结果**

构建会使用 SD 卡分区布局生成 Shikra 烧录产物。为 Shikra 准备 SD 卡介质时，请使用这些生成的产物。

## **相关主题**

* [使用 Yocto 构建 Qualcomm Linux](./build-qualcomm-linux)
* [在 Qualcomm Linux 中管理分区](./manage-partitions-in-qualcomm-linux)
* [为 Yocto BSP 构建配置存储类型](./how-to-configure-storage-type)
