* UINT32 size, followed by that number of bytes containing (text) data.
* Padded with 0xFF. Payload starts at offset 0x1014.
*
+ * SAFELOADER_TYPE_CLOUD
+ * Standard preamble with size including preamble length, and checksum.
+ * Followed by the 'fw-type:Cloud' string and some (unknown) data.
+ * Payload starts at offset 0x1014.
+ *
* SAFELOADER_TYPE_QNEW
* Reversed order preamble, with (apparent) md5 checksum before the image
* size. The size does not include the preamble length.
enum safeloader_image_type {
SAFELOADER_TYPE_DEFAULT,
SAFELOADER_TYPE_VENDOR,
+ SAFELOADER_TYPE_CLOUD,
SAFELOADER_TYPE_QNEW,
};
static void safeloader_parse_image(FILE *input_file, struct safeloader_image_info *image)
{
+ static const char *HEADER_ID_CLOUD = "fw-type:Cloud";
static const char *HEADER_ID_QNEW = "?NEW";
char buf[64];
if (memcmp(HEADER_ID_QNEW, &buf[0], strlen(HEADER_ID_QNEW)) == 0)
image->type = SAFELOADER_TYPE_QNEW;
+ else if (memcmp(HEADER_ID_CLOUD, &buf[0], strlen(HEADER_ID_CLOUD)) == 0)
+ image->type = SAFELOADER_TYPE_CLOUD;
else if (ntohl(*((uint32_t *) &buf[0])) <= SAFELOADER_HEADER_SIZE)
image->type = SAFELOADER_TYPE_VENDOR;
else
switch (image->type) {
case SAFELOADER_TYPE_DEFAULT:
case SAFELOADER_TYPE_VENDOR:
+ case SAFELOADER_TYPE_CLOUD:
image->payload_offset = SAFELOADER_PAYLOAD_OFFSET;
break;
case SAFELOADER_TYPE_QNEW: