Create a Bootable MicroSD Card

 

Supported microSD Cards

Gumstix DuoVero COMs and Overo COMs support SD cards that comply with the SD Association's SD I/O Card Specification version 2.0, including SDHC cards.

In general, your microSD card must have a capacity of least 2.0 GB in order to flash an image. 

Prepare Your microSD Card

  1. On your development machine, insert your microSD card into the card reader. 

  2. Determine the device filename of your microSD card in the form sdX, where X is a letter assigned by your computer, using the following command:

    $ dmesg

    The device name will be in the fourth column between square brackets. E.g.,

    [ 23468.560268] sd 8:0:0:0: [sdb] 3862528 512-byte logical blocks: (1.97/1.84 GiB)
    [ 23468.562125] sd 8:0:0:0: [sdb] No Caching mode page present
    [ 23468.562128] sd 8:0:0:0: [sdb] Assuming drive cache: write through
    [ 23468.564871] sd 8:0:0:0: [sdb] No Caching mode page present
    [ 23468.564874] sd 8:0:0:0: [sdb] Assuming drive cache: write through
    [ 23468.564874] sdb: sdb1 sdb2 sdb3

    In this example, our microSD card has a device filename of sdb, and is 2 GB (1.97 GB) in size. When using the device filename in commands, always remember to use its full path, i.e., /dev/sdb. Note any output showing the filename with a numbered suffix (e.g., sdb1, sdb2 and sdb3 above) as you will need it in the next step.

    To automatically insert your device name in the following steps, enter the device filename as it appeared in the previous command's output, but without square brackets:

    Device name: 

    This will automatically add your device's full path for the rest of this stage in the Getting Started Guide.

  3. Mounted partitions on the drive have numbers after the device name and are shown on the last line of the dmesg output above. Unmount any mounted partitions on the attached device:

     $ sudo umount /dev/<DEVICE NAME>{1,2,3}

    where 1, 2, 3, are the numbers shown after the device name in the last line of your dmesg output. You can use as many as you need separated by commas.

    Partitions vs. Drives: In Linux, a physical block device such as a hard drive or an SD card appears in the /dev directory (e.g., /dev/sdb). This device file refers to the entire physical device.

    A single physical device can contain multiple individual partitions each with their own file system. These partitions also appear in the /dev directory under the same name, but include a suffix for the partition number (e.g., /dev/sdb1, which is partition #1 of the physical device sdb). Linux makes the file systems on these partitions available by mounting them to a directory in the existing file system. Removable devices are typically mounted to mount points in the /mnt or /media directories.

    In the above example, the physical device /dev/sdb has one partition, /dev/sdb1 which is mounted to the mount point /media/Portable.

  4. Additional Steps for Yocto Project or Angstrom Users

    Yocto Project or Angstrom users need to partition and format their microSD cards manually in order to flash an image.

    1. Your microSD card needs a special geometry to make the best use of its memory and to be accessible by the DuoVero or Overo boot ROM.

      Calculate the required number of cylinders for your particular card with the following steps:

      1. Find the size of your card in the output of the following command:

        $ sudo fdisk -l /dev/<DEVICE NAME>
        Disk /dev/<DEVICE NAME>: 2016 MB, 2016411648 bytes

        The card size is the bolded number above, and may vary depending on what size of card you use.

      2. Divide the card size in bytes by 255 heads, 63 sectors and 512 bytes per sector and round down to the nearest integer.

        Enter the size in bytes from the last step below:

        E.g., ÷ 255 ÷ 63 ÷ 512 → 245

        This is the number of cylinders needed for your drive's geometry.

    2. To use these images, your microSD card has to have two partitions: a FAT partition containing the boot files and a Linux partition containing the root file system. To create these partitions:

      1. Clean up any existing partition data:

        $ sudo dd if=/dev/zero of=/dev/<DEVICE NAME> bs=1024 count=1024
      2. Create the new partitions using sfdisk:

        $ sudo sfdisk -D -uM -H 255 -S 63 -C <NUMBER OF CYLINDERS FROM STEP 1.2> /dev/<DEVICE NAME>

        At the sfdisk prompt, type 0,64,0x0C,* followed by Enter to set up a 64 MB bootable FAT32 partition.

        At the following prompt, type 75,,,- followed by Enter to create the root filesystem partition.

        For the next two prompts, type 0,0,, followed by Enter. Make sure you do this twice.

        When prompted, type y + Enter to write the partition table.

      3. Finally, you must format the partitions. First, create the boot partition. Be sure to specify the number of the partition to format after /dev/<DEVICE NAME> (e.g., /dev/sdb1, /dev/sdb2):

        $ sudo mkfs.vfat -F 32 /dev/<DEVICE NAME>1 -n boot

        If your computer is missing the mkfs.vfat program, try installing the dosfsutils package and try again:

        $ sudo apt-get install dosfsutils

        Now create the Linux root filesystem partition:

        $ sudo mke2fs -j -L rootfs /dev/<DEVICE NAME>2
        

    Your microSD card is now ready to be flashed with the boot and root filesystem images.

Write the Images to microSD

Select Gumstix product line you are using:

DuoVero Series

  • Yocto Project

A complete Yocto Project installation consists of the following core files (actual filenames may differ slightly - use the name of the file you have downloaded):

FilenameFunction
rootfs.tar.bz2 A root file system. Rootfs.tar.bz2 has been used as a placeholder; this filename is usually something more like gumstix-xfce-image.duovero.tar.bz2.
uImage A kernel binary image.
u-boot.img A Das U-Boot bootloader binary image.
MLO An second-stage bootloader binary image.

These files are included in the Yocto Project download directories as individual files.

To install the images:

  1. Mount the partitions you created in the last step with the following commands:

    $ sudo mkdir /media/{boot,rootfs}
         Note: You only need to do this if you have not created these directories before.
    $ sudo mount -t vfat /dev/<DEVICE NAME>1 /media/boot
    $ sudo mount -t ext3 /dev/<DEVICE NAME>2 /media/rootfs
    
  2. Install the bootloader binary and Linux kernel binary image.

    MLO (the second-stage bootloader binary) must be copied before any other file.

    $ sudo cp MLO /media/boot/

    Next, copy the Das U-Boot bootloader binary and kernel image to the boot partition:

    $ sudo cp u-boot.img /media/boot/
    $ sudo cp uImage /media/boot/
  3. Expand the root file system archive onto the second partition:

    $ sudo tar -xjvf rootfs.tar.bz2 -C /media/rootfs
    $ sync
  4. Unmount the partitions:

    $ sudo umount /media/boot
    $ sudo umount /media/rootfs

Your bootable microSD card is now ready to use.

Overo and Verdex Pro Series

Select the set of instructions for the platform you chose in the last stage:

  • Linaro
  • Yocto ProjectAngstrom

The process of flashing a pre-built Linaro image is simple, but caution must be taken when specifying the device file.

The following commands will erase all partitions and data on your microSD card. Move any valuable data before proceeding.

  1. In a terminal, change to the folder where you downloaded the image.
  2. Extract the image you downloaded with this command:
    gunzip <IMAGE FILENAME>.gz

    This will extract the image to a file which usually has the same name, but without the .gz extension. This is the image you need to use.

  3. Use the following command to flash the image, ensuring that you use the correct device name and the filename for the expanded image:

    $ dd if=<IMAGE FILENAME> of=/dev/<DEVICE NAME>

    where <IMAGE FILENAME> is the image you extracted in the previous step and <DEVICE NAME> is the entire device name.

  4. It typically takes approximately one hour to flash an 8 GB Gumstix Linaro image, depending on the microSD card reader and card.

    The dd command does not display progress until it has finished running, but it is possible to force output with the following steps:

    1. Send a USR1 signal to the dd process with the following command:

      $ sudo kill -USR1 $(pgrep '^dd$')

      This does not stop the process, but rather displays the current progress

    2. It is possible to continuously display progress at specified intervals with the following command:

      $ sudo watch -n <INTERVAL IN SECONDS> kill -USR1 $(pgrep '^dd$')
  5. Alto35 expansion board users only: You will need to overwrite the MLO and u-boot.img files on your microSD card with the ones downloaded in step two. To do this:

    1. Mount the partition on your microSD card to a temporary directory (such as /mnt):
      sudo mount /dev/<DEVICE NAME>1 /mnt
    2. From the directory where you downloaded MLO and u-boot.img, copy the files, starting with MLO:
      sudo cp MLO /mnt/
      sudo cp u-boot.img /mnt/

Installing a Yocto Project or Angstrom image is slightly more complex than installing a Linaro image.

A complete Yocto Project or Angstrom installation consists of the following core files (actual filenames may differ slightly):

FilenameFunction
rootfs.tar.bz2 A root file system.
uImage A kernel binary image.
u-boot.img* A Das U-Boot bootloader binary image.
MLO* (or mlo-updated for Overo STORM COMs) An second-stage bootloader binary image for Overo COMs

These files are included in the Yocto Project and Angstrom download directories as individual files.

* Alto 35 expansion board users need a customized version of u-boot.img and MLO. Please see the previous step if you did not download these files.

To install the images:

  1. Mount the partitions you created in the last step with the following commands:

    $ sudo mkdir /media/{boot,rootfs}
         Note: You only need to do this if you have not created these directories before.
    $ sudo mount -t vfat /dev/<DEVICE NAME>1 /media/boot
    $ sudo mount -t ext3 /dev/<DEVICE NAME>2 /media/rootfs
    
  2. Install the bootloader binary and Linux kernel binary image.

    For Overo COMs only: MLO (the second-stage bootloader binary) must be copied first

    $ sudo cp MLO /media/boot/MLO

    Next, copy the Das U-Boot bootloader binary and kernel image to the boot partition:

    $ sudo cp u-boot.img /media/boot/u-boot.img
    $ sudo cp uImage /media/boot/uImage
  3. Expand the root file system archive onto the second partition:

    $ sudo tar -xjvf rootfs.tar.bz2 -C /media/rootfs
    $ sync
  4. Unmount the partitions:

    $ sudo umount /media/boot
    $ sudo umount /media/rootfs

Your bootable microSD card is now ready to use.

Pepper Single-Board Computer

  • Yocto Project

A complete Yocto Project installation consists of the following core files (actual filenames may differ slightly):

FilenameFunction
rootfs.tar.bz2 A root file system.
uImage A kernel binary image.
u-boot.img A Das U-Boot bootloader binary image.
MLO (or mlo-updated for Overo STORM COMs) An second-stage bootloader binary image for Overo COMs

These files are included in the Yocto Project download directories as individual files.

To install the images:

  1. Mount the partitions you created in the last step with the following commands:

    $ sudo mkdir /media/{boot,rootfs}
         Note: You only need to do this if you have not created these directories before.
    $ sudo mount -t vfat /dev/<DEVICE NAME>1 /media/boot
    $ sudo mount -t ext3 /dev/<DEVICE NAME>2 /media/rootfs
    
  2. Install the bootloader binaries and Linux kernel binary image.

    MLO (the second-stage bootloader binary) must be copied first

    $ sudo cp MLO /media/boot/MLO

    Next, copy the Das U-Boot bootloader binary and kernel image to the boot partition:

    $ sudo cp u-boot.img /media/boot/u-boot.img
    $ sudo cp uImage /media/boot/uImage
  3. Expand the root file system archive onto the second partition:

    $ sudo tar -xjvf rootfs.tar.bz2 -C /media/rootfs
    $ sync
  4. Unmount the partitions:

    $ sudo umount /media/boot
    $ sudo umount /media/rootfs

Your bootable microSD card is now ready to use.

Home Gumstix How To(s) Create a Bootable MicroSD Card