Image - fvantienen/dji_rev GitHub Wiki

Image files from DJI are used in several parts of the system, for example upgrades, kernel partitions and geofence databases. These files have a particular structure and can be unpacked using the tools in this repository. The file structure of these files is described here and is used in image.py.

Image structure

  • Header
    • 4B Magic (IM*H or PL*H)
    • 4B Version (Currently only 1 is seen)
    • 4B Size
    • 4B Reserved
    • 4B Header size
    • 4B RSA signature size
    • 4B Payload size
    • 4B target size
    • 1B OS
    • 1B Architecture
    • 1B Compression
    • 1B Anti version
    • 4B Authentication algorithm (RSA,)
    • 4B Authentication key identifier (see Authentication keys)
    • 4B Encryption key identifier (see Encryption keys)
    • 16B Scramble key (used as IV or key derivation for the encryption key)
    • 32B Image name (Verified, to make sure the correct image is loaded)
    • 4B Type
    • 4B Version
    • 4B Date
    • 20B Reserved
    • 16B User data
    • 8B Entry
    • 4B Reserved
    • 4B Chunk count
    • 32B SHA256 of the payload
  • Per Chunk info
    • 4B Name (identifier)
    • 4B Start offset
    • 4B Output size
    • 4B Attributes (Last bit 0 means encrypted with the Encryption Key)
    • 8B Address
    • 8B Reserved
  • RSA Signature of the Header (Size and Auth key described in header)
  • Actual chunk data (Start offset 0)