Project

General

Profile

Building SD Card Image

This page will describe how Critical Link has setup the SD card that ships with our MitySOM-5CSx family of development kits. This setup is a bit different than how Altera has structure their SD card image. Our uboot has been setup to use the structure that will be outlined here.

SD Card Structure

The following is the structure that Critical Link uses, this is what our u-boot is setup by default to use.

The SD Card has 3 partitions:
  1. An ext3 parition that is currently unused but can be mapped into linux on boot
  2. An ext3 parition that holds the root file system, kernel (uImage), device tree (.dtb), user application, and FPGA image (.rbf)
  3. A custom parition A2 that holds u-boot and the preloader

The two ext3 partitions can be changed if need be, u-boot supports loading the kernel and dts from either ext or fat partitions.

Development Kit SD Card Image

Models SD Card Image FPGA/Bootloaders Binaries
5CSE-H4-3YA 5CSE-H4-3YA SD Card 5CSE-H4-3YA Binaries
5CSE-H4-8YA 5CSE-H4-8YA SD Card 5CSE-H4-8YA Binaries
5CSE-L2-3Y8 5CSE-L2-3Y8 SD Card 5CSE-L2-3Y8 Binaries
5CSX-H5-4YA 5CSX-H5-4YA SD Card 5CSX-H5-4YA Binaries
5CSX-H6-42A 5CSX-H6-42A SD Card 5CSX-H6-42A Binaries
5CSX-H6-4YA 5CSX-H6-4YA SD Card 5CSX-H6-4YA Binaries
5CSX-H6-53B 5CSX-H6-53B SD Card 5CSX-H6-53B Binaries

Once you have the zip file downloaded for your module extract it and the output should include a "sd_image_mitysom_XXXX-XX-XXX_dev_kit.bin file. Simply use the instructions in the "Writing the SD card Image to an SD card" section below to use the .bin file to generate a complete Dev Kit SD card.

Creating a SD Card Image

The following script will create an binary image that can be written to a SD card: make_sd_image

This script is meant to be run on a linux machine with root priviledges. It also expects to have the preloader(preloader-mkpimage.bin), u-boot(u-boot.img), and u-boot environment(ubootenv.bin) images in the same directory. The root file system tar ball needs to be supplied as the first argument.

For example:
I have a directory with:
  • The script
  • my built preloader, named preloader-mkpimage.bin
  • my built u-boot, named u-boot.img
  • my built u-boot environment binary blob, named ubootenv.bin
  • a tar ball of my root file system with my compiled dtb and kernel in the /boot directory, called rootfs.tar.gz

To run the script I do:

sudo ./make_sd_image rootfs.tar.gz

This then creates a binary called mitysom5csx_devkit.img

Writing the SD Card Image to the SD Card

Writing the image to the SD card can be done in either linux or windows.

For Windows:
Download and use the Win32 Disk Imager


For Linux:

Note: In the commands shown below the x in sdx should be replaced with the letter your SD card was enumerated as

Prior to writing the image ensure that your SD card is unmounted:

sudo umount /dev/sdx*

Note: The * is to ensure all partitions are unmounted

Use the dd command to write the image:

sudo dd if=mitysom5csx_devkit.img of=/dev/sdx bs=1M
sync

If you want to see progress while writing, you can try:

sudo sh -c "pv mitysom5csx_devkit.img | dd of=/dev/sdx" 
sync

Updating U-Boot on an existing SD Card

To update uboot you need to dd the image over as the partition that contains this file does not utilize a filesystem. To do this first you need a build u-boot image file. Then in a terminal use dd to write the files to the proper partition shown of your Dev Kit SD card.

Note that you need to confirm that you are writing to your SD card and not another drive on your system. You can confirm this with either viewing the "df" command output or using the "Disk Utility" GUI and confirming your SD card (reader) device (I.E. /dev/sdd). You can view your drive partitions in Linux using the "sudo fdisk -l" command.

Replace the 'X' shown in the command below with your drive letter:

sudo dd if=u-boot.img of=/dev/sdX3 bs=64k seek=4

Updating the preloader on an existing SD Card

To update the preloader you need to dd the image over as the partition that contains this file does not utilize a filesystem.

Note that you need to confirm that you are writing to your SD card and not another drive on your system. You can confirm this with either viewing the "df" command output or using the "Disk Utility" GUI and confirming your SD card (reader) device (I.E. /dev/sdd). You can view your drive partitions in Linux using the "sudo fdisk -l" command.

Replace the 'X' shown in the command below with your drive letter:

sudo dd if=preloader-mkpimage.bin of=/dev/sdX3 bs=64k seek=0

Updating the Uboot Environment on an existing SD Card

To update the Uboot Environment you need to dd the image over as the partition that contains this file does not utilize a filesystem.

Note that you need to confirm that you are writing to your SD card and not another drive on your system. You can confirm this with either viewing the "df" command output or using the "Disk Utility" GUI and confirming your SD card (reader) device (I.E. /dev/sdd). You can view your drive partitions in Linux using the "sudo fdisk -l" command.

Replace the 'X' shown in the command below with your drive letter:

sudo dd if=ubootenv.bin of=/dev/sdX bs=512 seek=1

make_sd_image - SD Card Image Creation Script (1.83 KB) Daniel Vincelette, 07/08/2014 12:09 PM

Add picture from clipboard (Maximum size: 2 GB)