HOWTO Boot from SD Card on the TI AM3517 EVM

This document describes the method for booting a TI AM3517 EVM Board from a Secure Digital (SD) card.

Prerequisites

  • Kernel image built for the AM3517 EVM board (uImage-2.6.32-ts-armv7l), with MMC enabled in the kernel.
  • RFS built for the AM3517 EVM board (rootfs.tar.gz)
  • Secure Digital (SD) Card, 8MB or larger
  • SD Card reader for host computer
  • Root privileges on a modern Linux host machine

Preparing the SD Card

In order to boot consistently, the SD card must be formatted in a very specific way.

Partitioning the Card

  1. Connect the SD card to your host system. Many modern systems have SD card slots on the case, or you can purchase a USB SD Card Reader for around $15 US.
  2. Determine the device name of the SD Card. This can be done using dmesg. In the following example, the device is /dev/sdb, which contains one partition sdb1.
    $ dmesg | tail
    [88050.184080]    sd 4:0:0:0:    [sdb]  1990656 512-byte hardware sectors: (1.01 GB/972 Mi
    [88050.184821]    sd 4:0:0:0:    [sdb]  Write Protect is off
    [88050.184824]    sd 4:0:0:0:    [sdb]  Mode Sense: 03 00 00 00
    [88050.184827]    sd 4:0:0:0:    [sdb]  Assuming drive cache: write through
    [88050.185575]    sd 4:0:0:0:    [sdb]  1990656 512-byte hardware sectors: (1.01 GB/972 Mi
    [88050.186323]    sd 4:0:0:0:    [sdb]  Write Protect is off
    [88050.186325]    sd 4:0:0:0:    [sdb]  Mode Sense: 03 00 00 00
    [88050.186327]    sd 4:0:0:0:    [sdb]  Assuming drive cache: write through
    [88050.186330]      sdb: sdb1
    
  3. Unmount the partition if it was automounted by using the umount command.
    $ umount /dev/sdb1
  4. As root, run the fdisk utility on the drive.
    $ sudo fdisk /dev/sdb
  5. In fdisk, Delete the existing partition table and create a new one using the o command.
    Command (m for help): o
    Building a new DOS disklabel with disk identifier 0x8b025602.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won’t be recoverable.
    
  6. Create a new primary partition using the n command. Set it as partition 1, accept the default for the first cylinder, and set the last cylinder to +2M.
    Command (m for help): n
    Command action
       e    extended
       p    primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-240, default 1):
    Using default value 1
    Last cylinder, +cylinders or +sizeK,M,G (1-1015, default 1015): +2M
    
  7. Set the type of the first partition to FAT16 using the t command. The code for FAT16 is 6.
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 6
    Changed system type of partition 1 to 6 (FAT16)
    
  8. Create another new primary partition using the n command. Set it as partition 2, accept the defaults for both the first and last cylinders.
    Command (m for help): n
    Command action
       e    extended
       p    primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (3-1015, default 3):
    Using default value 3
    Last cylinder, +cylinders or +sizeK,M,G (3-1015, default 1015):
    Using default value 1015
    
  9. Verify that the partition table is correct by using the p command. It should look similar to the following:
    Command (m for help): p
    
    Disk /dev/sdb: 2030 MB, 2030043136 bytes
    63 heads, 62 sectors/track, 1015 cylinders
    Units = cylinders of 3906 * 512 = 1999872 bytes
    Disk identifier: 0x9fee7cf8
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1           2        3875    6  FAT16
    /dev/sdb2               3        1015     1978389   83  Linux
    
  10. This step will destroy all data on the SD Card - Write the partition table to the card using the w command.
    Command (m for help): w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    WARNING: If you have created or modified any DOS 6.x
    partitions, please see the fdisk manual page for additional
    information.
    Syncing disks.
    

Copying the kernel to the card

  1. Format the FAT16 partition using the mkfs.vfat tool:
    $ sudo mkfs.vfat /dev/sdb1
  2. Mount the partition. If you remove/reinsert the SD card reader, many modern Linux systems will automatically mount the card. Alternatively, you can use the mount command:
    $ mkdir /tmp/disk
    $ sudo mount /dev/sdb1 /tmp/disk
    
  3. Navigate to the mounted filesystem.
    $ cd /tmp/disk
  4. Copy your uImage file to the FAT16 partition on the SD card using the cp command.
    $ cp uImage-2.6.31-ts-armv7l ./
  5. Unmount the partition
    $ cd ..
    $ sudo umount /tmp/disk
    

Copying the root file system to the card

  1. Format the ext2 partition using the mkfs.ext2 command
    $ sudo mkfs.ext2 /dev/sdb2
  2. Mount the partition. If you remove/reinsert the SD card reader, many modern Linux systems will automatically mount the card. Alternatively, you can use the mount command:
    $ mkdir /tmp/disk
    $ sudo mount /dev/sdb2 /tmp/disk
    
  3. Navigate to the mounted filesystem.
    $ cd /tmp/disk
  4. Extract your filesystem to the partition using the tar command.
    $ sudo tar xzf ~/rootfs.tar.gz
  5. Leave the directory and unmount the filesystem.
    $ cd ..
    $ sudo umount /tmp/disk
    

Booting the board

Once the card is formatted properly and loaded with the Linux and bootloader images, you can now boot your board.

Preparing the hardware

  1. Remove the card from the SD card reader.
  2. Insert the card into the SD/MMC card slot (J14) on the bottom of the AM3517 EVM board.

Configuring Minicom

  1. Start minicom in configuration mode as root:
    $ minicom -o -s -w
  2. A menu of configuration should appear. Use the Down-arrow key to scroll down and select the Serial port setup option, and press Enter.
  3. Press A, and enter /dev/ttyS0 as the serial port. Press Enter.
  4. Set the Bps/Par/Bits option by pressing the letter E and using the next menu to set the appropriate values. Press the key that corresponds to the value 115200, then press Enter.
  5. Set Hardware flow control to No using the F key.
  6. Set Software flow control to No using the G key.
  7. Press Enter to return to the main configuration menu, and then press Esc to exit this menu.

Loading and running the kernel

  1. Reset the board. You should see the U-Boot initialization output in your Minicom session.
  2. Press any key to stop the autoboot process
  3. Set the kernel command line to mount the RFS from MMC
    setenv bootargs console=ttyS2,115200 root=/dev/mmcblk0p2 rw rootwait
  4. Initialize the MMC card
    mmc init
  5. Load the kernel from the MMC card into RAM
    fatload mmc 1:1 80300000 uImage-2.6.32-ts-armv7l
  6. Boot the kernel
    bootm 80300000

NOTE

To set up the board to always boot into the demo, execute the following instructions in U-Boot:

setenv bootargs console=ttyS2,115200 root=/dev/mmcblk0p2 rw rootwait
setenv bootcmd mmc init\; fatload mmc 1:1 80300000 uImage-2.6.32-ts-armv7l\; bootm 80300000
saveenv