.. include:: /keyword.rst ============ SD Card Boot ============ .. contents:: Sections :local: :depth: 2 .. toctree:: :hidden: :maxdepth: 1 -------------------------------- ``SD card boot`` is a boot method in U-Boot for booting devices via an SD Card. |G510-G700-EVK| and |G1200-EVK| support SD card boot (via mmc device 1) in U-Boot since IoT Yocto ``v24.1``. It also provides support for booting via the native ``mmc_boot`` script in U-Boot. To use SD card boot, simply use a raw image downloader such as ``rufus`` or ``dd`` to flash the image onto the SD card. Therefore, users will need to build the ``wic`` raw image format for IoT Yocto. Here, we provide a very simple example for ``SD card boot`` on U-Boot. Build and Deploy IoT Yocto Image via SD Card Boot on Genio EVK -------------------------------------------------------------- Developers can build the ``rity-demo-image`` and then boot the kernel and mount the file system via SD card on Genio EVK. To reduce build/flash time and image size, users can also try the ``rity-bringup-image`` to test this feature. The following sections describe the instructions to build and deploy IoT Yocto with raw image support and EFI (Extensible Firmware Interface) support for SD card boot. Build IoT Yocto Supporting Raw Image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Edit your `conf/local.conf` to include the necessary settings for building a raw image with ``rity-bringup-image``. .. prompt:: IMAGE_FSTYPES:append = " wic " Build the rity-bringup-image: .. prompt:: bash $ MACHINE=genio-1200-evk bitbake rity-bringup-image Deploy SD Card Boot with IoT Yocto Raw Image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Once the build is complete, locate the output files, which are typically found in the ``tmp/deploy/images/`` directory within the corresponding ``MACHINE`` folder. For example, if a user wants to boot |G1200-EVK| via SD Card Boot. .. important:: Please ensure that the EVK has a functional boot chain on the main storage, which can be either eMMC (embedded MultiMedia Card) or UFS (Universal Flash Storage), to support booting from an SD Card. If the user is unsure whether the firmware supports SD card boot, please flash the new build ``rity-bringup-image`` on the EVK. Then, deploy the raw disk image ``rity-bringup-image-genio-1200-evk.rootfs.wic`` to the SD card. We suggest using ``rufus`` on Windows OS and ``dd`` on Linux OS to flash the raw disk image to the SD card. For Windows OS, you can use ``rufus`` to flash the raw disk image. .. figure:: /_asset/sdcard_boot_rufus_01.png :align: center :width: 400px Rufus: Select The RAW Disk Image And Click "START" To Flash The SD card. .. figure:: /_asset/sdcard_boot_rufus_02.png :align: center :width: 400px Rufus: The Process Of Flashing The RAW Disk Image Is Complete. For Linux OS, unmount the SD card before using ``dd`` if the system detects and mounts it. .. prompt:: bash $ sudo umount /dev/sdX sudo dd if=rity-bringup-image-genio-1200-evk.wic of=/dev/sdX bs=1M sudo sync sudo udisksctl power-off -b /dev/sdX Remove the SD card from the PC after flashing it, then insert it into the SD card slot on the EVK. 1. Run the following command to reboot the system: .. prompt:: bash $ reboot 2. Hit any key when you see the message "Hit any key to stop autoboot" 3. Run the following commands in U-Boot mode: .. prompt:: bash => setenv boot_targets mmc1 setenv storage mmc setenv storage_dev 1 saveenv reset After reboot, the boot firmware on eMMC will load DTB, kernel, and rootfs from the SD card. .. prompt:: U-Boot 2022.10-gf7a807b03b (Dec 23 2024 - 11:06:43 +0000) ... mmc1 is current device Scanning mmc 1:8... ... Scanning mmc 1:a... Found U-Boot script /boot/fitImage mmc1 is current device ... MMC read: dev # 1, block # 421888, count 65536 ... 65536 blocks read: OK ## Loading kernel from FIT Image at 4a000000 ... Build IoT Yocto Supporting Raw Image with EFI Boot Enabled ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Users can also boot the SD card via the EFI boot process. Users need to build IoT Yocto with EFI support. Edit your `conf/local.conf` to include the necessary settings for building a raw image with ``rity-bringup-image``. Remember to also add raw image support to this build. .. prompt:: MACHINE_FEATURES:append = " efi " IMAGE_FSTYPES:append = " wic " Build the rity-bringup-image: .. prompt:: bash $ MACHINE=genio-1200-evk bitbake rity-bringup-image Deploy SD Card Boot with IoT Yocto with EFI Boot Enabled ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Once the build is complete, locate the output files, which are typically found in the ``tmp/deploy/images/`` directory within the corresponding ``MACHINE`` folder. For example, if a user wants to boot |G1200-EVK| via SD Card Boot. .. important:: Please ensure the EVK has a functional boot chain on the main storage (eMMC or UFS) to support SD Card boot. If the user is unsure whether the firmware supports SD card boot, please flash the new build ``rity-bringup-image`` on the EVK. Then, deploy the raw disk image ``rity-bringup-image-genio-1200-evk.rootfs.wic`` to the SD card. We suggest using ``rufus`` on Windows OS and ``dd`` on Linux OS to flash the raw disk image to the SD card. For Windows OS, you can use ``rufus`` to flash the raw disk image. For Linux OS, unmount the SD card before using ``dd`` if the system detects and mounts it. .. prompt:: bash $ sudo umount /dev/sdX sudo dd if=rity-bringup-image-genio-1200-evk.wic of=/dev/sdX bs=1M sudo sync sudo udisksctl power-off -b /dev/sdX Remove the SD card from the PC after flashing it, then insert it into the SD card slot on the EVK. 1. Run the following command to reboot the system: .. prompt:: bash $ reboot 2. Hit any key when you see the message "Hit any key to stop autoboot" 3. Run the following commands in U-Boot mode: .. prompt:: bash => setenv boot_targets mmc1 setenv storage mmc setenv storage_num 1 saveenv reset After reboot, the boot firmware on eMMC will load DTB, kernel, and rootfs from the SD card. When EFI boot is enabled, U-Boot will boot into ``GRUB``. Press 'ctrl-x' or 'enter' to boot from ``GRUB`` menu.