Script.bin

script.bin is a board-specific binary "configuration file" used by Allwinner-specific drivers in the kernel (and also by the LiveSuit flashing program) with information on how to set-up various devices, ports and I/O pins on boards with Allwinner SoCs.

The corresponding human-readable file format is FEX, it is possible to convert .bin to .fex and back by using Sunxi-tools.

= Build script.bin =

See also: How to modify script.bin

Get bin2fex utility
Bin2fex is part of our sunxi-tools repository. You can get it by following our sunxi-tools build howto.

Get sunxi-boards repository
git clone git://github.com/linux-sunxi/sunxi-boards.git

Identify your fex file from your device page
The .fex file should be clearly listed on your device page under the Manual Build section.

Edit .fex file (optional)
This step is usually not necessary.

The .fex file uses the windows standard .ini format. The entries are described in our FEX guide.

Add Ethernet MAC address
To give your device a persistent MAC address, you need to add the MAC directive to the dynamic section, like such:

[dynamic] MAC = "0123456789AB"

If no dynamic section exists, just add it to the end of the .fex file

Build script.bin
/home/user/dir/sunxi-tools/fex2bin .fex script.bin

Configure U-Boot to load script.bin
= Modern script.bin usage =

On more recent BSPs (like for H6), script.bin is folded into devicetree in some weird way. Sunxi-tools has no tool yet to extract this information, as this still needs to be written up. This currently limits/prohibits extracting of script.bin on many modern Allwinner devices.

There seems to be a decent amount of information available in the Allwinner BSP, which, amazingly, uses part of our sunxi-tools code, enough for an enterprising individual to go add the necessary tooling to sunxi-tools.

The key here seems to be a bash script called pack, which references a special version of the linux dtc compiler (in do_ini_to_dts) which includes the extra code to parse fex.

= Related Pages =
 * How to modify script.bin