GithubHelp home page GithubHelp logo

aml-linux-usb-burn's Introduction

Linux version of Amlogic USB Burning Tool

This is just "copy" of files that can be found on Amlogic Openlinux website.

Installation

Create new u-dev rule for Amlogic devices (in /etc/udev/rules.d). My file is called 70-persistent-usb-amlogic.rules Content of file is:

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="1b8e", ATTR{idProduct}=="c003", MODE:="0666", SYMLINK+="worldcup"

When you created your rule either reload udev rules or reboot your machine. Make sure that root folder of this repository is in your PATH variable (I simply put it inside my ~/bin folder) so I can call it from anywhere without specifying path.

And this tool depends on libusb and libusb-compat, you must install those tools first.

How to use

Connect your device and put it to USB burning mode, open terminal and navigate to folder where your aml_upgrade_package.img is and issue command:

aml-flash --img=aml_upgrade_package.img --soc=gxl --wipe --reset=n --parts=all

For more options, just issue aml-flash command. soc paremeter can be gxl (S905, S905X and S912), axg (A113 audio SoC), txlx (TV SoC - T962), m8 (S802, S805 and S812) I tested this tool with sucess on S812, S905, S905X and S912.

Note

This tool is for x64 Linux only. File aml_image_v2_packer is 32bit but update binary (inside tools folder) is 64bit so...

aml-linux-usb-burn's People

Contributors

integ avatar stane1983 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aml-linux-usb-burn's Issues

Unpacking image [OK] not found

I managed to install these tools but get this error:
$ ./aml-flash --img=amlupgrade113.img --soc=gxl --wipe --reset=n --parts=all
Unpacking image [OK]
not found

$ ./tools/update identify
AmlUsbIdentifyHost
This firmware version is 2-2-0-0

any help ?

Can not burn img in secure mode

Hi Stane,
I using your tool to burn my img (aml_upgrade_package.img) to s805 platform in secure mode. I'm facing a problem while buring the img. It can not create partition table. always get error: ERR: AmlUsbBulkCmd failed!
You can check the following log. Can you help me to solve it, pls?

Thank you very much.

========================
Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null identify 7

  • Results ---------------------------------------------------
    AmlUsbIdentifyHost
    This firmware version is 1-0-0-0-109-0-108

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null identify 7

  • Results ---------------------------------------------------
    AmlUsbIdentifyHost
    This firmware version is 1-0-0-0-109-0-108

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null bulkcmd " echo 12345"

  • Results ---------------------------------------------------
    AmlUsbBulkCmd[ echo 12345]
    [AmlUsbRom]Err:return len=0 < strLenBusy 11
    [AmlUsbRom]Err:bulkInReply=[]
    ERR: AmlUsbBulkCmd failed!

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null identify 7

  • Results ---------------------------------------------------
    AmlUsbIdentifyHost
    This firmware version is 1-0-0-0-32-101-99

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null rreg 4 0xd9018048

  • Results ---------------------------------------------------
    [update]Total tansfer size 0x4

D9018048: 010015c3

