[Sony Xperia XZ1 Compact ROMs, Kernels, Recoveries,] munjeni:
I'm done some initial work

#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64 1
#endif
#ifndef __USE_LARGEFILE64
#define __USE_LARGEFILE64 1
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE 1
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#ifndef _FILE_OFFSET_BIT
#define _FILE_OFFSET_BIT 64
#endif
#endif

#ifdef _WIN32
#define __USE_MINGW_ANSI_STDIO 1

#include <windows.h>
#include <setupapi.h>
#include <initguid.h>

#include "GordonGate.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#ifdef HAS_STDINT_H
#include <stdint.h>
#endif
#ifdef unix
#include <unistd.h>
#include <sys/types.h>
#else
#include <direct.h>
#include <io.h>
#endif

#if defined(USE_FILE32API)
#define fopen64 fopen
#define ftello64 ftell
#define fseeko64 fseek
#else
#ifdef __FreeBSD__
#define fopen64 fopen
#define ftello64 ftello
#define fseeko64 fseeko
#endif
/*#ifdef __ANDROID__
#define fopen64 fopen
#define ftello64 ftello
#define fseeko64 fseeko
#endif*/
#ifdef _MSC_VER
#define fopen64 fopen
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
#define ftello64 _ftelli64
#define fseeko64 _fseeki64
#else /* old msc */
#define ftello64 ftell
#define fseeko64 fseek
#endif
#endif
#endif

#include <ctype.h>
#include <sys/stat.h>
#include <limits.h>
#include <time.h>
#include <dirent.h>
#include <assert.h>

#ifndef _WIN32
#include <linux/usbdevice_fs.h>
#include <linux/usb/ch9.h>
#include <asm/byteorder.h>

#include <string.h>
#include <errno.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>

#include <dirent.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <ctype.h>
#endif

#include <inttypes.h>

#define ENABLE_DEBUG 1

#if ENABLE_DEBUG
#define LOG printf
#else
#define LOG(...)
#endif

/*
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000 A4 01 00 00 01 00 00 00 0A 00 00 00 00 00 01 00 ¤...............
00000010 0C 00 00 00 00 00 00 00 94 94 0D 00 00 00 00 00 ........””......
00000020 EF 23 A7 01 00 00 00 00 02 00 00 00 00 00 00 00 ï#§.............
00000030 01 00 00 00 01 00 00 00 6A 5B 0C 00 00 00 00 00 ........j[......
00000040 E9 33 42 01 00 00 00 00 02 00 00 00 00 00 00 00 é3B.............
00000050 01 00 00 00 02 00 00 00 F6 00 00 00 00 00 00 00 ........ö.......
00000060 01 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 ................
00000070 01 00 00 00 03 00 00 00 FC 00 00 00 00 00 00 00 ........ü.......
00000080 00 04 00 00 00 00 00 00 06 00 00 00 00 00 00 00 ................
00000090 01 00 00 00 04 00 00 00 FC 00 00 00 00 00 00 00 ........ü.......
000000A0 00 04 00 00 00 00 00 00 06 00 00 00 00 00 00 00 ................
000000B0 01 00 00 00 05 00 00 00 E9 9A 01 00 00 00 00 00 ........éš......
000000C0 28 63 03 00 00 00 00 00 06 00 00 00 00 00 00 00 (c..............
000000D0 01 00 00 00 07 00 00 00 CF 0E AC 00 00 00 00 00 ........Ï.¬.....
000000E0 00 D0 9D 05 00 00 00 00 02 00 00 00 00 00 00 00 .Ð..............
000000F0 01 00 00 00 08 00 00 00 F1 00 00 00 00 00 00 00 ........ñ.......
00000100 00 00 00 01 00 00 00 00 02 00 00 00 00 00 00 00 ................
00000110 01 00 00 00 09 00 00 00 23 01 00 00 00 00 00 00 ........#.......
00000120 00 F0 05 00 00 00 00 00 02 00 00 00 00 00 00 00 .ð..............
00000130 01 00 00 00 10 00 00 00 2F CC 8C 17 00 00 00 00 ......../ÌŒ.....
00000140 00 00 80 38 01 00 00 00 02 00 00 00 00 00 00 00 ..€8............
00000150 01 00 00 00 11 00 00 00 DF E7 C1 00 00 00 00 00 ........ßçÁ.....
00000160 00 00 00 60 00 00 00 00 02 00 00 00 00 00 00 00 ...`............
00000170 01 00 00 00 12 00 00 00 B5 04 00 00 00 00 00 00 ........µ.......
*/

struct main_header
{
uint32_t unknown_1;
uint32_t unknown_2;
uint32_t unknown_3;
uint32_t unknown_4;
uint32_t total;
};

struct package_header
{
uint32_t id;
uint32_t size;
uint32_t unknown_1;
uint32_t unknown_2;	// probably unpacked size
uint32_t unknown_3;
uint32_t atribute;	// IA_IMAGE, IA_OVERWRITE ...
uint32_t unknown_4;
uint32_t unknown_5;
};

enum atribute
{
MAIN_HEADER=0x0A,
IA_IMAGE=0x02,
IA_OVERWRITE=0x06
};

static const char *ota_package = "update_package_renamed";

int main (void)
{
FILE *f = NULL;
FILE *fout = NULL;
size_t bytes_read, bytes_write;
struct main_header mh;
struct package_header ph;
int ret = 0;

char buff[2];

if ((f = fopen64(ota_package, "rb")) == NULL) {
printf(" - Could not open %s!\n", ota_package);
ret = 1;
goto exit;
}

bytes_read = fread(&mh, 1, sizeof(struct main_header), f);

if (bytes_read != sizeof(struct main_header)) {
printf(" - Short read meain header on %s: expected 0x%lx, got 0x%lx\n", ota_package, sizeof(struct main_header), bytes_read);
ret = 1;
goto exit;
}

printf("\n\n============= MAIN HEADER ==============\n");
printf("Unknown_1 = 0x%X\n", mh.unknown_1);
printf("Unknown_2 = 0x%X\n", mh.unknown_2);
printf("Unknown_3 = 0x%X\n", mh.unknown_3);
printf("Unknown_4 = 0x%X\n", mh.unknown_4);
printf("Total Packages = 0x%X\n", mh.total);
printf("===========================================\n");

if (mh.total)
{
uint8_t i;
uint32_t offsets[128];

for (i=0; i < mh.total; ++i)
{
bytes_read = fread(&ph, 1, sizeof(struct package_header), f);

if (bytes_read != sizeof(struct package_header)) {
printf(" - Short read package header on %s: expected 0x%lx, got 0x%lx\n", ota_package, sizeof(struct package_header), bytes_read);
ret = 1;
goto exit;
}

printf("\nPACKAGE: %d\n--------------\n", i);
printf("id = 0x%X\n", ph.id);
printf("size = 0x%X\n", ph.size);
printf("Unknown_1 = 0x%X\n", ph.unknown_1);
printf("Unknown_2 = 0x%X\n", ph.unknown_2);
printf("Unknown_3 = 0x%X\n", ph.unknown_3);
printf("Atribute = 0x%X\n", ph.atribute);
printf("Unknown_4 = 0x%X\n", ph.unknown_4);
printf("Unknown_6 = 0x%X\n", ph.unknown_5);

offsets[i] = ph.size;
}

for (i=0; i < mh.total; ++i)
{
char package[64];
uint32_t j;

snprintf(package, sizeof(package), "package_%d.bin", i+1);

if ((fout = fopen64(package, "wb")) == NULL) {
printf(" - Could not open %s for write!\n", package);
ret = 1;
goto exit;
}

printf("Dumping %s...\n", package);

for (j=0; j < offsets[i]; ++j)
{
if ((bytes_read = fread(buff, 1, 1, f)) != 1)
{
printf(" - Short read on %s: expected 0x%lx, got 0x%lx\n", ota_package, 1L, bytes_read);
ret = 1;
fclose(fout);
goto exit;
}

if ((bytes_write = fwrite(buff, 1, 1, fout)) != 1)
{
printf(" - Short write on %s: expected 0x%lx, got 0x%lx\n", package, 1L, bytes_write);
ret = 1;
fclose(fout);
goto exit;
}
}

fclose(fout);
}
}

exit:
if (f)
fclose(f);

return ret;
}

output and dumps

============= MAIN HEADER ==============
Unknown_1 = 0x1A4
Unknown_2 = 0x1
Unknown_3 = 0xA
Unknown_4 = 0x10000
Total Packages = 0xC
===========================================

PACKAGE: 0
--------------
id = 0x0
size = 0xD9494
Unknown_1 = 0x0
Unknown_2 = 0x1A723EF
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 1
--------------
id = 0x1
size = 0xC5B6A
Unknown_1 = 0x0
Unknown_2 = 0x14233E9
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 2
--------------
id = 0x2
size = 0xF6
Unknown_1 = 0x0
Unknown_2 = 0x1
Unknown_3 = 0x0
Atribute = 0x6
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 3
--------------
id = 0x3
size = 0xFC
Unknown_1 = 0x0
Unknown_2 = 0x400
Unknown_3 = 0x0
Atribute = 0x6
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 4
--------------
id = 0x4
size = 0xFC
Unknown_1 = 0x0
Unknown_2 = 0x400
Unknown_3 = 0x0
Atribute = 0x6
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 5
--------------
id = 0x5
size = 0x19AE9
Unknown_1 = 0x0
Unknown_2 = 0x36328
Unknown_3 = 0x0
Atribute = 0x6
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 6
--------------
id = 0x7
size = 0xAC0ECF
Unknown_1 = 0x0
Unknown_2 = 0x59DD000
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 7
--------------
id = 0x8
size = 0xF1
Unknown_1 = 0x0
Unknown_2 = 0x1000000
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 8
--------------
id = 0x9
size = 0x123
Unknown_1 = 0x0
Unknown_2 = 0x5F000
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 9
--------------
id = 0x10
size = 0x178CCC2F
Unknown_1 = 0x0
Unknown_2 = 0x38800000
Unknown_3 = 0x1
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 10
--------------
id = 0x11
size = 0xC1E7DF
Unknown_1 = 0x0
Unknown_2 = 0x60000000
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1

PACKAGE: 11
--------------
id = 0x12
size = 0x4B5
Unknown_1 = 0x0
Unknown_2 = 0x19000000
Unknown_3 = 0x0
Atribute = 0x2
Unknown_4 = 0x0
Unknown_6 = 0x1
Dumping package_1.bin...
Dumping package_2.bin...
Dumping package_3.bin...
Dumping package_4.bin...
Dumping package_5.bin...
Dumping package_6.bin...
Dumping package_7.bin...
Dumping package_8.bin...
Dumping package_9.bin...
Dumping package_10.bin...
Dumping package_11.bin...
Dumping package_12.bin...