Timesys Getting Started Guide for Cubieboard



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


Host Requirements

To properly boot the Cubieboard 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.4-ts-armv7l), bootloader files, 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.
  • A SD card slot or adapter on your Development Host.

Target Requirements

To boot the Cubieboard, you will need the following items:

  • Cubieboard
  • TTL to USB serial cable
  • SD Card

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

  1. Connect the Cubieboard to the USB port of your workstation using a USB cable.
  2. 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 Cubieboard 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
[599432.899910] sd 22:0:0:0: [sdb] 7959552 512-byte logical blocks: (4.07 GB/3.79 GiB)
[599432.900663] sd 22:0:0:0: [sdb] Write Protect is off
[599432.900672] sd 22:0:0:0: [sdb] Mode Sense: 03 00 00 00
[599432.900678] sd 22:0:0:0: [sdb] Assuming drive cache: write through
[599432.903034] sd 22:0:0:0: [sdb] Assuming drive cache: write through
[599432.903047]  sdb: sdb1 sdb2
[599432.907913] sd 22:0:0:0: [sdb] Assuming drive cache: write through
[599432.907924] sd 22:0:0:0: [sdb] Attached SCSI removable disk
[599433.383224] EXT4-fs (sdb2): recovery complete
[599433.388385] EXT4-fs (sdb2): mounted filesystem with ordered data mode

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

$ umount /dev/sdb*

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-495, default 1): 5
Last cylinder, +cylinders or +sizeK,M,G (5-495, default 495): +5M

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

Create a second primary partition 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 (1-495, default 1): 10
Last cylinder, +cylinders or +sizeK,M,G (10-495, default 495):
Using default value 495

Set the bootable flag on the first partition:

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: 4075 MB, 4075290624 bytes
255 heads, 63 sectors/track, 495 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x56cd2aee

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               5           6       16065    c  W95 FAT32 (LBA)
/dev/sdb2              10         495     3903795   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 -n boot /dev/sdb1

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

$ sudo /sbin/mkfs.ext3 -L rootfs /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/boot
$ sudo mount /dev/sdb2 /media/rootfs

Transfer sunxi-spl.bin and u-boot.bin to the sd card.

$ sudo dd if=bootloader/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8
$ sudo dd if=bootloader/u-boot.bin of=/dev/sdb bs=1024 seek=32

Copy the kernel and script to the sd card.

$ sudo cp uImage-3.4-ts-armv7l /media/boot/uImage
$ sudo cp bootloader/script.bin /media/boot/

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

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

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

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

Preparing the Host

No additional host setup is required to boot from SD.

Booting the Board

Insert the sd card and then power on the board.

Additional Information

LVDS Display

Factory Documentation