Timesys Getting Started Guide for Critical Link MityARM-335x



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 Critical Link MityARM-335x.


Host Requirements

To properly boot the Critical Link MityARM-335x 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-3.1-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 Critical Link MityARM-335x, you will need the following items:

  • Critical Link MityARM-335x
  • SD Card
  • Serial NULL Modem Cable
  • Ethernet Crossover Cable or Ethernet hub/switch and Ethernet Patch Cables

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

  1. Connect the debug port of the board to the serial port of your workstation using the null modem cable.
  2. If you are using a cross-over cable, connect the Ethernet port of the board to the second Ethernet port of your workstation.
  3. Connect the power supply to your board.
  4. 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 mityarm_335x 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/ttyS0 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/ttyS0 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/ttyS0
/dev/ttyS0:         28358
# ps 28358
  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/ttyS0

Using GNU Screen

To quickly connect to a board using Gnu Screen, execute the following:
# screen /dev/ttyS0 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 FAT16 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 EXT2.

Creating a Linux Partition

You will use the fdisk tool to create two partitions on 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 /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 MiB)
[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 MiB)
[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

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

$ umount /dev/sdb1

As root, run the fdisk utility on the drive.

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

Create a new primary partition using the n command. The first partition will be a FAT partition for storing the kernel image. It need only be big enough to store the kernel image.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-123, default 1): 1
Last cylinder, +cylinders or +sizeK,M,G (1-10, default 10): +10M

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c

Create a second primary partiion using the n command. This partition will be a linux partition for storing the root filesystem. It will fill the rest of the SD card.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 2
First cylinder (3-123, default 3):
Using default value 3
Last cylinder, +cylinders or +sizeK,M,G (3-123, default 123):
Using default value 123

Set the bootable flag on the first partition:

Command (m for help): a
Partition number (1-4): 1

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/mmcblk0: 1019 MB, 1019215872 bytes                                    
255 heads, 63 sectors/track, 123 cylinders                                      
Units = cylinders of 16065 * 512 = 8225280 bytes                                
Disk identifier: 0xe4d1d93f                                                     
    Device Boot     Start         End      Blocks   Id  System             
/dev/sdb1  *            1           2       16033+   c  W95 FAT32 (LBA)
/dev/sdb2               3         123      971932+  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.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
Syncing disks.

Writing the Bootloaders, Kernel, and RFS to the Card

Format the first partition of the SD card with a FAT filesystem using the mkfs.vfat tool.

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

Format the second partition using an ext3 filesystem using the mkfs.ext3 tool.

$ sudo /sbin/mkfs.ext3 /dev/sdb2

Mount the partitions. 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 /media/vfat
$ sudo mount /dev/sdb2 /media/rfs

Copy the u-boot SPL and u-boot bootloader images into the vfat partition.

$ sudo cp MLO /media/vfat/
$ sudo cp u-boot.img /media/vfat/

Copy the kernel image into the vfat partition as a file named uImage.

$ sudo cp  uImage-3.1-ts-armv7l /media/vfat/uImage

As root, extract the rootfs.tar.gz archive to the ext3 partition.

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

Unmount both partitions before removing the card from the Development Host. Then place the card in the SD slot on the mityarm_335x .

$ sudo umount /dev/sdb1
$ sudo umount /dev/sdb2

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. On the target, set the following environment variables:

Variable Value
bootargs console=ttyO0,115200 root=/dev/mmcblk0p2 rw rootwait
bootcmd mmc rescan\; fatload mmc :1 0x82000000 uImage-3.1-ts-armv7l\; bootm 0x82000000


> setenv bootargs console=ttyO0,115200 root=/dev/mmcblk0p2 rw rootwait
> setenv bootcmd mmc rescan\; fatload mmc :1 0x82000000 uImage-3.1-ts-armv7l\; bootm 0x82000000
> saveenv

Load The Kernel

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


> mmc rescan
> fatload mmc :1 0x82000000 uImage-3.1-ts-armv7l
reading uImage-3.1-ts-armv7l

3008612 bytes read

Boot the Kernel

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


> bootm 0x82000000
## Booting kernel from Legacy Image at 0x82000000 ..
   Image Name:   Linux-3.1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3008548 Bytes =  2.9 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Additional Information

Factory Documentation