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

# Boot Linux operating system from the SD card

You can boot up Qualcomm development kits from the SD card.

1. Prepare the SD card by flashing it with `efi.bin` and `rootfs.img`.
2. Insert the prepared SD card into the SD card slot of the development kit.

The development kit boots up from the SD card, which contains a backup or redundant operating system to ensure continuous operation.

## Supported platforms

| **Platform** | **Machine configuration** | **Development kit**                               |
| ------------ | ------------------------- | ------------------------------------------------- |
| Kodiak       | `rb3gen2-core-kit`        | Qualcomm Dragonwing™ RB3 Gen 2 Core Kit (QCS6490) |
| Lemans       | `iq-9075-evk`             | Qualcomm Dragonwing™ IQ-9075 EVK (QCS9075)        |
| Monaco       | `iq-8275-evk`             | Qualcomm Dragonwing™ IQ-8275 EVK (QCS8275)        |
| Talos        | `qcs615-ride`             | Qualcomm QCS615 ADP Air EVK (QCS615)              |

To prepare a bootable SD card, do the following:

**Prerequisites**

Use a Linux desktop system to perform steps 1 through 5 and prepare a bootable SD card.

**Procedure**

1. Verify the device node for the inserted SD card on any Linux system, for example, `/dev/mmcblk1` or `/dev/mmcblk2`.
2. To format the SD card, run the `mkfs.ext4 <sdcard slot>` command on the Linux terminal.
   In the following example, the dev node for the SD card is `/dev/mmcblk1`.
   ```text theme={null}
   mkfs.ext4 /dev/mmcblk1
   ```
   Output:
   ```text theme={null}
   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
   ```
3. Use the `fdisk` command to create two partitions on the SD card to copy `efi.bin` and `rootfs.img`.
   1. Create the first partition with the `vfat` file system to copy `efi.bin`.
      To create the partition, run the following command (for example, the dev node is `/dev/mmcblk1`): In this example, leave the `First sector` field empty and ensure that `Last sector` is large enough to copy `efi.bin`.
      ```text theme={null}
      fdisk /dev/mmcblk1
      ```
      Output:
      ```text theme={null}
      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.
      ```
      To convert the partition to the `vfat` file system, run the following command:
      ```text theme={null}
      mkfs.vfat /dev/mmcblk1p1
      ```
      Output:
      ```text theme={null}
      mkfs.fat 4.2 (2021-01-31)
      ```
   2. Create the second partition with the `ext4` file system to copy `rootfs.img` as follows:
      To create the partition, run the following command (for example, the dev node is `/dev/mmcblk1`): In this example, leave the `First sector` field empty and ensure that `Last sector` is large enough to copy `rootfs.img`.
      ```text theme={null}
      fdisk /dev/mmcblk1
      ```
      Output:
      ```text theme={null}
      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.
      ```
      To convert the partition to the `ext4` file system, run the following command:
      ```text theme={null}
      mkfs.ext4 /dev/mmcblk1p2
      ```
      Output:
      ```text theme={null}
      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
      ```
4. Verify the partitions were created:
   ```text theme={null}
   lsblk -f /dev/mmcblk1
   ```
   Output:
   ```text theme={null}
   NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
   mmcblk1
   |
   |-mmcblk1p1
   |    vfat               1EAC-8FF8
   `-mmcblk1p2
        ext4               9e470d01-77fe-4382-a273-ab8b022bdd8b
   ```
5. Copy `efi.bin` and `rootfs.img` from the successfully built Qualcomm Linux image on the host computer to the partitions on the SD card. Run the following commands on the host computer:
   * `dd if=<path>/efi.bin of=<sdcard slot> bs=4M`
   * `dd if=<path>/rootfs.img of=<sdcard slot> bs=4M`
     To copy both images from the `/tmp` path, following is an example of how to copy them to the SD card: In this command, the dev node for the SD card is `/dev/mmcblk1`.
   ```text theme={null}
   dd if=/tmp/efi.bin of=/dev/mmcblk1p1 bs=4M
   dd if=/tmp/rootfs.img of=/dev/mmcblk1p2 bs=4M
   ```

**Result**

The SD card is now ready to be used as boot media for a Qualcomm Linux development kit. When an SD card is inserted, it is used as fallback boot media only if the primary flash storage (UFS or eMMC) on the development kit is unbootable. To simulate an unbootable condition, erase the EFI partition on the UFS or eMMC storage to force a fallback boot from the SD card.
