Burning .IMG file to Amlogic M8 devices using sdcard

Recently I had situation where I had to write firmware to S805 device that had no USB OTG port which means using USB Burning Tool is not an option.

Since I saw in Amlogic SDKs and U-Boot sources that there is a way to burn USB Burning Tool image file using sdcard (first clue was aml_sdc_burn.ini file that exists in almost all reference board device trees in Amlogic Android SDK) I decided to ask Amlogic for official documentation that explains how it works technically, what are possible values for certain options etc (because digging trough code is not quickest option to see how it works). After 2 mails and none of them with useful information, I decided to do my own research.
Basically it works almost the same way as burning image using USB Burning Tool.

Technical description:

When you put aml_sdc_burn.ini and let’s say (default name) aml_upgrade_package.img to your sdcard and you power on your device using reset button (note: on some S805 devices there is no reset button; option if implemented by manufacturer would be using your IR remote with pressed correct button when powering on your device).
During that process U-Boot finds aml_sdc_burn.ini file on your sdcard and tries to do following:

  • Temporary set internal flag that makes sdcard first bootable device
  • Resets device and tries to load U-Boot from sdcard (I will go back to this part later)
  • If successful, bootloader is loaded from sdcard and executed (instead of one stored on NAND/eMMC or SPI chip)
  • When bootloader is started, USB (well, SDC) burning mode is activated and based on values in aml_sdc_burn.ini file IMG is burned to your device

Now, if you read carefully, you might notice that sdcard with only .ini and .img file will not result in anything but rebooting your device to existing OS. That’s because I didn’t prepare my sdcard to be bootable (or recovery sdcard).

If you are running Linux, I described how to create recovery sdcard in post How to create Amlogic recovery SD card from Linux.

If you’re on Windows machine, under Downloads -> Amlogic tools you have tool called BootCardMaker which will help you to create bootable sdcard. Just start BootCardMaker as Administrator (if you are running Windows newer than XP), select your sdcard drive letter, mark that you want to format your card, select your U-Boot (must be for your device!), click on button MAKE and follow instructions.

If either on Windows or Linux, after preparing your bootable sdcard, copy your .img and .ini file to it, safely remove sdcard from your computer and you are ready for procedure described above. During burn process you will have green droid on your screen with moving progress bar. Very important is that YOU DO NOT DISCONNECT YOUR DEVICE FROM POWER DURING PROCESS.

Information about aml_sdc_burn.ini file format

This is default example of file:

As you can see, file contains 2 sections – common and burn_ex.

Let’s focus on common section and it’s parameters:

erase_bootloader – This parameter can contain 2 values (0 and 1). 0 will not erase your bootloader while 1 will.

erase_flash – This parameter contains 5 valid values (0 – 4) and here is what it means:

0 – Do not erase flash
1 – Normal erase (same as in USB Burning Tool)
2 – Information not available, will update post when I find out meaning of value 2
3 – Erase all (erase NAND/eMMC content and bootloader which exists in protected area)
4 – Force erase all (this option unprotects all protected areas of NAND/eMMC/SPI, raw formats everything and reparitions storage)

reboot – This parameter can contain 2 values (0 and 1). 1 will reboot your device after process is finished while 0 will not 🙂

Now burn_ex section:

package – full file name of .IMG file that exists on sdcard to be burned

media – in this example, media parameter is commented. I did not find much info about that parameter, but it seems that it should point to raw partition image of media partition. Little confusing eh. For this parameter to be enabled and work as it should, bootloader needs to be prepared for extra media partition which is not enabled by default.

Final words

Ok, I hope that I helped someone with this.

Please be noted that all that is written above you are doing at your own risk. I do not take any responsibility for broken/bricked devices etc…

6 thoughts on “Burning .IMG file to Amlogic M8 devices using sdcard”

  1. hi Stane,

    I wonder why the “Burning .IMG file to Amlogic M8 devices using sdcard” method will work with Amlogic 8726-MX device or not. My Tronsmart Prometheus device was bricked, because of wrong flashing MX2 firmware to it. I can not unbrick via “How to create Amlogic recovery SD card from Linux” method. Any ideal? Thanks!

  2. Hi,

    Tronsmart Prometheus uses SPI chip which is not defined by default in Amlogic bootloader and that’s one of reasons why you bricked your device. To unbrick it you will have to create recovery sdcard as described in post, put all firmware files on it (recovery.img…). When that is done, disassemble your device and locate SPI chip (see picture). Now put sdcard in box, short two pins as on picture, press and hold reset button and power it on. Remove short on SPI chip after 1-2 seconds but keep reset pressed until you see leds blinking. Install firmware and you’re done.

    This is pretty old device and I described it out of my head but that’s how it should work.

  3. Hello Stane.
    I need your help on recover an mxq pro .
    Can I use your method , considering that I have no boot from recovery at all ? Only a black screen……If I had to open the box I can do. This appens to me because my nephew want to install libreelec and now my box is gone. Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *