During last couple of months, I see quite big interest in building products on A20 SoC. This chip can be bought for 6USD in quantity. Most important features are:

  • Dual-Core ARM Cortex-A7 (ARMv7)
  • Mali-400 MP2
  • HDMI, VGA and LCD
  • MMC and NAND
  • OTG and 2 Host ports

Tracking media related to low-end mobile market IMHO the hottest SoCs are Allwinner A20 and Rockchip RK3288.

A20 ship with dozen development boards like Cubieboard or pcDuino series, Banana Pi, MarsBoard or Hummingbird. About a year ago I choose to buy Cubietruck and this led to couple interesting projects from porting USBSniffer to writing bare-metal bootloader based on U-boot code. Below setup is not complicated but contain many pieces and looking for the correct procedure for each one is a headache. Especially I felt that when I did it once couple months ago and was not able to recover my setup without over a day of googling. Because I of that I decided to write this post and leave notes for me and others who want bootstrap Cubietruck setup.

Some configs and scripts can be found on github repo.


Table of contents


  • Linux development workstation (I use Debian stretch/sid)
  • USB to TTL serial adapter – best would be with original FT232RL, but Chinese substitutes also work
  • microSD card
  • Ethernet cable – to connect your CT to the router
  • good power supply 5V/2.5A – USB should also work when taking care of power budget of the whole setup
  • HDMI or VGA monitor – nice to have

General approach

Bootloader (U-Boot) obtain IP address dynamically then using hardcoded information about TFTP server it downloads script which contains instruction about next steps. Usually, next steps include downloading kernel over TFTP and passing to it parameter indicating that rootfs should be mounted over NFS and pointing to the server location.

Because different U-Boot scripts are required for sunxi-3.4 and mainline kernel I toggle config on tftp server.

Below I put together various pieces spread across the network to have it in one place.

Quick TFTP setup

To check if TFTP listen:

It would be useful to have separate directory if in future setup will be enhanced for other boards:

Quick NFS setup

Add line like this:

Create a directory for root filesystems:

Restart NFS:


I’m using Linaro toolchain based on GCC4.9 you can download package here.

To verify this step you can try:

U-Boot (2015.10-rc2)

To boot sunxi-3.4 setting ARM architecture -> Enable workarounds for booting old kernels is required.

Log like this:

means that you incorrectly set toolchain.

Linux kernel

sunxi-3.4 kernel

Ethernet driver has to be built-in, because when included as module do not start early enough to mount rootfs over NFS.


To generate MAC you can use this tool or you can give your Cubietruck MAC if you know it. One way to figure it out is to flash only U-boot and run

To generate script.bin:

Mainline kernel (sunxi-next 387a2c191af6 4.2.0-rc4)


Based on Olimex guide.

In this place, I prefer to use en_US.UTF-8 as a lingua franca of Linux world. Next, we will install a couple of tools that are almost always useful.

At this point, it is good to make a backup copy. Time-consuming but with very small output:

Let’s put it all together

Prepare SD card

Assuming your SD card is on /dev/sdc


Flash U-Boot image:

Format and mount boot partition:

Below script add flexibility to booting process by allowing the user to replace on server boot.scr. This makes Cubietruck able to dual boot sunxi-3.4 and mainline kernel. Please replace <my_tftp_server_ip> with your TFTP address.

Make U-Boot readable image:

Now you can put your SD card into Cubietruck.

Prepare NFS and TFTP content

Copy kernel and files required to boot:

Copy filesystem to NFS server directory:

Copy modules:

Create U-Boot scripts for sunxi and mainline

Sunxi script will look like this:

Make U-Boot readable image:

Mainline script will look like this:

Make U-Boot readable image:

Known issues

TFTP error: ‘Unsupported option(s) requested’ (8)

This problem was discussed here. You can fix it by changing TFTP TIMEOUT:

Recompile U-boot and flash it on SD card again.


You can boot to sunxi-3.4 kernel by simply:

And switch to mainline kernel using:

Hopefully above shell history drop is readable for you, most of above content can be googled – I just needed a place to store notes from scratchpad. If you hit some problems do not bother to ask in comments. If you like this post or think it can be helpful for others please share.

Thanks for reading.