Retrieving device information

This page describes how to obtain memory information and the script.bin from the stock operating system of a sunxi device. This is needed for adding support for a new device, as part of our New Device Bringup howto.

Any of the methods below requires that sunxi-tools is installed and built on your computer.

=Using FEL=

Make sure that the original image is on the device, and that the original u-boot will be booted by the device ROM. Remove any SD-card that might have been inserted.

Entering FEL mode
The procedure for entering FEL mode is described on this page, but for clarity, it is reproduced here as well.

By using physical buttons

 * 1) Fully power off the device, if needs be through a power-button reset.
 * 2) Hold down the home button and do not release.
 * 3) Power on the device by pressing the power button.
 * 4) After a few seconds, press the power button at least three times (or just keep on triggering the power button for several seconds).
 * 5) After several seconds, release home button.

Note that, if you do not have a Home button, the vol+ / vol- button might work as well. If you have booted through a hard reset (if you have a reset button), or by holding the recovery button (if available), or through usbboot, FEL will not load the necessary information to memory, and the retrieved data will be bogus.

By using the serial console

 * 1) Fully power off the device, if needs be through a power-button reset.
 * 2) Connect the UART cable (but do not connect it before or the device will not power off properly).
 * 3) Start the console program.
 * 4) Send "2" over the serial link, by hold down "2" on your keyboard.
 * 5) Power on the device by pressing the power button.
 * 6) Wait until boot1 says it enters FEL mode, and then you can release "2".

Retrieving data over USB in FEL mode
You should now attach a USB OTG cable. If you have been able to correctly trigger FEL mode, you should now be able to get the FEL version. Run the following from the sunxi-tools tree on your host: ./fel version

This should return something resembling: AWUSBFEX soc=00162300(A10) 00000001 ver=0001 44 08 scratchpad=00007e00 00000000 00000000

If not, you might not have entered FEL mode correctly.

Now you should be able to retrieve the relevant information by running: ./fel read 0x42400000 0x82d0 boot1.header ./fel read 0x43000000 0x20000 script.bin

Now the retrieved data can be converted to readable text which can then be used in the Device Bringup howto. ./bootinfo boot1.header > bootinfo.txt ./bin2fex script.bin script.fex

=Using the original OS=

Working with android
The information which was originally here spent most of its time dealing with android intricacies. These are often device specific and the necessary information tends to be multiplied endlessly all over the internet.

To successfully retrieve the necessary information, you need access to the command line, you need a means of transferring the retrieved data, and you need to have root access to the device.

Android Debug Bridge
When working, ADB is by far the most convenient way of working with android. It can give you shell access, and can transfer files.

More information on ADB can be found here.

Terminal program
...

SSH server
...

USB storage
...

SD-Cards under android
...

Rooting android devices
Most sunxi based systems have no restrictions, and root access can be readily attained. If not, search the web for android forums which might describe how to root your device.

Reading memory information from registers
DRAM information can be read from the SoC registers directly using the a10-meminfo tool. All you need to do is get this file somewhere on your android filesystem (for instance, /data/cache), make sure that it is executable (chmod 755), and then run it and retrieve its output (for instance, to the sdcard).

copying script.bin from flash
Script.bin is directly available from the first partition of the NAND flash. Under Android, this flash device should appear as /dev/block/nanda. Often nanda is already mounted, if not, you can just mount it with -t vfat.

=Using a livesuit image=

While it is much much preferable to retrieve information from your device directly, this sometimes is not possible (either due to a bricked device, or the lack of a fel button or usb-otg). If you have been able to find a livesuit image, you might still get the information you need, at least until you can boot a full sunxi and examine the nand filesystem directly.

Extract the image
First, git clone the awutils repository and build it.

Then, extract the image with awimage: awimage -u name.img This will create a directory called name.img.dump, filled with loads of files and matching .hdr files.

Retrieve bootinfo
The files for this are often called 12345678_1234567890boot_0 or 2345678_1234567890boot_1. When in doubt, grep:

grep "eGON.BT" *

You can then run bootinfo from sunxi-tools on one of the files to retrieve the memory information.

Retrieve script.bin
You then need to find the filesystem which usually lives in nanda. This is usually known as RFSFAT16_BOOTLOADER_00000, but when in doubt, grep:

grep "SCRIPT BIN" *

This is a fat image that can be mounted directly: mount -o loop /home/user/dir/name.img.dump/RFSFAT16_BOOTLOADER_00000 /mnt/

You can then just take the script.bin and run it through bin2fex.

=Alternate script.bin retrieval method=

This method is limited in that it can only retrieve the script.bin and not the necessary memory information. It also requires access to the UART, which means that it is of limited use now that we have the ability to talk to FEL mode directly.


 * 1) Fully power off the device, if needs be through a power-button reset.
 * 2) Connect the UART cable (but do not connect it before or the device will not power off properly).
 * 3) Start the console program.
 * 4) Send "1" over the serial link, by hold down "1" on your keyboard.
 * 5) Power on the device by pressing the power button.
 * 6) Wait until boot1 says it enters FEL mode, and then you can release "1".

You should now be able to connect a USB OTG cable, and copy script.bin (and .fex if available) off usb storage.