# 从 SD 卡启动 Linux 操作系统

您可以从 SD 卡启动 Qualcomm 开发套件。

1. 使用 `EFI.bin` 和 `system.img` 刷写以准备 SD 卡。
2. 将准备好的 SD 卡插入开发套件的 SD 卡槽中。

开发套件从 SD 卡启动，其中包含备份或冗余操作系统以确保持续运行。

要从 SD 卡启动 Qualcomm 开发套件，请执行以下操作：

1. 验证插入的 SD 卡的设备节点，例如，`/dev/mmcblk1` 或者 `/dev/mmcblk2`。
2. 要格式化 SD 卡，请运行 UART shell 上的 `mkfs.ext4 <sdcard slot>` 命令。

    在以下示例中，SD 卡的 dev 节点为 `/dev/mmcblk1`。

mkfs.ext4 /dev/mmcblk1
        Copy to clipboard

    输出：

mke2fs 1.46.5 (30-Dec-2021)
        Found a dos partition table in /dev/mmcblk1
        Proceed anyway? (y,N) y
        Discarding device blocks: done
        Creating filesystem with 3889536 4k blocks and 972944 inodes
        Filesystem UUID: 069e04f8-0b72-4a94-aa93-f5ec03bea38d
        Superblock backups stored on blocks:
           32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
        
        Allocating group tables: done
        Writing inode tables: done
        Creating journal (16384 blocks): done
        Writing superblocks and filesystem accounting information: done
        Copy to clipboard
3. 使用 `fdisk` 命令在 SD 卡上创建两个分区复制 `efi.bin` 和 `system.img`。

    1. 使用 `vfat` 文件系统创建第一个分区来复制 `efi.bin`。

        要创建分区，请运行以下命令（例如，dev 节点是 `/dev/mmcblk1`)：在此示例中，保留 `First sector` 字段为空，并确保 `Last sector` 足够大，以复制 `efi.bin`。

fdisk /dev/mmcblk1
            Copy to clipboard

        输出：

Welcome to fdisk (util-linux 2.37.4).
            Changes will remain in memory only, until you decide to write them.
            Be careful before using the write command.
            
            The device contains 'ext4' signature and it will be removed by a write command.
            See fdisk(8) man page and --wipe option for more details.
            
            Device doesn't contain a recognized partition table.
            Created a new DOS disklabel with disk identifier 0xa5fa6b03.
            
            Command (m for help): n
            Partition type
               p   primary (0 primary, 0 extended, 4 free)
               e   extended (container for logical partitions)
            Select (default p): p
            Partition number (1-4, default 1): 1
            First sector (2048-31116287, default 2048):
            Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31116287, default 31116287): +512M
            
            Created a new partition 1 of type 'Linux' and of size 512 MiB.
            
            Command (m for help): w
            The partition table has been altered.
            Calling ioctl() to re-read partition table.
            Syncing disks.
            Copy to clipboard

        要将分区转换为 `vfat` 文件系统，请运行以下命令：

mkfs.vfat /dev/mmcblk1p1
            Copy to clipboard

        输出：

mkfs.fat 4.2 (2021-01-31)
            Copy to clipboard
    2. 使用 `ext4` 文件系统创建第二个分区来复制 `system.img`，如下所示：

        要创建分区，请运行以下命令（例如，dev 节点是 `/dev/mmcblk1`)：在此示例中，保留 `First sector` 字段为空，并确保 `Last sector` 足够大，以复制 `system.img`。

fdisk /dev/mmcblk1
            Copy to clipboard

        输出：

Welcome to fdisk (util-linux 2.37.4).
            Changes will remain in memory only, until you decide to write them.
            Be careful before using the write command.
            
            Command (m for help): n
            Partition type
               p   primary (1 primary, 0 extended, 3 free)
               e   extended (container for logical partitions)
            Select (default p): p
            Partition number (2-4, default 2): 2
            First sector (1050624-31116287, default 1050624):
            Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-31116287, default 31116287): +10G
            
            Created a new partition 2 of type 'Linux' and of size 10 GiB.
            
            Command (m for help): w
            The partition table has been altered.
            Calling ioctl() to re-read partition table.
            Syncing disks.
            Copy to clipboard

        要将分区转换为 `ext4` 文件系统，请运行以下命令：

mkfs.ext4 /dev/mmcblk1p2
            Copy to clipboard

        输出：

mke2fs 1.46.5 (30-Dec-2021)
            Discarding device blocks: done
            Creating filesystem with 2621440 4k blocks and 655360 inodes
            Filesystem UUID: 9e470d01-77fe-4382-a273-ab8b022bdd8b
            Superblock backups stored on blocks:
                     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
            
            Allocating group tables: done
            Writing inode tables: done
            Creating journal (16384 blocks): done
            Writing superblocks and filesystem accounting information: done
            Copy to clipboard
4. 验证分区是否已创建：

lsblk -f /dev/mmcblk1
        Copy to clipboard

    输出：

NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
        mmcblk1
        |
        |-mmcblk1p1
        |    vfat               1EAC-8FF8
        `-mmcblk1p2
             ext4               9e470d01-77fe-4382-a273-ab8b022bdd8b
        Copy to clipboard
5. 使用 `scp` 命令将主机上成功编译的 Qualcomm Linux 镜像中的 `efi.bin` 和 `system.img` 复制到设备。

scp -r <efi.bin> <IP_address>:<path>
        scp -r <system.img> <IP_address>:<path>
        Copy to clipboard
6. 将 `efi.bin` 和 `system.img` 从设备复制到 SD 卡上的分区，在设备上运行以下命令：

    - `dd if=<path>/efi.bin of=<sdcard slot> bs=4M`
    - `dd if=<path>/system.img of=<sdcard slot> bs=4M`

    要从设备上 `/tmp` 的路径复制两个镜像，以下是如何将其复制到 SD 卡的示例：在此命令中，SD 卡的 dev 节点是 `/dev/mmcblk1`。

dd if=/tmp/efi.bin of=/dev/mmcblk1p1 bs=4M
        
        dd if=/tmp/system.img of=/dev/mmcblk1p2 bs=4M
        Copy to clipboard

SD 卡已准备好启动镜像。如果 UFS 或 eMMC 上的 EFI 分区损坏或 systemd-boot 失败，设备将从 SD 卡启动以确保持续运行。

Last Published: Nov 04, 2025

[Previous Topic
使用 capsule 和 OSTree 机制在 Qualcomm Linux 上更新固件和操作系统](https://docs.qualcomm.com/bundle/publicresource/80-70022-27SC/topics/update_fw_and_os_qualcomm_linux_using_capsule_and_ostree_mechanisms.md) [Next Topic
使用](https://docs.qualcomm.com/bundle/publicresource/80-70022-27SC/topics/manage_uefi_environment_variables_using_efivar_tool.md)