# 從 SD 卡啟動 Linux 作業系統

您可從 SD 卡中啟動 Qualcomm 開發套件。

準備 SD 卡，將 `EFI.bin` 和 `system.img` 寫入其中。將準備好的 SD 卡插入開發套件的 SD 卡插槽。開發套件將從 SD 卡啟動，該卡中包含備份或備援作業系統，以確保持續運作。

若要從 SD 卡啟動 Qualcomm 開發套件，請執行以下操作：

1. 將 SD 卡插入 Qualcomm 開發套件。確認插入的 SD 卡的裝置節點，例如 `/dev/mmcblk1` 或 `/dev/mmcblk2`。
2. 要格式化 SD 卡，請在 UART shell 上執行 `mkfs.ext4 <sdcard slot>` 命令。

    在以下範例中，SD 卡的裝置節點是 `/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/mmcblk1`) ：

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

備註

在此範例中，將 `First sector` 欄位留空，並確保 `Last sector` 足夠大以容納 `efi.bin`。
    2. 使用 `ext4` 檔案系統建立第二個分區以複製 `system.img`，如下所示：

        若要建立分割區，請執行以下命令 (例如，裝置節點為 `/dev/mmcblk1`) ：

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

> 
> 
> 備註
> 
> 
> 在此範例中，將 `First sector` 欄位留空，並確保 `Last sector` 足夠大以容納 `system.img`。
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 卡，以下是一個範例：

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

備註

在此命令中，SD 卡的裝置節點是 `/dev/mmcblk1`。
7. SD 卡已準備好啟動映像。如果 UFS 或 eMMC 上的 EFI 分割區損毀，或 systemd-boot 失敗，裝置將從 SD 卡啟動以確保持續運作。

Last Published: Dec 23, 2025

[Previous Topic
Qualcomm Linux 的 OTA 更新](https://docs.qualcomm.com/bundle/publicresource/80-70020-27TC/topics/ota_update_for_qualcomm_linux.md) [Next Topic
使用 efivar 工具管理 UEFI 環境變數](https://docs.qualcomm.com/bundle/publicresource/80-70020-27TC/topics/manage_uefi_environment_variables_using_efivar_tool.md)