If someone want to add gpio pin or uart without compile the source code.The sunxi-tools can help you.
At first You may need fex2bin and bin2fex:
$ git clone git://github.com/linux-sunxi/sunxi-tools.git $ cd sunxi-tools $ make $ With the using of ls, you can find the fex2bin and bin2fex.
Second copy the script.bin from Android OS:
$ adb shell $ mkdir /mnt/tmp $ mount -t vfat /dev/block/nanda /mnt/tmp $ exit $ adb pull /mnt/tmp/script.bin
Note : Attention it's different from Linux.
Then convert the script.bin to script.fex:
$ chmod 777 script.bin $ ./bin2fex script.bin > ./script.fex $ gedit script.fex
Now, you can edit the script.fex. Don't forget saving the file when you leave it.
Finally,convert the script.fex to script.bin and push it back to the CB
$ ./fex2bin script.fex > ./script.bin $ adb push script.bin /mnt/tmp $ adb shell $ umount /mnt/tmp $ reboot
It will restart the CB. The new script.bin will come into effect.
You can edit the script.bin directly
Firstly, you must connect network and install compilation Tools:
$ git clone git://github.com/linux-sunxi/sunxi-tools.git $ cd sunxi-tools $ make
With the using of ls, you can find the files: fex2bin and bin2fex.
Copy the script.bin.(boot from sdcard):
$ mkdir /mnt/mmcp1 $ mount /dev/mmcblk0p1 /mnt/mmcp1 (the script.bin is in /dev/nanda if you boot from nand ) $ cp /mnt/mmcp1/script.bin ./
Convert the script.bin to script.fex:
$ chmod 777 script.bin $ ./bin2fex script.bin > ./script.fex $ vi script.fex
Now, you can edit the script.fex.Don't forget saving the file when you leave it.
Convert the script.fex to script.bin and push it back.
$ ./fex2bin script.fex > ./script.bin $cp ./script.bin /mnt/mmcp1/ $umount /mnt/mmcp1 $reboot
It will restart the CB. The new script.bin will come into effect.
Note:When the script.bin is invalid.You must enter the u-boot command line and input
$setenv boot_normal fatload nand 0 43000000 script.bin\;boota 40007800 $saveenv $reset