How to edit board configurations and definitions in the official Debian Linux

How to edit board configurations and definitions in the official Debian Linux?

Changing script.bin file without removing the microSD card


Using bin2fex and fex2bin directly

The file that contains board definitions is in binary format so we we need to convert it to text first. We use the bin2fex convertor that comes with the image. Type:

 bin2fex /boot/script.bin /boot/script.fex

Then open the script.fex with text editor, for example:

 nano /boot/script.fex

Edit the file as you want (pin assignments etc) and save the changes and exit. The different options for the script are explained here: SUNXI FEX GUIDE

IMPORTANT! ADJUSTING SCRIPT.BIN WITH IMPROPER VALUES MIGHT BREAK YOUR DEBIAN IMAGE AND IT IS ALWAYS RECOMMENDED TO KEEP A BACK-UP OF YOUR DEFAULT SCRIPT.BIN

When done with editing convert the text file back to binary format with fex2bin tool, type:

 fex2bin /boot/script.fex /boot/script.bin

Finally, reboot the board:

 reboot

Using script (if available)

Some official releases have tools for script.bin changing, located in /opt/sunxi-tools directory:

  # cd /opt/sunxi-tools
  # ./chscr.sh

This will convert script.bin file from sdcard to script.fex file and the file will be opened using nano editor. Now you can change the board modules and parameters, save the changes ("CTRL"+"X"; confirm with "Y") and exit ("CTRL"+"X" again) from nano editor.

  # ./wrscr.sh

this will convert script.fex to script.bin and the script.bin file will be written to sdcard.

  reboot

Reboot the board and the new settings would be enabled.

Changing script.bin file by removing the microSD card


The biggest part of the board configuration might be edited, changed or improved in a file called script.bin

The script.bin file can usually be found in the main directory of a microSD card prepared with official Debian image. The folder containing the script can be inspected under both Windows, Linux or Mac.

You can't directly edit binary file so you would need to convert it to text format (it is called fex in this case), then edit the parameters via a text editor and finally switch it back to binary format.

The different options for the script are explained here: SUNXI FEX GUIDE

IMPORTANT! ADJUSTING SCRIPT.BIN WITH IMPROPER VALUES MIGHT BREAK YOUR DEBIAN IMAGE AND IT IS ALWAYS RECOMMENDED TO KEEP A BACK-UP OF YOUR DEFAULT SCRIPT.BIN

To convert back and forth the script.bin you might use different tools. You can find Windows tools here: SUNXI TOOLS FOR WINDOWS . For Linux convertors please check the sunxi tools here: SUNXI TOOLS

Note that it is possible to change the script.bin in a running Debian image in newest releases! More information might be found at the top of this wiki article! Not all releases feature the live method of changing fex to bin so if you board doesn't have it follow the offline method.