Ambarella command line tools

Discussion in 'Firmware Modifications' started by Tobi@s, Feb 15, 2016.

  1. Tobi@s

    Tobi@s Well-Known Member App Developer

    Messages:
    1,350
    Likes Received:
    801
    Location:
    Bavaria
    Country:
    Germany
    Dash Cam:
    some
    Hello again,
    it's been some time since I posted something like this but thats cause I was busy with studying. But I wasn't completely lazy during that time. As a kind of programming practice I started to develop some Ambarella command line tools using C. My goal is to develop all the features from Java based AFT using C as command line tools and maybe even more (if time doesnt restrict me again).

    At the moment there are only these few tools: a7_fwunpacker, a7_ptupdater, a7_fwpacker but I'm working on more right now.

    There is one special thing you can do with these tools: "Convert" e2b/elf firmwares to firmware.bin since the unpacker doesnt rely on the static global firmware header at 0x00
    Could be useful for devices that only have elfs/e2bs available (like gopro 4 session)

    ----
    a7_fwunpacker:
    fwunpacker.png

    Unpacks Ambarella A7 .bin/.elf/.e2b binaries. It searches for all partitions and the global firmware header using magic constants and exports them to separate files.
    Exported file structures:
    fw_header: 2048 byte global firmware header
    partition_X: 256 byte partition header + payload
    Usage: a7_fwunpacker <firmware file>
    DL: http://dc.p-mc.eu/acmd_tools/a7_fwunpacker.exe

    a7_ptupdater:
    ptupdater.png

    Updates the partition header based on partition payload.
    Usage: a7_ptupdater <partition file>
    DL: http://dc.p-mc.eu/acmd_tools/a7_ptupdater.exe

    a7_ptsm:
    ptsm.png

    Mode -s: Splits specified partition_X file to header_X and payload_X at 0x100 to allow easier editing without partition header
    Mode -m: Merges header_X and payload_X into specified partition_X.
    Usage: a7_ptsm -s/-m <partition file>
    DL: http://dc.p-mc.eu/acmd_tools/a7_ptsm.exe

    a7_fwpacker:
    fwpacker.png

    Packs the fw_header and partition files from a7_fwunpacker into a flashable firmware binary
    Needs to be run in directory with fw_header and partition_X files
    Usage: a7_fwpacker <output file>
    DL: http://dc.p-mc.eu/acmd_tools/a7_fwpacker.exe
    ----

    Warning:
    These tools are very experimental and could easily output files that may brick your device. Only use them if you are able to recover a bricked device!

    Source code:
    I'm planning to publish the source code but don't know where to put it, yet. But: I'm not planning to release the code under an open source license.

    Project page:
    http://dc.p-mc.eu/tools/ambacmd
     
    Last edited: Feb 15, 2016
  2. jokiin

    jokiin Well-Known Member Manufacturer

    Messages:
    36,143
    Likes Received:
    18,202
    Location:
    Shenzhen, China - Sydney, Australia
    Country:
    China
    Dash Cam:
    Too many ¯\_(ツ)_/¯
    nice work
     
    Tobi@s likes this.
  3. Tobi@s

    Tobi@s Well-Known Member App Developer

    Messages:
    1,350
    Likes Received:
    801
    Location:
    Bavaria
    Country:
    Germany
    Dash Cam:
    some
    Added a7_ptsm.exe for splitting/merging partition header and payload
    Description & DL in first post
     
    Falsificator, z768 and jokiin like this.
  4. z768

    z768 Member

    Messages:
    73
    Likes Received:
    63
    Country:
    Belarus
    za rulem and Falsificator like this.
  5. z768

    z768 Member

    Messages:
    73
    Likes Received:
    63
    Country:
    Belarus
    Unpack elf easy.
    It is much more difficult to do from a bin elf
     
  6. Tobi@s

    Tobi@s Well-Known Member App Developer

    Messages:
    1,350
    Likes Received:
    801
    Location:
    Bavaria
    Country:
    Germany
    Dash Cam:
    some
    Do you want to say that you unpacked it using the elf header?
    My algorithm looks for the magic constant of the ambarella firmware header which is present in e2b, elf and .bin files
     
  7. z768

    z768 Member

    Messages:
    73
    Likes Received:
    63
    Country:
    Belarus
    You want to make the converter ElfToBin ?
     
  8. z768

    z768 Member

    Messages:
    73
    Likes Received:
    63
    Country:
    Belarus
    Partial source Elf.
     

    Attached Files:

    za rulem and Tobi@s like this.
  9. z768

    z768 Member

    Messages:
    73
    Likes Received:
    63
    Country:
    Belarus
    All information about elf file.
    Only the header.
    Rename file elf.txt in elf.exe
    The server blocks.
     

    Attached Files:

    • Elf.txt
      File size:
      924.9 KB
      Views:
      10
    za rulem and Tobi@s like this.
  10. Tobi@s

    Tobi@s Well-Known Member App Developer

    Messages:
    1,350
    Likes Received:
    801
    Location:
    Bavaria
    Country:
    Germany
    Dash Cam:
    some
    It's already working since the tool finds the partitions in .elf files as well but not by using the elf header.
    Thanks for your elf documentation, will see what I can do with it!
     
  11. z768

    z768 Member

    Messages:
    73
    Likes Received:
    63
    Country:
    Belarus
    Arm Elf ...
    This is something that most fully reveals the chip.
    ARM Architecture.
     

    Attached Files:

    za rulem and Tobi@s like this.
Loading...

Share This Page