libusb-1.0 and zlib
apt-get install libusb-1.0-0-dev zlib1g-dev
yum install libusbx-devel
git clone https://github.com/linux-sunxi/sunxi-tools
See also Instructions in the README
Those programs that need to run on the host will be built when you run:
The programs meant for the device are not built by default. You either need to run
make target-tools or make them individually, by explicitly naming them (e.g.
When you are using a cross-compiling toolchain (make sure it is added to your PATH), you may need to specify the toolchain prefix to use, e.g.
make target-tools CROSS_COMPILE=arm-linux-gnueabihf-
Since all these tools are tiny, you can just as well build these 'natively' as well, i.e. on the target device itself. In that case, you don't need a cross compiler and it's possible to set CROSS_COMPILE to an empty string. In this scenario - to build everything in one go - you may use
make all CROSS_COMPILE=
sunxi-fexc and wrappers
sunxi-fexc is a small program to convert between FEX and its binary representation, back and forth. It comes with two shortcuts (symbolic links) for easier invocation.
Usage: ./sunxi-fexc [-vq] [-I <infmt>] [-O <outfmt>] [<input> [<output>]] infmt: fex, bin (default:fex) outfmt: fex, bin, uboot (default:bin)
When no arguments are provided, it waits on stdin. Similar, when no <output> 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).
This is a copy of sunxi-fexc which takes a script.bin and dumps the .fex text.
This is a copy of sunxi-fexc which takes the .fex text file and dumps the binary.
Manipulate 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.
sunxi-fel and helpers
Main program, which provides a script interface for talking to FEL.
Unless you select a specific device using the
--sid options, the tool will access the first Allwinner device (in FEL mode) that it finds. You can print a list of all FEL devices currently connected/detected with
sunxi-fel --list --verbose.
When called with no arguments,
sunxi-fel will display usage information:
Usage: ./sunxi-fel [options] command arguments... [command...] -v, --verbose Verbose logging -p, --progress "write" transfers show a progress bar -l, --list Enumerate all (USB) FEL devices and exit -d, --dev bus:devnum Use specific USB bus and device number --sid SID Select device by SID key (exact match) spl file Load and execute U-Boot SPL If file additionally contains a main U-Boot binary (u-boot-sunxi-with-spl.bin), this command also transfers that to memory (default address from image), but won't execute it. uboot file-with-spl like "spl", but actually starts U-Boot U-Boot execution will take place when the fel utility exits. This allows combining "uboot" with further "write" commands (to transfer other files needed for the boot). hex[dump] address length Dumps memory region in hex dump address length Binary memory dump exe[cute] address Call function address reset64 address RMR request for AArch64 warm boot readl address Read 32-bit value from device memory writel address value Write 32-bit value to device memory read address length file Write memory contents into file write address file Store file contents into memory write-with-progress addr file "write" with progress bar write-with-gauge addr file Output progress for "dialog --gauge" write-with-xgauge addr file Extended gauge output (updates prompt) multi[write] # addr file ... "write-with-progress" multiple files, sharing a common progress status multi[write]-with-gauge ... like their "write-with-*" counterpart, multi[write]-with-xgauge ... but following the 'multi' syntax: <#> addr file [addr file [...]] echo-gauge "some text" Update prompt/caption for gauge output ver[sion] Show BROM version sid Retrieve and output 128-bit SID key clear address length Clear memory fill address length value Fill memory
Small binary which runs on the target. It enables IO register access over FEL mode. This should not be used directly.
A script which uses sunxi-fel to upload fel-pio to the target, and which then can use the sunxi-pio utility, and manipulate GPIO settings, over FEL/USB.
A small ARM native SD boot code which forces FEL mode, to boot straight into FEL mode without having to press any buttons.
A small ARM native SD boot code which sets PF (CARD0) to JTAG mode and then busy-waits for you to attach with JTAG.
Dump information from Allwinner boot files (boot0/boot1)
--type=sd include SD boot info --type=nand include NAND boot info (not implemented)
This device side tool reads in register information and prints out all the information you need for adding new device support to U-Boot. This tool gets statically compiled so it can be used on Android as well.
This device side tool reads the script.bin data from RAM at the magic address 0x43000000 and saves it to a file. This tool gets statically compiled so it can be used on Android as well. Please note that it is only usable with FEX based kernels (as used in the stock Android firmware) and does not make any sense with the devicetree based mainline kernel.
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.
sunxi-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.