Timesys Getting Started Guide for NovTech NOVPED


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 NovTech NOVPED.

Prerequisites

Host Requirements

To properly boot the NovTech NOVPED 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) 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 NovTech NOVPED, you will need the following items:

  • NovTech NOVPED
  • SD Card
  • 6-Pin Header to USB Cable

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

  1. Connect the 6-Pin to USB Cable to the 6-pin J16 header, located near the HDMI port. The ground (the black wire) should go near the J16 label, which is the pin nearest the middle of the board and furthest from the seven switches.
  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.

Preparing the Target

Configuring Serial Communication

The NOVPED 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

Most SD cards contain a Windows FAT partition by default. Unfortunately, since FAT does not support UNIX-style permissions or device nodes, it is not possible to use this file system as the root partition. You must use the fdisk tool to add a Linux partition, then format it using a standard Linux filesystem such as EXT4.

Creating a Linux Partition

You will use the fdisk tool to partition your SD card. Please note that all data on the card will be lost upon completion of these steps.

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.

Determine the device name of the SD Card. This can be done using dmesg. In the following example, the device is assumed to be /dev/sdb, which contains one partition sdb1.

$ dmesg | tail
[22332.784634] sd 7:0:0:0: [sdb] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB)
[22332.785496] sd 7:0:0:0: [sdb] Write Protect is off
[22332.785508] sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
[22332.786369] sd 7:0:0:0: [sdb] No Caching mode page present
[22332.786381] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[22332.796516]  sdb: sdb1
[22332.799727] sd 7:0:0:0: [sdb] No Caching mode page present
[22332.799738] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[22332.799746] sd 7:0:0:0: [sdb] Attached SCSI removable disk

Unmount the partition if it was automounted by using the umount command.

$ sudo umount /dev/sdb*

Next, find the size of your kernel uImage in MB.

$ du -h uImage-3.0-ts-armv7l
3.7M    uImage-3.0-ts-armv7l

As root, run the fdisk utility on the drive. The -H64, -S32, and -u=cylinders parameters are used to force partitions to be aligned to 1MB blocks. Depending on your host's version of fdisk, you may need to omit -u=cylinders.

$ sudo fdisk -H64 -S32 -u=cylinders /dev/sdb

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 0xf10ac982.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Create a new primary partition using the n command. You will need to leave space for U-Boot and the kernel image before the start of the partition. Take your uImage size in MB, round up, and add 1 to get your First cylinder. Example for 3.7MB uImage:

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 cylinder (2-7580, default 2): 5
Last cylinder, +cylinders or +sizeK,M,G (5-7580, default 7580):
Using default value 7580

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: 7948 MB, 7948206080 bytes
64 heads, 32 sectors/track, 7580 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4610124b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               5        7580     7757824   83  Linux

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.
Syncing disks.

Writing the Bootloaders, Kernel, and RFS to the Card

Format the SD card with an EXT4 filesystem using the mkfs.ext4 tool.

$ sudo /sbin/mkfs.ext4 /dev/sdb1

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/sdb1 /mnt

Copy U-Boot and the kernel image to the SD card:

$ sudo dd if=u-boot.bin of=/dev/sdb seek=2 skip=2 bs=512
841+1 records in
841+1 records out
430824 bytes (431 kB) copied, 0.0669761 s, 6.4 MB/s
$ sudo dd if=uImage of=/dev/sdb seek=2048 bs=512
7377+1 records in
7377+1 records out
3777204 bytes (3.8 MB) copied, 1.14712 s, 3.3 MB/s

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

$ sudo tar xzf rootfs.tar.gz -C /mnt

Unmount the card before removing it from the Development Host. Then place the card in the SD1 slot on the NOVPED.

$ sudo umount /dev/sdb*

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 located in slot SD1 (next to the Ethernet on top of the board). This is done with the setenv and saveenv commands in U-Boot. Take the size of your uImage file in MB, rounded up, and multiply it by 0x800, which is the number of bytes in a MB. This number will be the size of the uImage read from the SD card. Specifying too much data will not hurt anything, but too little will. By specifying the size rounded up to the nearest whole MB boundary, you allow yourself the ability to update your uImage without having to update the environment. For example, for a 4MB kernel, one should specify a size of (4 * 0x800 =) 0x2000 bytes. On the target, set the following environment variables:

Variable Value
bootargs console=ttymxc0,115200 ip=none root=/dev/mmcblk0p1 rootwait rw video=mxcfb0:dev=lcd,FUSION_70z7,800x480,if=RGB24
bootcmd mmc dev 1; mmc read 10800000 0x800 0x2000; bootm

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

Example

> setenv bootargs 'console=ttymxc0,115200 ip=none root=/dev/mmcblk0p1 rootwait rw video=mxcfb0:dev=lcd,FUSION_70z7,800x480,if=RGB24'
> setenv bootcmd 'mmc dev 1; mmc read 10800000 0x800 0x2000; bootm'
> saveenv

Load The Kernel

You can use the mmc subsystem to load the kernel from the SD card.

Example

> mmc dev 1
mmc1(part 0) is current device
> mmc read 10800000 0x800 0x2000

MMC read: dev # 1, block # 2048, count 8192 ... 8192 blocks read: OK

Boot the Kernel

The bootm command is used to boot the kernel from memory. Use it to boot the file that was loaded by the mmc read command.

Example

> bootm 10800000
## Booting kernel from Legacy Image at 10800000 ...
   Image Name:   Linux-3.0-ts-armv7l
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3842456 Bytes =  3.7 MB
   Load Address: 10800000
   Entry Point:  10800000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Additional Information

Displays

The NOVPED 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:

  • Future Electronics LCD: video=mxcfb0:dev=lcd,FUSION_70z7,800x480,if=RGB24
  • HDMI: video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24

The NOVPED 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: lcd
  • HDMI: hdmi

Typical values for different display HW interface formats:

  • Future Electronics LCD: RGB24
  • HDMI: RGB24

For a full list of display formats, visit the build_armv7l-timesys-linux-<libc>/linux-3.0-ts-armv7l/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:

  • 800x480 Future Electronics LCD
  • Full HD Asus HDMI Display

Factory Documentation