IMG2

IMG2 files were the original method of holding a payload for iDevices. While the extension .img2 was commonly used in IPSW files, these files are actually 8900 files wrapping an IMG2 file. These files can only be parsed by iBoot-304 (iPhone OS 2.0 beta 3) or earlier and the S5L8900. Later processors have no support for this format.

File Format

Img2 {
   0  uint8[4] magic;     // "2gmI" ("Img2" in little endian)
   4  uint8[4] imageType; // little endian; eg. "ogol" ("logo") for AppleLogo
   8  uint16;
   A  uint16   epoch;
   C  uint32   flags1;
  10  uint32   payloadLengthPadded;
  14  uint32   payloadLength;
  18  uint32;
  1C  uint32   flags2; // 0x01000000 has to be unset
  20  uint8[64];
  60  uint32;          // possibly the string length of VersionTag.version
  64  uint32   headerChecksum; // crc32(file[0:0x64])
  68  uint32   checksum2;
  6C  uint32;          // always 0xFFFFFFFF?
  70  VersionTag {
        70  uint8[4]  magic;   // "srev" ("vers" in little endian)
        74  uint32;
        78  uint8[24] version; // "EmbeddedImages-##" (terminated with a null and 0xFF)
      } version;
  90  uint8[0x370] pad;
 400  uint8[]  payload; // sizeof(payload) == payloadLengthPadded
}

Known Image Types

The imageType value (located at offset 0x4) specifies what payload is contained in this file. These are the known possible values (in big endian; flip the order for stored order):