0xd9018048 = 0x010015c3
Secure boot bit = 128
Board is in secure mode
Unpacking image
[Msg]Image package version 0x1
[Msg]Unpack item [USB , DDR] to (/tmp/aml-flash-tool-lOMN/DDR.USB) size:15124 bytes
[Msg]Unpack item [USB , UBOOT_COMP] to (/tmp/aml-flash-tool-lOMN/UBOOT_COMP.USB) size:341264 bytes
[Msg]Unpack item [conf , platform] to (/tmp/aml-flash-tool-lOMN/platform.conf) size:191 bytes
[Msg]Unpack item [USB , DDR_ENC] to (/tmp/aml-flash-tool-lOMN/DDR_ENC.USB) size:15124 bytes
[Msg]Unpack item [USB , UBOOT_ENC] to (/tmp/aml-flash-tool-lOMN/UBOOT_ENC.USB) size:375888 bytes
[Msg]Unpack item [dtd , meson8b_m201_2G] to (/tmp/aml-flash-tool-lOMN/meson8b_m201_2G.dtd) size:68048 bytes
[Msg]Unpack item [dtd , meson8b_m201_1G] to (/tmp/aml-flash-tool-lOMN/meson8b_m201_1G.dtd) size:67834 bytes
[Msg]Unpack item [ini , aml_sdc_burn] to (/tmp/aml-flash-tool-lOMN/aml_sdc_burn.ini) size:624 bytes
[Msg]Unpack item [dtb , meson] to (/tmp/aml-flash-tool-lOMN/meson.dtb) size:47104 bytes
[Msg]Unpack item [PARTITION , logo] to (/tmp/aml-flash-tool-lOMN/logo.PARTITION) size:6221056 bytes
[Msg]Unpack item [PARTITION , boot] to (/tmp/aml-flash-tool-lOMN/boot.PARTITION) size:8070525 bytes
[Msg]Unpack item [PARTITION , system] to (/tmp/aml-flash-tool-lOMN/system.PARTITION) size:465803736 bytes
[Msg]Unpack item [PARTITION , recovery] to (/tmp/aml-flash-tool-lOMN/recovery.PARTITION) size:8104172 bytes
[Msg]Unpack item [PARTITION , bootloader] to (/tmp/aml-flash-tool-lOMN/bootloader.PARTITION) size:701200 bytes
[Msg]Write config file "/tmp/aml-flash-tool-lOMN/image.cfg" OK!
Image unpack OK!
[OK]

Parsing image configuration files

platform_conf_name = platform.conf
ddr_filename = DDR.USB
uboot_filename =
uboot_comp_filename = UBOOT_COMP.USB
dtb_meson_filename = meson.dtb
dtb_meson1_filename =
dtb_meson1_enc_filename =
ddr_enc_filename = DDR_ENC.USB
uboot_enc_filename = UBOOT_ENC.USB
keys_filename =
platform = 0x0802
bin_params = 0xd9010000
ddr_load = 0xd9000000
ddr_run = 0xd9000000
uboot_down = 0x200000
uboot_decomp = 0xd9000030
uboot_enc_down = 0x0fff8000
uboot_enc_run = 0x0fff8000
uboot_load =
uboot_run =
bl2_params =
nb_partitions = 5

Partition list

0 logo.PARTITION logo normal
1 boot.PARTITION boot normal
2 system.PARTITION system sparse
3 recovery.PARTITION recovery normal
4 bootloader.PARTITION bootloader normal

Bootloader/DTB files

bootloader_file = /tmp/aml-flash-tool-lOMN/bootloader.PARTITION
dtb_file = /tmp/aml-flash-tool-lOMN/meson.dtb

Initializing ddr ......
Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null cwr /tmp/aml-flash-tool-lOMN/DDR_ENC.USB 0xd9000000

  • Results ---------------------------------------------------
    ..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
    Transfer Complete! total size is 15124 Bytes

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null run 0xd9000000

  • Results ---------------------------------------------------
    [update]Run at Addr d9000000
    AmlUsbRunBinCode:ram_addr=d9000000

........[OK]
Running u-boot
Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null write /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/decompressPara_4M.dump 0xd9010000

  • Results ---------------------------------------------------
    ..
    Transfer Complete! total size is 32 Bytes

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null write /tmp/aml-flash-tool-lOMN/UBOOT_ENC.USB 0x0fff8000

  • Results ---------------------------------------------------
    ............
    Transfer Complete! total size is 375888 Bytes

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null run 0x0fff8000

  • Results ---------------------------------------------------
    [update]Run at Addr fff8000
    AmlUsbRunBinCode:ram_addr=0fff8000

................[OK] 123
Creating partitions 12 => run_update
Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null bulkcmd " disk_initial 3"

  • Results ---------------------------------------------------
    AmlUsbBulkCmd[ disk_initial 3]
    AM_REQ_BULK_CMD_Handler ret=-110,blkcmd= disk_initial 3 error_msg=error sending control message: Connection timed out
    [AmlUsbRom]Err:rettemp = 0 buffer = [ disk_initial 3]
    ERR: AmlUsbBulkCmd failed!

