Timesys Getting Started Guide for Freescale SABRE SDP


Contents

Introduction

This document will describe in detail the procedures for booting a Linux kernel image and mounting a root file system from an SD Card on the Freescale SABRE SDP.

Prerequisites

Host Requirements

To properly boot the Freescale SABRE SDP using software from Timesys, your host machine must meet the following requirements:

  • Modern GNU/Linux Distribution. Timesys recommends one of the following distributions:
    • Ubuntu (Most recent release or LTS)
    • Fedora (Most recent release)
  • Root or sudo permission on the Development Host.
  • A copy of the Linux Kernel (uImage-4.9-ts-armv7l) and Root File System (rootfs.tar.gz) for the Target Board downloaded from Factory. These are found in the output directory of your online build, or in the directory build_armv7l-timesys-linux-<libc>/images/ on the command line.
  • An available USB port on your Development Host.
  • A SD card slot or adapter on your Development Host.

Target Requirements

To boot the Freescale SABRE SDP, you will need the following items:

  • Freescale SABRE SDP
  • SD Card
  • Micro USB Cable

Once you have all of the necessary components, you should perform the following steps:

  1. Connect the "USB TO UART" port of the board to a USB port of your workstation using the Micro USB Cable.
  2. Connect the power supply to your board.
  3. Set aside the SD card, you will need to intialize it from the Development Host before booting the board.
  4. Set the boot switches located near the Freescale logo on the board. For SD boot, switches 2 and 7 should be ON, and the rest OFF.

Preparing the Target

Configuring Serial Communication

The SABRE SDP uses a serial debug port to communicate with the host machine. The commands discussed in this section are meant to be performed by a privileged user account. This requires the root login or prepending each command with sudo.

Using Minicom

  1. Start minicom on your host machine 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. Verify that the listed serial port is the same one that is connected to the target board. If it is not, press A, and enter the correct device. This is /dev/ttyUSB0 on most Linux distributions.
  4. Set the Bps/Par/Bits option by pressing the letter E and using the next menu to set the appropriate values. You 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.
  8. Reset the board, and wait for a moment. If you do not see output from the board, press Enter several times until you see the prompt. If you do not see any output from the board, and have verified that the serial terminal connection is setup correctly, contact your board vendor.

TIP: If you experience an error similar to Device /dev/ttyUSB0 is locked when starting minicom, it usually means that another process is using the serial port (which is usually another instance of minicom). You can find the process that is currently using the serial port by executing the following:

# fuser /dev/ttyUSB0
/dev/ttyUSB0:         28358

# ps 28358
  PID TTY      STAT  TIME COMMAND
  28923 pts/0    S+    0:00 minicom

This process can also be killed directly with fuser as root. Please use this command with caution:

# fuser -k /dev/ttyUSB0

Using GNU Screen

To quickly connect to a board using Gnu Screen, execute the following:

# screen /dev/ttyUSB0 115200

For more information about using screen, please consult the man page, or view the manual online at http://www.gnu.org/software/screen/manual/screen.html

Preparing the Secure Digital Card

The SABRE SDP boots from an SD card. Some kits may be shipped with one that contains a sample kernel and RFS preloaded. We will be replacing these with the kernel and RFS from Factory. If you are using a blank SD card or have trouble replacing the software on the preloaded one, see Partitioning the SD Card. Otherwise, skip directly to Writing Boot Files to the SD Card.

Before you begin, you should determine the name of your SD card on your host system. To do so:

  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/sdX, which contains one partition sdX1.

    $ dmesg | tail
    [88050.184080] sd 4:0:0:0: [sdX] 1990656 512-byte hardware sectors: (1.01 GB/972 MiB)
    [88050.184821] sd 4:0:0:0: [sdX] Write Protect is off
    [88050.184824] sd 4:0:0:0: [sdX] Mode Sense: 03 00 00 00
    [88050.184827] sd 4:0:0:0: [sdX] Assuming drive cache: write through
    [88050.185575] sd 4:0:0:0: [sdX] 1990656 512-byte hardware sectors: (1.01 GB/972 MiB)
    [88050.186323] sd 4:0:0:0: [sdX] Write Protect is off
    [88050.186325] sd 4:0:0:0: [sdX] Mode Sense: 03 00 00 00
    [88050.186327] sd 4:0:0:0: [sdX] Assuming drive cache: write through
    [88050.186330]  sdX: sdX1

