Skip to main content
Version: Toradex Easy Installer version 7

Boot From an SD Card

Introduction

This article instructs you on how to boot from an external storage device (which contains a Torizon OS or Reference Image) as an alternative to Toradex Easy Installer. If you wish to boot Toradex Easy Installer from an external storage device, refer to Loading Toradex Easy Installer.

Booting your system from an external storage device might be useful for some use cases, such as:

  1. For offline and/or isolated systems that have no other means of installing or upgrading their system.
  2. For resource-scarce systems or systems that do not provide internal storage.
  3. For development and testing environments.
warning

Toradex no longer supports booting images from USB flash drives. If your project relies on this feature, contact our support team or visit the Toradex Community website for guidance and alternatives.

However, it is still possible to:

Requirements

To boot from an SD card, you need:

  • U-Boot running on your module: If this is not the case, install a Toradex Image using Toradex Easy Installer. Alternatively, if not (yet) available for your particular module, revert to using the Legacy Update Procedure.
  • An SD card with two partitions:
    • A FAT partition to store the kernel image and device trees;
    • An ext4 partition to store the rootfs.

Procedure

You can prepare the SD card in two different ways:

The second option is faster, but requires you to build the images first using the Yocto build system. Use it only if you are actually modifying or debugging the images.

Using Toradex Images

Use your preferred partitioning tool to create the mentioned partitions on your SD card or follow the steps below.

info

The size will depend on your module and images, but 100-500MB for the boot partition, and 1-2GB for the rootfs should be sufficient in most cases. The order of the partitions is important since U-boot will look for the kernel and device trees in the first, and for the rootfs in the second one.

  1. Create the boot partition as a primary partition formated as fat32, with 100MB of space, and the rootfs partition formated as ext4, with 2GB of space. When conecting a external drive, it could be an SD card or an MMC block device. So keep in mind to partition the right device, for example, /dev/sda or /dev/sdb, if you are using an SD card; or mmcblk(n) (where (n) stands for the number of your mmc device), if using mmc ones. You can check by looking at dmesg after plugging the SD to your computer or using the lsblk command.
$ sudo parted -s /dev/sd(x) mklabel gpt mkpart primary fat32 1MiB 100MiB mkpart ext4 100MiB 2000MiB name 1 boot name 2 rootfs

$ sudo mkfs.fat -n boot /dev/sd(x)1 && sudo mkfs.ext4 -L rootfs /dev/sd(x)2

$ sudo lsblk /dev/sd(x) -o NAME,FSTYPE,LABEL,PARTLABEL

We labeled the partitions boot and rootfs, but you can name them at will.

  1. Mount the partitions afterwards to be able to access them
$ sudo mount -L boot /mnt/boot; sudo  mount -L rootfs /mnt/rootfs
  1. Download an image for the Toradex Easy Installer corresponding to your module and extract the kernel image (zImage) and the device trees (*.dtb) into the first partition, and the rootfs into the second. This example complies the Colibri iMX6, the procedure is similar for other Toradex SoMs.
$ sudo tar xf Reference-Minimal-Image-upstream-colibri-imx6.bootfs.tar.xz --no-same-owner -C /mnt/boot 
$ sudo tar xf Reference-Minimal-Image-upstream-colibri-imx6.tar.xz -C /mnt/rootfs
  1. Unmount the partitions
$ sudo umount /mnt/{boot,rootfs}
  1. Insert the SD card into (one of) the carrier board slot(s) and boot your module entering U-boot (by hitting any key in the early boot screen).

  2. (Optional) At the U-boot prompt, check that if partitions are recognized. You should see the names you gave them during the partitioning process. For example, for mmc devices:

> mmc dev 1; mmc part
  1. You can now boot using one of the following commands, depending on the media you are using:
> run bootcmd_mmc0 # For eMMC
> run bootcmd_mmc1 # SD card
> run bootcmd_dhcp # TFTP/NFS
info

For more information about boot commands on U-Boot, please refer to Distro Boot.

Using wic Files

The OpenEmbedded build system supports the generation of wic images that can be directly burned to an SD card. By default, this feature is enabled in all our images since release 2.8b4 (on older releases only NXP i.MX modules support it). Thus, if you are building your own images from the Toradex repositories, you can find the corresponding wic image after a build in the deploy/images/name-of-the-board/ folder of your OpenEmbedded tree. The image is compressed and named xxx.wic.gz (e.g. Console-image-colibri-imx6.wic.gz). Decompress it first to get the original wic image and burn it directly to your SD card using e.g. the dd utility.

$ gzip -d xxx.wic.gz

$ sudo dd if=xxx.wic of=/dev/sd-card-device bs=4M

Or in one go:

$ zcat xxx.wic.gz | sudo dd of=/dev/sd-card-device bs=4M

where sd-card-device is the name of the Linux device exposing the SD card (you can find it using lsblk or looking at the output of dmesg after plugging the card). Move the SD card to your carrier board slot, turn on your module and quickly trigger the U-boot console (by pressing any key within the first 2 seconds). From there, you can boot from the external media by executing run bootcmd_mmc1 in the console.

Alternatives to Booting From an SD Card

We recommend booting from an SD Card during the development phase only, as standard SD cards aren't reliable for long-term use. Toradex provides the following alternatives:

  • For simple installations of bootable images, Toradex recommends using Toradex Easy Installer;
  • For offline and/or isolated systems, Toradex Easy Installer provides an offline installation procedure;
  • For resource-scarce systems, Toradex addresses the limitation by equipping all modules with NAND-based internal storage;
  • As an alternative for development and testing environments, boot from a TFTP/NFS Server.
Send Feedback!