[Sony Xperia XZ1 Compact ROMs, Kernels, Recoveries,] munjeni:
In short about how fota-ua update device, in short steps:

1. fota-ua start at ua status 01 00 00 00 00 00 00 00, in that mode fota-ua verify partitions (check if partitons is stock)? It working in readonly mode. If error happen fota-ua write log to /cache/recovery/fota/report and delete command file. If partitions is ok, didn't write log and didn't detete command, change context of the ua_status to 06 00 00 00 09 00 00 00, reboot "reboot oem-46". Also reboot mode is indication for error, if reboot oem-46 no error, if reboot oem-50 indication for error.

2. on next boot fota-ua verifies crc parts from the the update_package_renamed and compare with crc of the partitions, it is doing in loop e.g. starting from partition fotakernel, if all crc is ok fota-ua write ua_status 03 00 00 00 00 00 00 00 , didn;t delete command file, reboot to next step. In case one of the crc not match redbend report error, write log, delete command and reboot oem-46. Also reboot mode is indication for error, if reboot oem-46 no error, if reboot oem-50 indication for error.

Curently I'm stuck on step 2, only got updated fotakernel :)

EDit:

update for step 2. In this mode many partitons is verified but I found only FOTAKernel partition is updated.

3. fota-ua start writing to device disk updating android. Its done by creating fw_backup which is I'm believing created by an binary diff program. Fota-ua create fw_backup, read from it and directly write to partitions. Update done, reboot.

Update_package_renamed:

contain headers and data, each data have its own header, e.g. system update part header:

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

00C7A0D0 [COLOR="Red"]8E C1 DF 22[/COLOR] 00 C6 52 FD 00 00 00 00 00 00 00 00 ŽÁß".ÆRý........
00C7A0E0 00 00 00 00 00 00 00 00 00 00 00 00 [COLOR="Blue"]FF FF FF FF[/COLOR] ............ÿÿÿÿ
00C7A0F0 [COLOR="Blue"]FC FF FF FF FF FF FF 3F FF FF FF FF FF FF FF FF[/COLOR] üÿÿÿÿÿÿ?ÿÿÿÿÿÿÿÿ
00C7A100 [COLOR="Blue"]FF FF FF 0F 5D 00 00[/COLOR] 00 01 00 7F E8 88 46 00 8A ÿÿÿ.]......èˆF.Š

Thing which I have figured out blue is magic bytes, red is crc, the rest need to be figured out.

If you byte swap to litle endian you getting 0x22dfc18e excatly the same like redbend reported mismatch in my case:

Info [156] RedBend: Source signature [COLOR="Red"]0x22dfc18e[/COLOR] and CRC 0x92f0af85 mismatch

I got that error because crc of the system partition in my case is 0x92f0af85 because my system partition is probably modified or probably in most case firmware from diferent wirmware customisation which mean update package is not designed for my system partiton. Need excatly the same partiton match for that ota, my hope j4nn upload it.

I didn;t figured out how fota-ua calculate crc of the system partition buut this might help:

This is probably location where it read or calculate crc

readlinkat(AT_FDCWD, "/dev/block/bootdevice/by-name/system", "/dev/block/sda65", 4095) = 16
openat(AT_FDCWD, "/dev/block/sda", O_RDWR|O_SYNC) = 3
ioctl(3, BLKGETSIZE64, [[COLOR="RoyalBlue"]31989956608[/COLOR]]) = 0
lseek(3, [COLOR="Red"]2993181696[/COLOR], SEEK_SET) = 2993181696
[COLOR="DarkOrange"]read[/COLOR](3, "\360\316\4\0\3759\23\0\0\0\0\0F\362\2\0\221\255\4\0\0\0\0\0\2\0\0\0\2\0\0\0"..., 1024) = 1024
futex(0x679d90, FUTEX_WAKE_PRIVATE, 2147483647) = 0