Partitioning the SD card

If you want to use a different SD card or its contents become corrupted, you can use the fdisk tool to create a single Linux partition on your SD card. Please note that all data on the card will be lost upon completion of these steps.
  1. Unmount the partition if it was automounted by using the umount command.
    $ umount /dev/sdX1
  2. As root, run the fdisk utility on the drive.
    $ sudo fdisk /dev/sdX
  3. 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.
  4. Create a new primary partition using the n command. You will need to leave space for the U-Boot image before the start of the first partition. 2048 should be sufficient.

    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-30679039, default 2048): 2048
    Last sector, +sectors or +sizeK,M,G (2048-30679039, default 30679039):
    Using default value 30679039

  5. 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/sdX: 15.7 GB, 15707668480 bytes
    64 heads, 32 sectors/track, 14980 cylinders, total 30679040 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x6eaae8f8

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdX1            2048    30679039    14773960   83  Linux

  6. 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.

  7. Format the first partition of the SD card with the ext4 filesystem using the mkfs.ext4 tool.

    $ sudo /sbin/mkfs.ext4 -L rfs /dev/sdX1

Writing Boot Files to the SD Card

  1. Mount the partition. You can remove and reinsert the card to trigger the automount, or you can use the mount command to mount the partition to an arbitrary location.

    $ sudo mount /dev/sdX1 /media/rfs

  2. Copy U-Boot u-boot.imx to the SD card:

    $ sudo dd if=u-boot.imx of=/dev/sdX bs=512 seek=2
    841+1 records in
    841+1 records out
    430824 bytes (431 kB) copied, 0.0669761 s, 6.4 MB/s

  3. As root, extract the rootfs.tar.gz archive to the card.

    $ sudo tar xzf rootfs.tar.gz -C /media/rfs

  4. If you have included the kernel image in your rootfs, this next step is not necessary As root, create the boot directory on the RFS partition of the card.

    $ sudo mkdir /media/rfs/boot

  5. As root, copy the uImage file, uImage-4.9-ts-armv7l, to the boot directory on the RFS partition of the card.

    $ sudo cp uImage-4.9-ts-armv7l /media/rfs/boot/

  6. If using a 3.10 or newer kernel, you will need to copy the Device Tree Blob file, SABRE_SDP.dtb, to the boot directory on the RFS partition of the card.

    $ sudo cp SABRE_SDP.dtb /media/rfs/boot/

  7. Unmount the card before removing it from the Development Host. Then place the card in the SD3 slot on the SABRE SDP.

    $ sudo umount /dev/sdX*

  8. Remove the SD Card from the host machine, and insert it into the SD Card slot SD3 (located between HDMI and UART ports) on the target board. You should hear the card 'click' into place.

Preparing the Host

No additional host setup is required to boot from SD.

Booting the Board

Set Environment Variables

You must set a few environment variables in order to boot the board from the SD card. This is done with the setenv and saveenv commands in U-Boot.

Kernel 3.10 or newer

Variable Value
bootargs console=ttymxc0,115200 ip=dhcp root=/dev/mmcblk0p1 rootwait
bootcmd ext2load mmc 1:1 ${loadaddr} boot/uImage-4.9-ts-armv7l; ext2load mmc 1:1 ${fdt_addr} boot/SABRE_SDP.dtb; bootm ${loadaddr} - ${fdt_addr}
fdt_addr 0x18000000

NOTE: For the 3.14.28 Linux kernel or newer, use 'root=/dev/mmcblk2p1' in the bootargs environment variable.
NOTE: Your kernel load size must agree with the choice you made when partitioning the SD card, or the board will not boot.

Example

U-Boot > setenv bootargs 'console=ttymxc0,115200 ip=dhcp root=/dev/mmcblk0p1 rootwait'
U-Boot > setenv bootcmd 'ext2load mmc 1:1 ${loadaddr} boot/uImage-4.9-ts-armv7l; ext2load mmc 1:1 ${fdt_addr} boot/SABRE_SDP.dtb; bootm ${loadaddr} - ${fdt_addr}'
U-Boot > saveenv

