Booting From Usb Otg Port
Here we provide a simple way to boot linux from USB OTG port. It's very useful when our
system get damaged somehow. We may be able to fix it by accessing to the storeage, e.g. nand,
sata, or SD Card, and making some repair to the config or filesystem.
Host Enviroment
Ubuntu 12.04 x86_64
Download all we need
$wget http://dl.cubieboard.org/software/a20-cubietruck/common/usbboot-
$tar -zxvf usbboot-fel.tar.gz
to check the md5sum(optional)
$wget http://dl.cubieboard.org/software/a20-cubietruck/common/usbboot-
$ md5sum usbboot-fel.tar.gz
f09f92833dc419207c7c9cd71ad65cc4 usbboot-fel.tar.gz
$ cat usbboot-fel.tar.gz.md5
f09f92833dc419207c7c9cd71ad65cc4 usbboot-fel.tar.gz
Enter FEL Mode
FEL is a low-level subroutine containing in the BootROM on allwinner devices. It is used for
provisioning and recovery of devices using USB. When the chip goes to FEL mode, the chip will
be waiting for communication from PC though USB. The primary purpose for FEL is for
flashing the NAND with the PC tool LiveSuit. For more detailed please refer to FEL MODE
To enter FEL mode here:
1. Power off the device
2. Press and hold FEL key
3. Press and hold power key for about 2s (power on the device, when powering on, if a key is
pressed, the devices will not boot until key released)
After entering FEL mode, we suggest you to plug in AC adapter if you have SATA drive on
board, avoiding low current from USB.
Upload Images
$cd usbboot-fel

$ ./usb-boot ./u-boot-spl.bin ./u-boot.bin ./uImage ./script.bin
fel write 0x2000 ./u-boot-spl.bin
fel exe 0x2000
fel write 0x4a000000 ./u-boot.bin
fel write 0x41000000 ./bin/ramboot.scr
fel write 0x43000000 ./script.bin
fel write 0x44000000 ./uImage
fel write 0x4c000000 ./initramfs.img
fel exe 0x4a000000
 Setting GMAC
 default user and password
 Change to VGA output
