Documentation/OifwFirmwareFormat

Firmware format

Structure

Firmware file consists of header and body.

All strings are null-terminated and pure ASCII (unless specified otherwise), string size includes terminating '\0'. Integers are unsigned and little-endian.

4 bytes magic string 0x4f 0x49 0x46 0x57
4 bytes size of file header (from start of file to end of blocks list) integer

List of properties:

4 bytes size of property name integer
4 bytes size of property integer
N bytes property name string
N bytes property value string

List ends with the property with empty name (0 bytes of length).

List of blocks:

4 bytes size of block name integer
8 bytes block offset from the start of file (required to be 4-bytes aligned) integer
8 bytes block size integer
N bytes block name string
M bytes List of block-specific properties (see above for the format of the properties list)

List ends with block with empty name (0 bytes of length)

Body

Body of firmware consists of data, according to the blocks information in header.

Known properties

  • device - name of device the firmware is suitable for.
    • Required. Bootloader should not consider firmware file with wrong device property or without this property as a valid update file.
    • Known values:
      • n516 for N516
  • hwrev - hardware revision.
    • Optional. Per-device rules apply.
    • Not required for N516.
  • description - free-formed description of firmware.
    • Optional. Presentation-only.
  • date - firmware build time, unixtime (decimal number).
    • Optional. Presentation-only.
  • epoch - "epoch" of firmware, determining the layout and size of blocks.
    • Absence of this property is equal to epoch 0.

Known block-level properties

  • crc32 - CRC32 checksum (polynomial used in IEEE 802.3 to be precise)
    • 4-byte little-endian integer for N516 bootloader with epoch 0
    • ASCII string of digits for N516 bootloader with epoch > 0 and for all other bootloaders
  • raw - If yes, then block should be flashed to MTD partition. By default blocks are flashed to UBI.
  • compression - compression method. The only supported value is gzip. If this property is not present, then block data is assumed to be uncompressed. Supported since epoch 1 of N516 bootloader.

N516 firmware epochs

  • 0
    • first firmware revision
  • 1
    • added support for compression=gzip on block level
    • crc32 block-level property changed into ASCII string