Kernel 3.0

Variable Value
bootargs console=ttymxc0,115200 ip=dhcp root=/dev/mmcblk0p1 rootwait
bootcmd ext2load mmc 1:1 ${loadaddr} boot/uImage-3.0-ts-armv7l; bootm ${loadaddr}

NOTE: Your kernel load size must agree with the choice you made when partitioning the SD card, or the board will not boot.

Example

U-Boot > setenv bootargs 'console=ttymxc0,115200 ip=dhcp root=/dev/mmcblk0p1 rootwait'
U-Boot > setenv bootcmd 'ext2load mmc 1:1 ${loadaddr} boot/uImage-3.0-ts-armv7l; bootm ${loadaddr}'
U-Boot > saveenv

Load The Kernel

You can use the ext2load command to load the kernel from the SD card.

Example

U-Boot > ext2load mmc 1:1 ${loadaddr} boot/uImage-4.9-ts-armv7l
5262664 bytes read in 371 ms (13.5 MiB/s)

Load The DTB (Kernels 3.10 or newer only)

You can use the ext2load command to load the DTB from the SD card.

Example

U-Boot > ext2load mmc 1:1 ${fdt_addr} boot/SABRE_SDP.dtb
47179 bytes read in 134 ms (343.8 KiB/s)

Boot the Kernel

The bootm command is used to boot the kernel. It loads the file that was previously loaded using the mmc read command.

Example

Kernel 3.10 or newer

U-Boot > bootm ${loadaddr} - ${fdt_addr}
## Booting kernel from Legacy Image at 12000000 ...
   Image Name:   Linux-4.9-ts-armv7l
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5262600 Bytes = 5 MiB
   Load Address: 10008000
   Entry Point:  10008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 18000000
   Booting using the fdt blob at 0x18000000
   Loading Kernel Image ... OK
OK

Kernel 3.0

U-Boot > bootm ${loadaddr}
## Booting kernel from Legacy Image at 12000000 ...
   Image Name:   Linux-3.0-ts-armv7l
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5262600 Bytes = 5 MiB
   Load Address: 10008000
   Entry Point:  10008000
   Verifying Checksum ... OK
OK

Additional Information

Displays

The SABRE SDP supports multiple display configurations. The displays are enabled on the kernel command line at boot time.

Configure each display with a video variable and a mxcfbx argument in your bootargs, replacing x is a 0 (primary) or 1 (secondary) to correspond to which display you wish to be primary:

  • Hannstar LVDS (built in panel): video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666 ldb=sin1
  • CLAA WVGA LCD: video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB565
  • HDMI: video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24

The SABRE SDP sends a video signal to each output that has a video variable specified. Parameters following the mxcdfb argument specify the color and sizing of the attached display.

Typical values for dev= are:

  • LCD Interface: lcd
  • LVDS: ldb
  • HDMI: hdmi

Typical values for different display HW interface formats:

  • Hannstar LVDS: RGB666
  • CLAA WVGA LCD: RGB565
  • HDMI: RGB24

If you are using an LVDS display, add 'ldb=sin1' to use the LVDS1 connection on the back of the board, or leave this argument out to use the LVDS0 connection next to the USB OTG port.

For a full list of display formats, visit the build_armv7l-timesys-linux-<libc>/linux-4.9/drivers/video/mxc/ directory. Pay attention to these files:

  • tve.c: TV (Component) and VGA display formats. Do not reference vga.c for VGA.
  • ldb.c: LVDS display formats
  • mxcfb.c: generic display formats
  • Use grep in the directory for anything else

The following display(s) were tested by Timesys:

  • HDMI Display
  • 1024x768 Hannstar LVDS

Multiple Displays

The board can support two display connections at a time. This is accomplished by providing a video variable for both mxcfb0 and mxcfb1 on the kernel command line. Typically, graphical applications will use the device marked as 'mxcfb0' as the primary display.

Example

HDMI (primary display), and LVDS Panel (secondary display)

video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 video=mxcfb1:dev=ldb,LDB-XGA,if=RGB666 ldb=sin1

Factory Documentation