$cd usbboot-fel/
$ ls
adb-devprobe.sh bin2fex fel fex2bin initramfs.img pio u-
boot.bin uImage
bin bootinfo fel-gpio fexc nand-part script.bin u-
boot-spl.bin usb-boot
./bin2fex script.bin 1.fex
fexc-bin: script.bin: version: 0.1.2
fexc-bin: script.bin: size: 46472 (85 sections)
vim 1.fex (here change the output type
./fex2bin 1.fex script.bin
Replace fel/usb-boot
The fel/usb-boot in this manual is X86_64bit version. If you want to use it under I386 or even
arm platform, you need to compile the tools by yourself. fel/usb-boot are part of sunxi-tools, and
the latest source code can be found at http://github.com/linux-sunxi/sunxi-tools.git.
 Getting Source Code
$git clone git://github.com/linux-sunxi/sunxi-tools.git
 Compiling
$cd sunxi-tools

and then replace the tools with the one you built
 Refer to http://github.com/hno/miniroot
See Also
 http://linux-sunxi.org/FEL
 http://linux-sunxi.org/FEL/USBBoot
Cb3 A20-android System Boot From Sata
Copy the System File
At first , connect Cubietruck by USB ,and open terminal:
$adb shell
So you will input the Android-Shell Command-Line,and see where the system file mounted:


You can see the block /dev/block/system mount on /system,
then you connect SATA with Cubietruck,and see what block is the SATA:
$ls /sys/devices/platform/sw_ahci.0/ata1/host0/target0:0:0/0:0:0:0/block
You will see the SATA block(maybe it's sdb, sdc or sdd,but it's no problem):

Now you know the block,use this command:
$dd if=/dev/block/system of=/dev/block/sda(Your SATA block)
Just wait for about 1 minutes,it will success:

Modify the SDK
After you copy the system file to SATA,you should modify SDK:
$cd /ct-droid1/android42/devices/softwinner/sugar-cubietruck/ && ls
$vim init.sun7i.rc
And "mount ext4 /dev/block/system" changes to "mount ext4 /dev/block/sda",like that:

Save and quit,complie the android image.If you don't konw how to complie,refer to here
After compile success,do this:
 Install the new image to Cubietruck.
 Connect the SATA first( must first! If you don't do this it wouldn't boot)
 Charge it with electricity,you will see it Boot from SATA.
Cb3 A20-install Nand Boot Android For
Install Livesuit or PhoenixSuit
All sunxi devices use LiveSuit as a default flasher and updater for retail customer and
PhoenixCard or PhoenixUSB for flashing when devices are manufactured. LiveSuit/Phoenix
protocol and data are closed-source standrad used by many companies and devices.

Please note that PhoenixSuit is actually LiveSuit2.0. There are different platform's PhoenixSuit
1. Windows
2. Linux i386
3. Linux x86_64
4. Mac
Please refer to the Livesuit/PhoenixSuit Installation Guide
Download Image
Assuming you are going to use ct-nand-v1.01-20140109.img
$wget http://dl.cubieboard.org/software/a20-cubietruck/android/ct-nand-
$gzip -d ct-nand-v1.01-20140109.img.gz

Press the FEL key when power up(the FEL key is the one under the USB OTG port), The CPU
automatically enters FEL mode. Livesuit will start to write the image to Nand on board.

Cb3 A20-compiling Android Image For
Download the source code
$mkdir cubietruck-android && cd cubietruck-android
$wget http://dl.cubieboard.org/software/a20-cubieboard/android/A20-android-
$tar -xvf A20-android-4.2.tar.xz
Compiling image
After get the source code,you could use common to build it as follow:
Build Linux kernel
$cd lichee/
$cp linux-3.3/arch/arm/configs/cubietruck_defconfig linux-
$./build.sh -p sun7i_android
Start Building:

Success Building:


Build Android image
$cd ../android42
$source build/envsetup.sh
$lunch 16 (select sugar_cubietruck-eng)
$make -j8
Finish building:

Pack Final image:
Pack success:

Install image
The final image is at /lichee/tools/pack/sun7i_android_sugar-cubietruck.img
You can use Livesuit to install it
Lubuntu Desktop/Server SD Card
Installation for Cubietruck
We may want to install lubuntu desktop/server to SD card, here is a guide for you. This guide is
for Linux platform only. We take Desktop as a example in this guide. If you are interested in
Server, just replace the images with server one.
 Any Linux environment, we want fdisk, dd, tar, wget commands
 An SD Card(at least 2GB)

We assume card=/dev/sdd here
Get Images
Name Desc URL
u-boot u-boot with spl download
bootfs uImage, uEnv.txt, script.bin download
rootfs rootfs download
Cleaning SD Card
$sudo dd if=/dev/zero of=${card} bs=1024 seek=544 count=128
Make Bootable SD Card
$sudo dd if=u-boot-sunxi-with-spl-ct-20131102.bin of=$card bs=1024 seek=8
$ sudo fdisk $card
Using the fdisk command to create 2 partitions on the SD Card, e.g.
 1st partitions start from 2048 sectors, 64MB in size
 2nd partitions just keep it all default
Show bellow
Device Boot Start End Blocks Id System
/dev/sdd1 2048 133119 65536 83 Linux
/dev/sdd2 133120 15278079 7572480 83 Linux
Also we recommend you to look at Bootable_SD_card
$sudo mkfs.ext2 ${card}1
$sudo mkfs.ext4 ${card}2

$mkdir /tmp/sdd1 /tmp/sdd2
$sudo mount -t ext2 ${card}1 /tmp/sdd1
$sudo mount -t ext4 ${card}2 /tmp/sdd2
$sudo tar -C /tmp/sdd1 -xvf bootfs-part1.tar.gz
$sudo tar -C /tmp/sdd2 -xvf rootfs-part2.tar.gz
$sudo umount /tmp/sdd1
$sudo umount /tmp/sdd2

Customizing ( optional )
Change your own kernel
Move Rootfs to Hard Drive
 Mount rootfs partitions
After login to lubuntu system on Cubietruck with linaro,
$sudo su - root --> change to root user
#mkdir /tmp/1 /tmp/target
#mount /dev/mmcblk0p2 /tmp/1
#mkfs.ext4 /dev/sda1
#mount /dev/sda1 /tmp/target
 Moving rootfs
#(cd /tmp/1; tar --backup -c *) |tar -C /tmp/target -xv
 Changing Kernel Parameters
#mount /dev/mmcblk0p1 /mnt/
#vi /mnt/uEnv.txt
(Change root=/dev/sda1)
So the file's content would like bellow
cat /mnt/uEnv.txt
extraargs=console=tty0 hdmi.audio=EDID:0
disp.screen0_output_mode=EDID:1280x720p50 rootwait panic=10 rootfstype=ext4
 Sync to disk, and reboot to your hard drive
#umount /mnt
After installing rootfs to SSD, we will get much more better experience.
 Performance (R:106MB/s, W: 148MB/s)
root@cubietruck:~# cat /sys/block/sda/device/model
root@cubietruck:~# dd if=/dev/sda2 of=/dev/null bs=1M count=10000
10000+0 records in
10000+0 records out
10485760000 bytes (10 GB) copied, 98.9637 s, 106 MB/s
root@cubietruck:~# dd if=/dev/zero of=/dev/sdb2 bs=1M count=5000

dd: writing `/dev/sdb2': No space left on device
913+0 records in
912+0 records out
956919808 bytes (957 MB) copied, 6.45456 s, 148 MB/s
VGA output
If we want to change to VGA output default, we need to modify the script.bin at the 1st partition
$bin2fex script.bin 1.fex
$vim 1.fex (and change screen0_output_type to 4)
$fex2bin 1.fex script.bin
Kernel Source
 http://github.com/cubieboard/linux-sunxi (cubie/sunxi-3.4 branch)
Wifi Module
Cubietruck have AP6210 wifi/bt module combo on board, to load the module,
#modprobe bcmdhd
Default User/Password