Command -> /media/DATA/1.Projects/7.Amlogic/Tools/aml-linux-usb-burn-master/tools/update 2>/dev/null bulkcmd " disk_initial 2"

  • Results ---------------------------------------------------
    AmlUsbBulkCmd[ disk_initial 2]
    AM_REQ_BULK_CMD_Handler ret=-110,blkcmd= disk_initial 2 error_msg=error sending control message: Connection timed out
    [AmlUsbRom]Err:rettemp = 0 buffer = [ disk_initial 2]
    ERR: AmlUsbBulkCmd failed!

[KO]

Cleanup

DTB is not flashed, boot failed if partition layout changes

I changed partition sizes in aml_upgrade_package.img, but after flashing it, bootloader still sees old partition table - system and cache sizes are wrong:

[mmc_startup] mmc refix success
init_part() 297: PART_TYPE_AML
[mmc_init] mmc init success
      Amlogic multi-dtb tool
      Single dtb detected
start dts,buffer=0000000073e8a240,dt_addr=0000000073e8a240
get_partition_from_dts() 71: ret 0
      Amlogic multi-dtb tool
      Single dtb detected
parts: 17
00:      logo   0000000000800000 1
01:  recovery   0000000001800000 1
02:      misc   0000000000800000 1
03:      dtbo   0000000000800000 1
04:  cri_data   0000000000800000 2
05:     param   0000000001000000 2
06:      boot   0000000001000000 1
set has_boot_slot = 0
07:       rsv   0000000001000000 1
08:  metadata   0000000001000000 1
09:    vbmeta   0000000000200000 1
10:       tee   0000000002000000 1
11:    vendor   0000000010000000 1
12:       odm   0000000008000000 1
**13:    system   0000000050000000 1**
14:   product   0000000008000000 1
**15:     cache   0000000046000000 2**
16:      data   ffffffffffffffff 4
init_part() 297: PART_TYPE_AML
eMMC/TSD partition table have been checked OK!
crc32_s:0x1577dad == storage crc_pattern:0x1577dad!!!
crc32_s:0xee152b83 == storage crc_pattern:0xee152b83!!!
crc32_s:0x7fd3b243 == storage crc_pattern:0x7fd3b243!!!
mmc env offset: 0x4d400000
In:    serial
Out:   serial
Err:   serial
reboot_mode=watchdog_reboot
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
_verify_dtb_checksum()-2755: calc b62fcfb7, store b62fcfb7
_verify_dtb_checksum()-2755: calc b62fcfb7, store b62fcfb7
dtb_read()-2972: total valid 2
update_old_dtb()-2953: do nothing
      Amlogic multi-dtb tool
      Single dtb detected

In the result box can't boot and resets to USB Burning mode:

...
active slot = 0
CONFIG_AVB2: 
active_slot: normal avb2: 0
Err imgread(L328):Fmt unsupported!genFmt 0x0 != 0x3
InUsbBurn
[MSG]sof
Set Addr 25
Get DT cfg
Get DT cfg
set CFG

Flashing the same image with official USB Burning Tool has no problem.

Create partitions [KO]

./aml-flash --img=./KM8PRO-NMF26Q-20170818.170921.V0321.img --soc=gxl --wipe --reset=n --parts=all

Waiting for Amlogic device to be connected...
Rebooting the board ........[OK]
Unpacking image [OK]
Initializing ddr ........[OK]
Running u-boot ........[OK]
Create partitions [KO]

how to debug K0 error

Bootloader seems to not erase?

I am trying to flash customised 7.1 rom. When I use --destroy to erase bootloader before flashing everything seems fine message says: "it is erased nothing to do more". Whole flashing process goes without error. However when device resets it stays stuck on powerup logo (when I issue command --destroy in this state (still connected to device) it again says it was successfull, powerup logo disappears to black screen and it seems like bootloader was erased. However rom never boots. I used the same command few days ago and rom booted. I haven't changed the rom since, it stays on external drive. But I can successfully flash other rom (6.0). I don't know what the problem is it seems that the bootloader of 6.0 rom is never erased and stays behind even though the tool says it was erased. Is it possible? I always first --destroy than flash with "all parts, --wipe". What can I do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.