[Xperia Z4 Tablet Q&A, Help & Troubleshooting] klausstoertebeker:
Hello to the forum,

I'm desperate in trying to root my Sony Xperia Z4 Tablet (SGP771) with Magisk 22.1 and preserving my TA partition using TA_POC.

This is what I've done 'til now:

I managed to backup my TA partition successfully (downgraded to Android 6.0.1 stock ROM and then used backupTA_v2)

I successfully upgraded to Android 7.1.1 stock ROM

I successfully flashed TWRP 3.1.1 via command line with "fastboot flash recovery TWRP-3.1.1-lineageos-karin-20170520.img"

I successfully extracted the kernel .elf from the stock firmware via FlashTool (version 0.9.25)

I successfully ran the TA_POC skript on the extracted kernel.elf with my TA partition backup, also removin Sony RIC and DM-verity. This skript generated a boot.img file

I successfully flashed that boot.img file via command line with "fastboot flash system boot.img"

the Sony Xperia Z4 Tablet (SGP771) starts up without problems

the TA partition was mounted successfully which I controlled entering the service menu and checked the "Security" menu: all DRM keys were intact

Until here everything worked fine so

I successfully installed the Magisk-22.1 app

I successfully patched my boot.img (the one I created above) with the latest Magisk release

I successfully flashed the Magisk-patched boot.img file to the system partition via command line with "fastboot flash system boot.img"

BUT after rebooting my Sony Xperia Z4 Tablet (SGP771) stucks in a bootloop:

The Sony Xperia screen is shown for a few seconds, then the sreen turns black, the LED flashes three times in red and the tablet restarts...

After this experience I flashed the whole stock ROM tft file again, reflashed my boot.img and TWRP and tried to install some Magisk releases (20.4, 21.4 and 14) via TWRP which always resulted in the bootloop I mentioned above :(

I guess the error is generated by the Magisk app when patching a modified boot.img file. So I'd like to change the order of applying the modifications, starting withpatching a kernel image with Magisk 22.1 and then applying the TA_POC skript.

But I have a problem of creating a kernel.img file from a kernel.elf file. Just renaming from "kernel.elf" to "kernel.img" (as described here) fails and the Magisk app refuses to patch this "image", stating that it contains an unkown file format.

So I used the sony dump tool (described here) and unpacked the kernel.elf file into a folder BOOTIMAGE_FILES. It contains the following files

-rw-rw-r-- 1 anonymous anonymous 9 Apr 26 21:55 boot.img-base
-rw-rw-r-- 1 anonymous anonymous 232 Apr 26 21:55 boot.img-cmdline
-rw-rw-r-- 1 anonymous anonymous 1035283 Apr 26 21:55 boot.img-dt
-rw-rw-r-- 1 anonymous anonymous 9 Apr 26 21:55 boot.img-kerneloff
-rw-rw-r-- 1 anonymous anonymous 5378187 Apr 26 21:55 boot.img-ramdisk.gz
-rw-rw-r-- 1 anonymous anonymous 9 Apr 26 21:55 boot.img-ramdiskoff
-rw-rw-r-- 1 anonymous anonymous 9 Apr 26 21:55 boot.img-tagsoff
-rw-rw-r-- 1 anonymous anonymous 24521208 Apr 26 21:55 boot.img-zImage

But I cannot find a description, even after searching the internet for hours, how to create a valid boot.img file which contains all these files (all without modification).

So I ask here for a way to generate a boot.img file from ALL of these files.

Thanks for help in advance

Ansgar