Sunxi-tools

= Building =

Prerequisites

 * libusb-1.0 (e.g. on a debian system do a apt-get install libusb-1.0-0-dev)
 * pkg-config

Repository
git clone https://github.com/linux-sunxi/sunxi-tools

Building
Those programs that need to run on the host will be built when you run: make

The programs meant for the device, are not built per default, and you need to name them explicitly. You might want to either use a the cross-compiler from your toolchain, or, since some of these tools are tiny, you can just as well build them on the target device.

= fexc and wrappers =

fexc is a small program which can convert, back and forth, from FEX to its binary representation and back. It comes with two shortcut programs which make it easier.

fexc
Usage: ./fexc [-vq] [-I ] [-O ] [ [ ]]

infmt: fex, bin  (default:fex) outfmt: fex, bin, uboot (default:bin)

When no arguments are provided, it waits on stdin. Similar, when no   is provided, it will dump to stdout. This is great for piping, but might mess up your terminal (type reset to have your terminal reset and make sense again).

bin2fex
This is a copy of fexc which takes a script.bin and dumps the .fex text.

fex2bin
This is a copy of fex which takes the .fex text file and dumps the binary.

= pio =

Manipulatee PIO settings (GPIO / pinmux config).

Can be used both on a file dump of the PIO registers for use by the fel-gpio script or natively on the device by direct mmap hardware acess.

= fel and helpers =

Fel is a means of talking to the Allwinner SoCs BROM over USB. You need to first active FEL mode on your device to be able to access it.

fel
Main program, which provides a script interface for talking to fel.

Usage: ./fel command arguments... [command...] hex[dump] address length	Dumps memory region in hex dump address length		Binary memory dump exe[cute] address		Call function address read address length file	Write memory contents into file write address file		Store file contents into memory ver[sion]			Show BROM version clear address length		Clear memory fill address length value	Fill memory

usb-boot
Script for booting via USB in FEL mode.

Usage: ./usb-boot u-boot-spl.bin u-boot.bin [boot.scr|-] [kernel script.bin [initramfs]]

u-boot-spl.bin and u-boot.bin are the u-boot binaries which are FEL enabled.

boot.scr is the u-boot script. Use - to use the default.

uImage is your compiled kernel image.

script.bin is your hw configuration converted to binary from .fex.

initramfs is an optional initramfs/initrd image in u-boot mkimage format.

fel-pio
Small binary which runs on the target. It enables IO register access over FEL mode. This should not be used directly.

fel-gpio
A script which used fel to upload fel-pio to the target, and which then can use the pio utility, and manipulate gpio settings, over fel/usb.

= fel-sdboot =

A small ARM native SD boot code which forces FEL mode, to boot straight into FEL mode without having to press any buttons.

= jtag-loop =

A small ARM native SD boot code which sets PF (CARD0) to JTAG mode and then busy-waits for you to attach with JTAG.

= bootinfo =

Dump information from Allwinner boot files (boot0/boot1) --type=sd	include SD boot info --type=nand	include NAND boot info (not implemented)

= phoenix-info =

gives information about a phoenix SD image created by the phoenixcard utility and optionally extracts the embedded boot code & firmware file from their hidden partitions. Not usable for LiveSuit images.

= nand-part =

nand-part is a tool to repartition the internal NAND on sunxi devices. It should be (cross-)compiled for the device's architecture, and it requires the device to have a special kernel patch (already included in our kernel tree) to expose the full NAND as a block device.

= See also =


 * Fex Guide
 * git repository
 * Miniand's online fexc
 * fexc for Windows: or