U-Boot

Support for sunxi devices is increasingly available from upstream U-Boot. This page describes that support. We have a separate page for the 'legacy' sunxi branch of U-Boot.

= Status =

The current U-Boot release (v2016.09) fully supports major functions (except NAND) on all the older Allwinner SoCs (A10/A10s/A13/A20/A23/A31/A31s) and has basic support for the more recent A33, A80, H3 and A64.

The next release will be v2016.11.

See also: U-Boot Release Cycle and Release Schedule.

In Progress

 * A83T USB support (WiP: Chen-Yu Tsai (wens)) patch-rfc
 * A83T PSCI support (WiP: Timothy Pearson) patch-rfc
 * H3 HDMI Support (WiP: Jelle van der Waa (jelle) ) git-repo
 * H3/A83T/A64 EMAC Ethernet support (WiP: Amit Tomar) patch-rfc (Recently broken)
 * H5 Orange Pi PC 2 boot support (WiP: (apritzel) git-repo

Next Release
Development branch

v2016.11
v2016.11 Release branch


 * Hans de Goede and Ian Campbell step down as U-boot Sunxi maintainers


 * A80
 * Full SPL support


 * A64
 * USB support


 * H3
 * DRAM impedance calibration fixes


 * Boards
 * FriendlyARM NanoPi NEO
 * Sinlinx SinA33
 * USB host and OTG support
 * Cubietech Cubieboard4

v2016.09
v2016.09 Release branch


 * General
 * GPIO fixes
 * PSCI rewrite in C part 2
 * NAND controller driver


 * H3
 * EMAC support fixes


 * Boards
 * Empire Electronix M712
 * Inet Q972
 * Olimex A33-OLinuXino
 * Xunlong Orange Pi PC Plus
 * Xunlong Orange Pi Plus 2E

v2016.07
v2016.07 Release branch


 * AXP809 PMIC support


 * PSCI rewrite in C part 1


 * Boards
 * Allwinner R16 EVB
 * Inet 86dz
 * Polaroid MID2407PXE03

v2016.05
v2016.05 Release branch


 * A23
 * Support new revisions


 * A64
 * 64-bit ARMv8 port, basic support (MMC, UART, no USB, no Ethernet)
 * (basic) EFI support (allows booting EFI applications (like grub) or kernels)


 * I2C support fix for families with separate reset control


 * SID e-fuse support for A83T and H3


 * Sync up dts files with Linux kernel
 * Update compatible strings for GPIO


 * Boards
 * colorfly e708 q1, Difrence DIT4350, Polaroid MID2809PXE4, Cubietruck Plus, Itead Ibox, icnova-a20-swac, Sinlinx SinA31s, yones toptech bs1078-v2, Dserve DSRV9703C, Orange Pi 2, Pine64

v2016.03
v2016.03 Release branch


 * PRCM i2c support


 * A83T
 * LPDDR3 support


 * H3
 * USB host support
 * PSCI (security switches included)
 * sy8106a i2c-based regulator support


 * AXP PMICs
 * Power off support


 * Boards
 * Banana Pi M3 (SinoVoip BPi-M3)

v2016.01
v2016.01 Release branch
 * sun8i-H3 support


 * Boards
 * Empire Electronix D709 tablet
 * A83T HomletV2 Board
 * Lamobo R1
 * Xunlong Orange Pi Plus
 * Xunlong Orange Pi PC
 * C.H.I.P.

v2015.10
v2015.10 Release branch


 * Console/display output
 * ANX9804 LCD-eDP bridge chip support
 * Composite video output support


 * NAND SPL driver


 * Boards
 * Olimex A20-SOM-EVB
 * A10s-Wobo-i5 (settop box)
 * Point of View pov protab2-ips9 tablet
 * Auxtek-T003 HDMI stick
 * A10 tablets based on the iNet-tek iNet-1 mainboard (e.g. Point of View Protab2 XXL, Cherry M1007)
 * A10 tablets based on the inet9f-rev03 mainboard (e.g. qware tb-g100 tablet)
 * A13 tablets based on on the inet98v_rev2 mainboard
 * A10 tablets based on the inet97fv2 mainboard
 * A23 tablets based on the gt90h-v4 mainboard

v2015.07
v2015.07 Release branch


 * Serial number support
 * Device model support
 * Ethernet
 * GPIO
 * sun8i (A33) support (including SPL)
 * sun9i (A80) basic support
 * UART
 * MMC
 * sun6i/sun8i
 * PSCI CPU hotplugging
 * SPL
 * NAND support reverted: Revert commit


 * Boards:
 * Mixtile LOFT-Q
 * Ainol AW1
 * Yones Toptech BD1078
 * iNet 3W
 * iNet 3F
 * ET-Q8 A33
 * Ippo q8h v1.2 A33 1024x600
 * ga10h v1.1
 * Merrii A80 Optimus Board

v2015.04
v2015.04 Release branch


 * sun7i (A20) PSCI CPU hotplug
 * sun8i (A23) SPL
 * RSB
 * AXP223


 * sun9i (A80) basic support
 * Clocks
 * RSB


 * Console/display output
 * VGA via internal DAC
 * VGA via external DAC on LCD interface
 * LVDS
 * SSD2828 MIPI bridge
 * tl059wv5c0 LCD panel


 * USB OTG


 * Boards:
 * CSQ CS908
 * Merrii Hummingbird A31
 * Ippo q8h v1.2
 * MSI Primo81
 * MSI Primo73
 * LinkSprite pcDuino
 * LinkSprite pcDuino V2
 * LeMaker Banana Pro
 * Rikomagic mk802
 * Rikomagic mk802ii
 * Semitime g2 (See also Format_MK802 with A10s)
 * MarsBoard A10
 * Gemei G9
 * Chuwi V7 CW0825
 * Mele M5
 * Hyundai A7HD
 * LinkSprite pcDuino3 Nano
 * TZX-Q8-713B7
 * Inet 86vs
 * Ampe A76
 * Jesurun Q5
 * MK808C
 * Mele I7
 * Forfun Q88DB
 * Wits Pro A20 DKT
 * Xunlong Orange Pi
 * Xunlong Orange Pi Mini
 * Wexler TAB 7200

v2015.01
v2015.01 Release branch


 * sun6i (A31) processor support
 * P2WI
 * AXP221
 * SPL
 * GMAC
 * sun8i (A23) processor support (no SPL)
 * sun6i/sun8i reset support
 * Console/display output
 * HDMI only
 * simplefb


 * Boards:
 * Mele M3
 * Olimex A20-OLinuXino-Lime2
 * WITS Colombus Board
 * Mele M9

v2014.10
v2014.10 Release branch


 * AHCI (SATA)
 * sun4i (AKA A10) and sun5i (AKA A10s and A13) processors
 * EMAC Ethernet
 * AXP152 and AXP209 power controllers
 * EHCI USB
 * SMP support for sun7i via PSCI.


 * Boards:
 * LeMaker Banana Pi

v2014.07
v2014.07 Release branch
 * sun7i (AKA A20) processors
 * MMC
 * GMAC Ethernet
 * Boards:
 * Cubietech Cubietruck

= Supported Devices = Beware: some of the above might only be supported in the latest development version.

USB 1.x, USB keyboards
U-Boot v2015.07 and later shouldn't have problems supporting mixed USB 1.x/2.0 devices. OHCI and EHCI no longer conflict with each other (after the switch to device model).

Previous U-Boot versions (v2015.04 and older) have a problem supporting both USB 1.x (OHCI) and USB 2.0 (EHCI) at the same time - the latter includes the SUNXI_EHCI driver for Allwinner boards.


 * Unfortunately, this also affects many USB HID / keyboard devices which would not be detected properly by U-Boot. The typical message in this case is "cannot reset port N!?", where N is whichever USB port those devices were attached to.

See: http://lists.denx.de/pipermail/u-boot/2015-January/200162.html.

= Compile U-Boot =

Get a toolchain
If you haven't done so before, get a suitable toolchain installed and added to your PATH.

Get the Device-tree Compiler
This program is usually called dtc. You can retrieve a standalone version, or install a distribution-provided package (see below for some examples).

If you are going to build a Linux kernel alongside U-Boot, it might also be worth to examine the kernel sources - as they come with dtc included under.

For Gentoo
emerge dtc

For openSUSE
zypper install dtc

For Debian/Ubuntu
apt-get install device-tree-compiler

Clone the repository
You can clone the u-boot repository by running: git clone git://git.denx.de/u-boot.git

Determine build target
Go to your u-boot tree and search in the directory configs/ for your board, the file name looks like _defconfig.

So, if your device is Cubieboard2 your build target is Cubieboard2_defconfig.

Build
When you have determined what  you want to build, configure: make CROSS_COMPILE=arm-linux-gnueabihf- _defconfig

There is also menuconfig to play with settings if you feel like it: make CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

Then just build it: make CROSS_COMPILE=arm-linux-gnueabihf-

(When compiling natively, omit the CROSS_COMPILE=… )

Boot
When the build has completed, there will be u-boot-sunxi-with-spl.bin available in your u-boot tree.

For getting these bits loaded onto the hardware, please refer to the respective howto:
 * SD Card
 * Howto for the experimental NAND support - http://lists.denx.de/pipermail/u-boot/2015-May/214959.html
 * SPI NOR Flash
 * USB OTG

For booting from sd with mainline u-boot, the recommended way is:


 * create a file boot.cmd on the first partition (also check Kernel arguments for extra 'bootargs' options):




 * Substitute zImage in place of uImage in the commands above, and then use the bootz command instead of bootm.


 * convert boot.cmd to boot.scr:

mkimage -C none -A arm -T script -d boot.cmd boot.scr


 * install U-Boot

dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8


 * copy kernel files to the first partition
 * For a 3.4 kernel you need uImage (linux kernel) and script.bin (binary representation of FEX).
 * For a device tree based kernel ("mainline", 4.x) you need the kernel image (uImage or zImage) and the device-specific .dtb file (the one referenced in the ${fdtfile} above) that is generated as part of your kernel compilation.

Look at Manual build howto for more details.

U-Boot 2015.07+ won't start
If you're using a recent (device model based) U-Boot, and the SPL just hangs after initializing the DRAM ( or something similar), chances are that your main U-Boot binary may be missing DTB information / a proper device tree. Depending on the (possibly outdated) instructions you followed: double-check that you're not incorrectly using u-boot.bin instead of u-boot-dtb.bin, or u-boot.img instead of u-boot-dtb.img.

Legacy kernel won't start

 * If your 3.4.x kernel refuses to boot / gets stuck right after "Starting kernel ...": Double-check that bootm_boot_mode is set to "sec"! (see above)
 * If you don't have a serial console and only use VGA/HDMI/LCD, then it might be also the case of "Unrecognized/unsupported machine ID" (see below).

Unrecognized/unsupported machine ID
The sunxi-3.4 kernel may fail to boot with one of the following error messages on the serial console (but this message is not visible on a HDMI monitor or a LCD display!): Error: unrecognized/unsupported machine ID (r1 = 0x10001008). Error: unrecognized/unsupported machine ID (r1 = 0x1000102a). Error: unrecognized/unsupported machine ID (r1 = 0x100010bb). In this case either upgrade to a recent stage/sunxi-3.4 kernel (github branch) - or try to "Enable workarounds for booting old kernels" in U-Boot:
 * or, the option is located under "ARM architecture". (Make sure to rebuild your U-Boot after changing it.)

If upgrading to stage/sunxi-3.4 is not an option (i.e. using some old and very much diverged sunxi-3.4 fork is really necessary), then the following patches can be cherry-picked (= selectively merged as a set ): wget https://github.com/linux-sunxi/linux-sunxi/commit/5052b83aa44dc16d6662d8d9d936166c139ad8c5.patch wget https://github.com/linux-sunxi/linux-sunxi/commit/9a1cd034181af628d4145202289e1993c1687db6.patch wget https://github.com/linux-sunxi/linux-sunxi/commit/c4c4664ed1a2f35e54a33ae4e65f517721ff43b5.patch wget https://github.com/linux-sunxi/linux-sunxi/commit/ade08aa6e5249a9e75a97393e86c250b2bcb3ec8.patch wget https://github.com/linux-sunxi/linux-sunxi/commit/16b25a95327f45a995f6efcf3e9d83a414231af9.patch wget https://github.com/linux-sunxi/linux-sunxi/commit/dea62f21deb177053b84b15a519dff6c74d061d9.patch wget https://github.com/linux-sunxi/linux-sunxi/commit/d47d367036be38c5180632ec8a3ad169a4593a88.patch git am 5052b83aa44dc16d6662d8d9d936166c139ad8c5.patch git am 9a1cd034181af628d4145202289e1993c1687db6.patch git am c4c4664ed1a2f35e54a33ae4e65f517721ff43b5.patch git am ade08aa6e5249a9e75a97393e86c250b2bcb3ec8.patch git am 16b25a95327f45a995f6efcf3e9d83a414231af9.patch git am dea62f21deb177053b84b15a519dff6c74d061d9.patch git am d47d367036be38c5180632ec8a3ad169a4593a88.patch

= Configure U-Boot =

Please refer to our configuring U-Boot howto.

= Adding a new device to upstream U-Boot =

http://lists.denx.de/pipermail/u-boot/2014-December/199351.html

Failsafe DRAM settings, based on standard JEDEC timings
Each device has DRAM settings configured in its defconfig file in the U-Boot "configs" directory (here is an example for the Cubietruck board). The slow failsafe DRAM settings for an A10/A13/A20 device may look like:  +S:CONFIG_DRAM_CLK=360 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=4 +S:CONFIG_DRAM_TIMINGS_DDR3_800E_1066G_1333J=y

The settings from the Android firmware
Somewhat better settings can be retrieved by the meminfo tool from the stock Android or GNU/Linux system, provided by the device manufacturer. It still makes sense to test the reliability of the resulting DRAM configuration. Because some vendors are providing poor configuration for ZQ or EMR1, but nevertheless trying to optimistically set the DRAM clock speed too high.

Performance optimized DRAM settings
Tuning DRAM setting for each individual board can provide much better performance than the failsafe defaults. This involves trial and error testing of different settings using a tool until an optimal combination is found. The DRAM Controller page provides links to start researching this topic. This approach will be time consuming, so a satisfactory solution using one of the other approaches may be best to start with.

LCD Settings
There is a separate wiki page about configuring LCD in U-Boot.

= See also =
 * Mainline Kernel Howto